From patchwork Tue Oct 20 09:23:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 55297 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id BD8D723024 for ; Tue, 20 Oct 2015 09:24:29 +0000 (UTC) Received: by wikv3 with SMTP id v3sf6993068wik.1 for ; Tue, 20 Oct 2015 02:24:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=qL5z5/SVoB+sw9qvC7ITeMGGGUWc7d1pQBzcgDJDrLc=; b=SJVdKHTLfOCUEhZatNOY+onzuogk44Ro/kdZZwYqupf93agv1E+ao06WPPVh1rTaMq xjdjJ6Nev2zO0pyU4la9McAaVFL4kktl746Xpu0GzK1WCQndQpeL/wFlwiFHWU+juYhz BrOOcNA62OWWUQx3Q4u15Q5h24wCIn/Afr3lOlTJqSEgt8XEgbKTC9KIb1t+Sh1sDiSN j1jrBb1NSmzNIzaoTgh45kdbYQOTkbmvL6pWxo2m0SiRUS65AvCtP4ED+oiLTn1EPkh2 cGZJSzGuudgJMWsU08E13gA08Uz4QS1QsaWk0p+Joq+7lHugd0SxqTnnSmBXvRkRvyla w2UQ== X-Gm-Message-State: ALoCoQlAkOyHNFV7f/hixRqYJ1vcFm+PHT8mLa1xk8hjqoLLWArWQwfU4xaghJ6lXlKYi3eDiES/ X-Received: by 10.112.159.4 with SMTP id wy4mr405964lbb.15.1445333069095; Tue, 20 Oct 2015 02:24:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.212.14 with SMTP id l14ls56798lfg.44.gmail; Tue, 20 Oct 2015 02:24:28 -0700 (PDT) X-Received: by 10.25.86.213 with SMTP id k204mr757738lfb.36.1445333068926; Tue, 20 Oct 2015 02:24:28 -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 c7si1553937lbd.63.2015.10.20.02.24.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2015 02:24:28 -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 lbbec13 with SMTP id ec13so8121645lbb.0 for ; Tue, 20 Oct 2015 02:24:28 -0700 (PDT) X-Received: by 10.112.64.72 with SMTP id m8mr1102694lbs.41.1445333068818; Tue, 20 Oct 2015 02:24:28 -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 w3csp1961638lbq; Tue, 20 Oct 2015 02:24:27 -0700 (PDT) X-Received: by 10.50.73.67 with SMTP id j3mr23178129igv.15.1445333067353; Tue, 20 Oct 2015 02:24:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x7si17503432igw.73.2015.10.20.02.24.27; Tue, 20 Oct 2015 02:24:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753530AbbJTJYZ (ORCPT + 28 others); Tue, 20 Oct 2015 05:24:25 -0400 Received: from fw-tnat.cambridge.arm.com ([217.140.96.140]:25759 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751879AbbJTJYS (ORCPT ); Tue, 20 Oct 2015 05:24:18 -0400 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 t9K9NFXP008059; Tue, 20 Oct 2015 10:23:18 +0100 From: Liviu Dudau To: David Airlie , Daniel Vetter , Philipp Zabel , Mark Yao , Heiko Stuebner , Russell King Cc: dri-devel , linux-rockchip , LAKML , LKML Subject: [PATCH v4 2/4] drm/imx: Convert the probe function to the generic drm_of_component_probe() Date: Tue, 20 Oct 2015 10:23:13 +0100 Message-Id: <1445332995-11212-3-git-send-email-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.6.0 In-Reply-To: <1445332995-11212-1-git-send-email-Liviu.Dudau@arm.com> References: <1445332995-11212-1-git-send-email-Liviu.Dudau@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 Acked-by: Russell King --- 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)