From patchwork Mon Oct 19 15:07:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 55236 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f70.google.com (mail-lf0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id 9507E22F11 for ; Mon, 19 Oct 2015 15:08:25 +0000 (UTC) Received: by lffv3 with SMTP id v3sf42384941lff.1 for ; Mon, 19 Oct 2015 08:08:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:subject:date :message-id:in-reply-to:references:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=X1noVXEKV/8x3D+DIhw3lwKO3In2x/MhVO9U4E/Hctk=; b=hif3TAYb2wdzXsvR1AfQVBZqwi370QA0UGU6lbZNLlEfTSycBgIhrIJfkgG4nFQ960 jURzuxFchXHNlF3/W/o0wZ2/s8VdE/5QX832dCf48KfknfnoYtwRMtviXDYzNDKLMVh0 8x19sGvIJVbcuNR7GgXHrkUWkpbp39W0gPHG1+oFjbOGBhhX2zD24v97qdj41dnfQRsl +a+CRMoqBnmzxzYoRYExSkJpz42o9GmP4mHh+aOAOx5GGTE5rvIAM33TFZ4qQ3ck47aT iPaqxlf8zNt1Iuv+L1BbL4SQy9otwxttqG7BTwSg0PJ9whFIG8svZW3COUFuXc6Atau2 jYcw== X-Gm-Message-State: ALoCoQmFi/mK+aLe1+bKJj1SFvCZaNIAMiRwumGGcWjTPQCqdMVEKbtxQ6GvYcAvktRbYR97TSO2 X-Received: by 10.112.159.4 with SMTP id wy4mr6828047lbb.15.1445267304548; Mon, 19 Oct 2015 08:08:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.22.88 with SMTP id m85ls616061lfi.21.gmail; Mon, 19 Oct 2015 08:08:24 -0700 (PDT) X-Received: by 10.112.157.195 with SMTP id wo3mr15200784lbb.0.1445267304441; Mon, 19 Oct 2015 08:08:24 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id e2si23194531lbp.39.2015.10.19.08.08.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 08:08:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbes7 with SMTP id es7so56675647lbb.2 for ; Mon, 19 Oct 2015 08:08:24 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr14815264lbb.112.1445267304290; Mon, 19 Oct 2015 08:08:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1527979lbq; Mon, 19 Oct 2015 08:08:23 -0700 (PDT) X-Received: by 10.68.57.129 with SMTP id i1mr34798016pbq.51.1445267299293; Mon, 19 Oct 2015 08:08:19 -0700 (PDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id t16si53265455pbs.225.2015.10.19.08.08.19; Mon, 19 Oct 2015 08:08:19 -0700 (PDT) Received-SPF: pass (google.com: domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C98C6E99C; Mon, 19 Oct 2015 08:08:18 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C5076E962 for ; Mon, 19 Oct 2015 08:08:11 -0700 (PDT) Received: from e106497-lin.cambridge.arm.com (e106497-lin.cambridge.arm.com [10.2.131.158]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id t9JF7o2j025900; Mon, 19 Oct 2015 16:07:50 +0100 From: Liviu Dudau To: David Airlie , Daniel Vetter , Philipp Zabel , Mark Yao , Heiko Stuebner , Russell King Subject: [RFC PATCH v3 2/4] drm/imx: Convert the probe function to the generic drm_of_component_probe() Date: Mon, 19 Oct 2015 16:07:48 +0100 Message-Id: <1445267270-23126-3-git-send-email-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.6.0 In-Reply-To: <1445267270-23126-1-git-send-email-Liviu.Dudau@arm.com> References: <1445267270-23126-1-git-send-email-Liviu.Dudau@arm.com> Cc: linux-rockchip , LAKML , dri-devel , LKML X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: liviu.dudau@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The generic function is functionally equivalent to the driver's imx_drm_platform_probe(). Use the generic function and reduce the overall code size. Signed-off-by: Liviu Dudau --- drivers/gpu/drm/imx/imx-drm-core.c | 55 +++----------------------------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index de00a6c..64f16ea 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -531,59 +531,12 @@ static const struct component_master_ops imx_drm_ops = { static int imx_drm_platform_probe(struct platform_device *pdev) { - struct device_node *ep, *port, *remote; - struct component_match *match = NULL; - int ret; - int i; - - /* - * Bind the IPU display interface ports first, so that - * imx_drm_encoder_parse_of called from encoder .bind callbacks - * works as expected. - */ - for (i = 0; ; i++) { - port = of_parse_phandle(pdev->dev.of_node, "ports", i); - if (!port) - break; - - component_match_add(&pdev->dev, &match, compare_of, port); - } + int ret = drm_of_component_probe(&pdev->dev, compare_of, &imx_drm_ops); - if (i == 0) { - dev_err(&pdev->dev, "missing 'ports' property\n"); - return -ENODEV; - } + if (!ret) + ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); - /* Then bind all encoders */ - for (i = 0; ; i++) { - port = of_parse_phandle(pdev->dev.of_node, "ports", i); - if (!port) - break; - - for_each_child_of_node(port, ep) { - remote = of_graph_get_remote_port_parent(ep); - if (!remote || !of_device_is_available(remote)) { - of_node_put(remote); - continue; - } else if (!of_device_is_available(remote->parent)) { - dev_warn(&pdev->dev, "parent device of %s is not available\n", - remote->full_name); - of_node_put(remote); - continue; - } - - component_match_add(&pdev->dev, &match, compare_of, - remote); - of_node_put(remote); - } - of_node_put(port); - } - - ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); - if (ret) - return ret; - - return component_master_add_with_match(&pdev->dev, &imx_drm_ops, match); + return ret; } static int imx_drm_platform_remove(struct platform_device *pdev)