From patchwork Tue Oct 20 09:23:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 55296 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 4AC2C23024 for ; Tue, 20 Oct 2015 09:24:20 +0000 (UTC) Received: by wicfg8 with SMTP id fg8sf361449wic.0 for ; Tue, 20 Oct 2015 02:24:19 -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=uvKx41uFqm+p41gDmVOHWnaNdS76t7RCG+WcJ7+9RoA=; b=QUHe77W5aoGOhrJIi1+Q1ui8a004KXZ61iPD9nSznssHJX7pUQSv1Zkl9sC5wHmDWi q9oSoL+L+T4UphDAkLoi6eZndBvVdncIIUBoEF1GmOf8t0WewK/QVDGvm9rdvZmEpt76 tdVHvVT/X4HR8soG2ZcWKIEpEmG+C5oBIaBnehywANfORACxiqjunAbXyMHPoiSyskvW olzRbSN4VVl7j1nHOPOvDYG+oPWrUPOGaLOCB8Blf/MjQNh/YS6F0TMqH6dP/YlXWCpf J56KAJ3KFtUmi9qnTC+CBv5Fh0UmOUttn5AYtWPET9DyWQNa7WSoJPSRs2s6w4ZwKcWt bL7A== X-Gm-Message-State: ALoCoQn+oGE7nUF+jGWlcVf9GwZZ62Yz4gBL9I0o8iisVCn8AG6b8fzveHOF2LTShwJXsE97F6Eb X-Received: by 10.180.86.227 with SMTP id s3mr527650wiz.0.1445333059564; Tue, 20 Oct 2015 02:24:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.20.202 with SMTP id 71ls54745lfu.95.gmail; Tue, 20 Oct 2015 02:24:19 -0700 (PDT) X-Received: by 10.112.209.4 with SMTP id mi4mr1155618lbc.7.1445333059383; Tue, 20 Oct 2015 02:24:19 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id p62si1543009lfe.138.2015.10.20.02.24.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2015 02:24:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbcao8 with SMTP id ao8so10467958lbc.3 for ; Tue, 20 Oct 2015 02:24:19 -0700 (PDT) X-Received: by 10.112.64.41 with SMTP id l9mr167443lbs.32.1445333059234; Tue, 20 Oct 2015 02:24:19 -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 w3csp1961570lbq; Tue, 20 Oct 2015 02:24:18 -0700 (PDT) X-Received: by 10.50.142.99 with SMTP id rv3mr2856861igb.16.1445333058161; Tue, 20 Oct 2015 02:24:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s22si163481ioi.136.2015.10.20.02.24.17; Tue, 20 Oct 2015 02:24:18 -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 S1753162AbbJTJYP (ORCPT + 28 others); Tue, 20 Oct 2015 05:24:15 -0400 Received: from fw-tnat.cambridge.arm.com ([217.140.96.140]:53110 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751725AbbJTJYM (ORCPT ); Tue, 20 Oct 2015 05:24:12 -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 t9K9NFXQ008059; 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 3/4] drm/rockchip: Convert the probe function to the generic drm_of_component_probe() Date: Tue, 20 Oct 2015 10:23:14 +0100 Message-Id: <1445332995-11212-4-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.176 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: , Use the generic drm_of_component_probe() function to probe for components. Signed-off-by: Liviu Dudau --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 81 +++-------------------------- 1 file changed, 6 insertions(+), 75 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index f22e1e1..d26e0cc 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -418,29 +419,6 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == np; } -static void rockchip_add_endpoints(struct device *dev, - struct component_match **match, - struct device_node *port) -{ - struct device_node *ep, *remote; - - 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(dev, "parent device of %s is not available\n", - remote->full_name); - of_node_put(remote); - continue; - } - - component_match_add(dev, match, compare_of, remote); - of_node_put(remote); - } -} - static int rockchip_drm_bind(struct device *dev) { struct drm_device *drm; @@ -483,61 +461,14 @@ static const struct component_master_ops rockchip_drm_ops = { static int rockchip_drm_platform_probe(struct platform_device *pdev) { - struct device *dev = &pdev->dev; - struct component_match *match = NULL; - struct device_node *np = dev->of_node; - struct device_node *port; - int i; - - if (!np) - return -ENODEV; - /* - * Bind the crtc ports first, so that - * drm_of_find_possible_crtcs called from encoder .bind callbacks - * works as expected. - */ - for (i = 0;; i++) { - port = of_parse_phandle(np, "ports", i); - if (!port) - break; - - if (!of_device_is_available(port->parent)) { - of_node_put(port); - continue; - } - - component_match_add(dev, &match, compare_of, port->parent); - of_node_put(port); - } + int ret = drm_of_component_probe(&pdev->dev, compare_of, + &rockchip_drm_ops); - if (i == 0) { - dev_err(dev, "missing 'ports' property\n"); + /* keep compatibility with old code that was returning -ENODEV */ + if (ret == -EINVAL) return -ENODEV; - } - if (!match) { - dev_err(dev, "No available vop found for display-subsystem.\n"); - return -ENODEV; - } - /* - * For each bound crtc, bind the encoders attached to its - * remote endpoint. - */ - for (i = 0;; i++) { - port = of_parse_phandle(np, "ports", i); - if (!port) - break; - - if (!of_device_is_available(port->parent)) { - of_node_put(port); - continue; - } - - rockchip_add_endpoints(dev, &match, port); - of_node_put(port); - } - - return component_master_add_with_match(dev, &rockchip_drm_ops, match); + return ret; } static int rockchip_drm_platform_remove(struct platform_device *pdev)