From patchwork Mon Oct 19 15:07:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 55234 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 2E9B522F11 for ; Mon, 19 Oct 2015 15:08:16 +0000 (UTC) Received: by lfaz124 with SMTP id z124sf42413239lfa.0 for ; Mon, 19 Oct 2015 08:08:15 -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=r1XDg6YFqvw42krIPJysiDbqfCMdNSkyzJDFdFK8c9c=; b=h7RG3lRcJVWODO2dQo2kPIf5/RBQLgnFUeCBaTyB4V56m2P1PFAMdbxifAtdHjW1iw dmWletJjRk9AD3EXfui9a5YQsCR3XZd/641OfxmaSXPjhJoSNNzhplBozt5+q20CH5mj xiprqoG6sHnT1PIu43N1cx/6RjtVGPOGZKqEwDTC21zM8wAE6aNASY0yucjUX0YP5Skl hhFBQjmQFZspg5A44oFPIqsVidAiL8T9cWA+7da4vYuiubnDetPJmYQ5JtfFEoXIBevS ur+vIvT7mdhC9T4w5/2g/Pci6FRcs2rT0xv7ehoTMEsxWFI8nn8oxZIuFvYGW1/Di/uE TFpg== X-Gm-Message-State: ALoCoQkpgY33eMsHQsqmidjDnOEnDHi0TtOSKK3HVzs3EmeifJdGdv5JgmPe/7G/GizmdnVfrR+V X-Received: by 10.112.159.4 with SMTP id wy4mr6827894lbb.15.1445267295105; Mon, 19 Oct 2015 08:08:15 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.86.70 with SMTP id k67ls618538lfb.43.gmail; Mon, 19 Oct 2015 08:08:14 -0700 (PDT) X-Received: by 10.25.148.204 with SMTP id w195mr290974lfd.77.1445267294827; Mon, 19 Oct 2015 08:08:14 -0700 (PDT) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id c7si23189603lbd.63.2015.10.19.08.08.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 08:08:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by lffz202 with SMTP id z202so31048936lff.3 for ; Mon, 19 Oct 2015 08:08:14 -0700 (PDT) X-Received: by 10.25.154.203 with SMTP id c194mr3094921lfe.32.1445267294690; Mon, 19 Oct 2015 08:08:14 -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 w3csp1527889lbq; Mon, 19 Oct 2015 08:08:13 -0700 (PDT) X-Received: by 10.66.158.100 with SMTP id wt4mr35754587pab.31.1445267293528; Mon, 19 Oct 2015 08:08:13 -0700 (PDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id gr2si53283364pbc.174.2015.10.19.08.08.13; Mon, 19 Oct 2015 08:08:13 -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 8A54E6E962; Mon, 19 Oct 2015 08:08:12 -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 5D3EF6E964 for ; Mon, 19 Oct 2015 08:08:10 -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 t9JF7o2k025900; 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 3/4] drm/rockchip: Convert the probe function to the generic drm_of_component_probe() Date: Mon, 19 Oct 2015 16:07:49 +0100 Message-Id: <1445267270-23126-4-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.215.46 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 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)