From patchwork Fri Jun 3 14:21:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9153213 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 910BE6072B for ; Fri, 3 Jun 2016 14:22:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 818072780C for ; Fri, 3 Jun 2016 14:22:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7621327BFA; Fri, 3 Jun 2016 14:22:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF563282E8 for ; Fri, 3 Jun 2016 14:22:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b8pzX-000112-VS; Fri, 03 Jun 2016 14:22:27 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b8pzB-0000iP-30 for linux-mediatek@lists.infradead.org; Fri, 03 Jun 2016 14:22:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References:In-Reply-To; bh=8xi5rnpR5bd31aIAhKamEYf+7zE7qWD9Zq/NaxSOJfY=; b=GPzLxfX2OgAMclC1lWdvuy4U8Kg9sp1iKlWCuBZjey5Ym1BUITlkY56zpG+0KeaDbR2sJwvjqyiaSeRnKj7Zj/5/RqaKT67TSPgw9wgYyGPXdHpSLckP+Yp+Em+cANPX8JqXaq/RqSb3IlqNAtFYTYCyqtap6jmrB/kwe7HlOnI=; Received: from e0022681537dd.dyn.armlinux.org.uk ([2001:4d48:ad52:3201:222:68ff:fe15:37dd]:57923 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1b8pyb-00013f-Fv; Fri, 03 Jun 2016 15:21:29 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1b8pyX-0005OP-2s; Fri, 03 Jun 2016 15:21:25 +0100 In-Reply-To: <20160603141548.GC1041@n2100.armlinux.org.uk> References: <20160603141548.GC1041@n2100.armlinux.org.uk> From: Russell King To: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH v2 2/3] drm: convert DT component matching to component_match_add_release() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 03 Jun 2016 15:21:25 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160603_072206_575369_9F200599 X-CRM114-Status: GOOD ( 14.93 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , David Airlie , freedreno@lists.freedesktop.org, Liviu Dudau , Rob Clark , Christian Gmeiner , Benjamin Gaignard , Lucas Stach , Vincent Abriou , Mark Yao Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Convert DT component matching to use component_match_add_release(). Signed-off-by: Russell King Acked-by: Lucas Stach Acked-by: Liviu Dudau Acked-by: Vincent Abriou --- drivers/gpu/drm/arm/hdlcd_drv.c | 9 +++------ drivers/gpu/drm/armada/armada_drv.c | 8 ++------ drivers/gpu/drm/drm_of.c | 6 ++++-- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 11 ++--------- drivers/gpu/drm/msm/msm_drv.c | 8 ++------ drivers/gpu/drm/msm/msm_drv.h | 1 + drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 12 +++--------- drivers/gpu/drm/sti/sti_drv.c | 9 ++------- drivers/gpu/drm/tilcdc/tilcdc_external.c | 8 ++------ 9 files changed, 21 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index b987c63ba8d6..f00845c25795 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -443,11 +444,6 @@ static const struct component_master_ops hdlcd_master_ops = { .unbind = hdlcd_drm_unbind, }; -static int compare_dev(struct device *dev, void *data) -{ - return dev->of_node == data; -} - static int hdlcd_probe(struct platform_device *pdev) { struct device_node *port, *ep; @@ -474,7 +470,8 @@ static int hdlcd_probe(struct platform_device *pdev) return -EAGAIN; } - component_match_add(&pdev->dev, &match, compare_dev, port); + component_match_add_of(&pdev->dev, &match, port); + of_node_put(port); return component_master_add_with_match(&pdev->dev, &hdlcd_master_ops, match); diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index 439824a61aa5..f2716d20c257 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -227,11 +228,6 @@ static void armada_drm_unbind(struct device *dev) drm_put_dev(dev_get_drvdata(dev)); } -static int compare_of(struct device *dev, void *data) -{ - return dev->of_node == data; -} - static int compare_dev_name(struct device *dev, void *data) { const char *name = data; @@ -255,7 +251,7 @@ static void armada_add_endpoints(struct device *dev, continue; } - component_match_add(dev, match, compare_of, remote); + component_match_add_of(dev, match, remote); of_node_put(remote); } } diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index bc98bb94264d..d13fc633aeea 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -101,7 +102,7 @@ int drm_of_component_probe(struct device *dev, continue; } - component_match_add(dev, &match, compare_of, port); + component_match_add_of(dev, &match, compare_of, port); of_node_put(port); } @@ -140,7 +141,8 @@ int drm_of_component_probe(struct device *dev, continue; } - component_match_add(dev, &match, compare_of, remote); + component_match_add_of_compare(dev, &match, compare_of, + remote); of_node_put(remote); } of_node_put(port); diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c index 3d4f56df8359..a0e0764a6269 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c @@ -15,6 +15,7 @@ */ #include +#include #include #include "etnaviv_drv.h" @@ -606,13 +607,6 @@ static const struct component_master_ops etnaviv_master_ops = { .unbind = etnaviv_unbind, }; -static int compare_of(struct device *dev, void *data) -{ - struct device_node *np = data; - - return dev->of_node == np; -} - static int compare_str(struct device *dev, void *data) { return !strcmp(dev_name(dev), data); @@ -635,8 +629,7 @@ static int etnaviv_pdev_probe(struct platform_device *pdev) if (!core_node) break; - component_match_add(&pdev->dev, &match, compare_of, - core_node); + component_match_add_of(&pdev->dev, &match, core_node); of_node_put(core_node); } } else if (dev->platform_data) { diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 9c654092ef78..5293aa775c5a 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -800,11 +800,6 @@ static const struct dev_pm_ops msm_pm_ops = { * NOTE: duplication of the same code as exynos or imx (or probably any other). * so probably some room for some helpers */ -static int compare_of(struct device *dev, void *data) -{ - return dev->of_node == data; -} - static int add_components(struct device *dev, struct component_match **matchptr, const char *name) { @@ -818,7 +813,8 @@ static int add_components(struct device *dev, struct component_match **matchptr, if (!node) break; - component_match_add(dev, matchptr, compare_of, node); + component_match_add_of(dev, matchptr, node); + of_node_put(node); } return 0; diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 5b2963f32291..66dafecaf115 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index a409d1f703cb..84c50f6770c3 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -414,13 +415,6 @@ static const struct dev_pm_ops rockchip_drm_pm_ops = { rockchip_drm_sys_resume) }; -static int compare_of(struct device *dev, void *data) -{ - struct device_node *np = data; - - return dev->of_node == np; -} - static void rockchip_add_endpoints(struct device *dev, struct component_match **match, struct device_node *port) @@ -439,7 +433,7 @@ static void rockchip_add_endpoints(struct device *dev, continue; } - component_match_add(dev, match, compare_of, remote); + component_match_add_of(dev, match, remote); of_node_put(remote); } } @@ -518,7 +512,7 @@ static int rockchip_drm_platform_probe(struct platform_device *pdev) is_support_iommu = false; } - component_match_add(dev, &match, compare_of, port->parent); + component_match_add_of(dev, &match, port->parent); of_node_put(port); } diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index 872495e72294..aeb2787c9bd4 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -341,11 +342,6 @@ static struct drm_driver sti_driver = { .minor = DRIVER_MINOR, }; -static int compare_of(struct device *dev, void *data) -{ - return dev->of_node == data; -} - static int sti_bind(struct device *dev) { return drm_platform_init(&sti_driver, to_platform_device(dev)); @@ -375,8 +371,7 @@ static int sti_platform_probe(struct platform_device *pdev) child_np = of_get_next_available_child(node, NULL); while (child_np) { - component_match_add(dev, &match, compare_of, child_np); - of_node_put(child_np); + component_match_add_of(dev, &match, child_np); child_np = of_get_next_available_child(node, child_np); } diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c index 03acb4f99982..1b3fd9fa4bef 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_external.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c @@ -9,6 +9,7 @@ */ #include +#include #include #include "tilcdc_drv.h" @@ -130,11 +131,6 @@ void tilcdc_remove_external_encoders(struct drm_device *dev) priv->connector_funcs[i]); } -static int dev_match_of(struct device *dev, void *data) -{ - return dev->of_node == data; -} - int tilcdc_get_external_components(struct device *dev, struct component_match **match) { @@ -152,7 +148,7 @@ int tilcdc_get_external_components(struct device *dev, dev_dbg(dev, "Subdevice node '%s' found\n", node->name); if (match) - component_match_add(dev, match, dev_match_of, node); + component_match_add_of(dev, match, node); of_node_put(node); count++; }