From patchwork Mon Oct 19 12:21:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 55224 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id DC03C23047 for ; Mon, 19 Oct 2015 12:22:26 +0000 (UTC) Received: by wiyb4 with SMTP id b4sf621988wiy.2 for ; Mon, 19 Oct 2015 05:22:26 -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=mLfif7JC9i/zLQQF6eklz/3Gc+xqfsNLxG5OqMtCDHg=; b=JGldf69tfpe/l2/BowwKsaj9CVoihgNx1ctDAExanLG4qEIUJWt5qMx13UwKV8E1MU cE2G92YM2zVqMXPngjYOW2ixtxPKDrixNAG/D8Utcq67AcQvK4cl7Ecc1I923GFAATTA v2jAnQtp34DBPS/cLwxD4cWJqMY7tpmYBwxJwhALPq5Nabzq27pl48mTd63V61OxaGwz 8TB4yaeBI71ojyr+3zgL8P1do6q5L8hw4CjpDFBHECEPUPZawxsWM7LeEIck06AdlnZf i8YxwUNOVPg9hw+YJTCrT4pzrGvXegbcZPdLCx+bj8kSRTk/B/MUOOVg7NNhGRKuonOD salg== X-Gm-Message-State: ALoCoQn5aXq8j1ivgzyEEIfEqcclkd0mZYAokVxnEpezHDHv4kyTLjvjPJ6wUnvV0wiBaApwzgnX X-Received: by 10.180.184.164 with SMTP id ev4mr4155634wic.3.1445257346241; Mon, 19 Oct 2015 05:22:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.153.65 with SMTP id b62ls533741lfe.57.gmail; Mon, 19 Oct 2015 05:22:26 -0700 (PDT) X-Received: by 10.112.163.99 with SMTP id yh3mr14582976lbb.121.1445257346077; Mon, 19 Oct 2015 05:22:26 -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 sg5si22629049lbb.162.2015.10.19.05.22.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 05:22:26 -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 es7so52810465lbb.2 for ; Mon, 19 Oct 2015 05:22:26 -0700 (PDT) X-Received: by 10.112.168.228 with SMTP id zz4mr14720100lbb.73.1445257345956; Mon, 19 Oct 2015 05:22:25 -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 w3csp1437791lbq; Mon, 19 Oct 2015 05:22:25 -0700 (PDT) X-Received: by 10.50.73.98 with SMTP id k2mr18984489igv.96.1445257344620; Mon, 19 Oct 2015 05:22:24 -0700 (PDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id 37si25980724iom.125.2015.10.19.05.22.24; Mon, 19 Oct 2015 05:22:24 -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 5F9DA6E8E0; Mon, 19 Oct 2015 05:22:22 -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 CA9846E8DC for ; Mon, 19 Oct 2015 05:22:19 -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 t9JCLrEE003452; Mon, 19 Oct 2015 13:21:54 +0100 From: Liviu Dudau To: David Airlie , Daniel Vetter , Philipp Zabel , Mark Yao , Heiko Stuebner , Russell King Subject: [RFC PATCH v2 2/4] drm/imx: Convert the probe function to the generic drm_of_component_probe() Date: Mon, 19 Oct 2015 13:21:51 +0100 Message-Id: <1445257313-7147-3-git-send-email-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.6.0 In-Reply-To: <1445257313-7147-1-git-send-email-Liviu.Dudau@arm.com> References: <1445257313-7147-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 | 54 +------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index de00a6c..384d819 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -531,59 +531,7 @@ 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); - } - - if (i == 0) { - dev_err(&pdev->dev, "missing 'ports' property\n"); - return -ENODEV; - } - - /* 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 drm_of_component_probe(&pdev->dev, compare_of, &imx_drm_ops); } static int imx_drm_platform_remove(struct platform_device *pdev)