From patchwork Fri Jun 3 07:58:10 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: 9152051 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 6E37A60751 for ; Fri, 3 Jun 2016 08:00:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DEB825EA6 for ; Fri, 3 Jun 2016 08:00:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52829282E8; Fri, 3 Jun 2016 08:00:29 +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 9C8BA25EA6 for ; Fri, 3 Jun 2016 08:00:26 +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 1b8k0W-0007ZJ-JR; Fri, 03 Jun 2016 07:59:04 +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 1b8k0T-0007GW-8E for linux-arm-kernel@lists.infradead.org; Fri, 03 Jun 2016 07:59:02 +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:To:From; bh=fKnxBY3LBkH4DNgrOPdmpAI7Any9c3DzeQlGp7umENs=; b=eVqu+dSG7K6D0k9viMHT5BpgDe6ysj8Ufr6fn76SlYaN2xP78dc+lOLnDGgJVLq0hrx8wnIUBInpIAWeN2afkrxtKGh7FIxcTGOiG+ChIUkh6BM3iUfhtOwLl/6/0XEQjgo1NyrDj/UncTaZ4yeI6FmYMD0N8IX6/4x812+HAWI=; Received: from e0022681537dd.dyn.armlinux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:39505 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 1b8jzf-0006ui-KH; Fri, 03 Jun 2016 08:58:11 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1b8jze-00046l-K5; Fri, 03 Jun 2016 08:58:10 +0100 From: Russell King To: Liviu Dudau , David Airlie , Rob Clark , Mark Yao , Heiko Stuebner , Benjamin Gaignard , Vincent Abriou , dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH] drm: convert DT component matching to component_match_add_release() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 03 Jun 2016 08:58:10 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160603_005901_798380_6B55C0AF X-CRM114-Status: GOOD ( 12.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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 Reviewed-by: Liviu Dudau Acked-by: Liviu Dudau --- drivers/gpu/drm/arm/hdlcd_drv.c | 10 ++++++++-- drivers/gpu/drm/armada/armada_drv.c | 9 +++++++-- drivers/gpu/drm/drm_of.c | 13 +++++++++---- drivers/gpu/drm/msm/msm_drv.c | 8 +++++++- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 13 ++++++++++--- drivers/gpu/drm/sti/sti_drv.c | 9 +++++++-- drivers/gpu/drm/tilcdc/tilcdc_external.c | 9 +++++++-- 7 files changed, 55 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c index b987c63ba8d6..bbde48c4f550 100644 --- a/drivers/gpu/drm/arm/hdlcd_drv.c +++ b/drivers/gpu/drm/arm/hdlcd_drv.c @@ -443,11 +443,16 @@ static const struct component_master_ops hdlcd_master_ops = { .unbind = hdlcd_drm_unbind, }; -static int compare_dev(struct device *dev, void *data) +static int compare_of(struct device *dev, void *data) { return dev->of_node == data; } +static void release_of(struct device *dev, void *data) +{ + of_node_put(data); +} + static int hdlcd_probe(struct platform_device *pdev) { struct device_node *port, *ep; @@ -474,7 +479,8 @@ static int hdlcd_probe(struct platform_device *pdev) return -EAGAIN; } - component_match_add(&pdev->dev, &match, compare_dev, port); + component_match_add_release(&pdev->dev, &match, release_of, + compare_of, 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..6ca2aa36515e 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -232,6 +232,11 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == data; } +static void release_of(struct device *dev, void *data) +{ + of_node_put(data); +} + static int compare_dev_name(struct device *dev, void *data) { const char *name = data; @@ -255,8 +260,8 @@ static void armada_add_endpoints(struct device *dev, continue; } - component_match_add(dev, match, compare_of, remote); - of_node_put(remote); + component_match_add_release(dev, match, release_of, + compare_of, remote); } } diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index bc98bb94264d..5d183479d7d6 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -6,6 +6,11 @@ #include #include +static void drm_release_of(struct device *dev, void *data) +{ + of_node_put(data); +} + /** * drm_crtc_port_mask - find the mask of a registered CRTC by port OF node * @dev: DRM device @@ -101,8 +106,8 @@ int drm_of_component_probe(struct device *dev, continue; } - component_match_add(dev, &match, compare_of, port); - of_node_put(port); + component_match_add_release(dev, &match, drm_release_of, + compare_of, port); } if (i == 0) { @@ -140,8 +145,8 @@ int drm_of_component_probe(struct device *dev, continue; } - component_match_add(dev, &match, compare_of, remote); - of_node_put(remote); + component_match_add_release(dev, &match, drm_release_of, + compare_of, remote); } of_node_put(port); } diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 9c654092ef78..1f7de47d817e 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -805,6 +805,11 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == data; } +static void release_of(struct device *dev, void *data) +{ + of_node_put(data); +} + static int add_components(struct device *dev, struct component_match **matchptr, const char *name) { @@ -818,7 +823,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_release(dev, matchptr, release_of, + compare_of, node); } return 0; diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index a409d1f703cb..f5a68fc031ed 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -421,6 +421,11 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == np; } +static void release_of(struct device *dev, void *data) +{ + of_node_put(data); +} + static void rockchip_add_endpoints(struct device *dev, struct component_match **match, struct device_node *port) @@ -439,8 +444,8 @@ static void rockchip_add_endpoints(struct device *dev, continue; } - component_match_add(dev, match, compare_of, remote); - of_node_put(remote); + component_match_add_release(dev, match, release_of, + compare_of, remote); } } @@ -518,7 +523,9 @@ static int rockchip_drm_platform_probe(struct platform_device *pdev) is_support_iommu = false; } - component_match_add(dev, &match, compare_of, port->parent); + of_node_get(port->parent); + component_match_add_release(dev, &match, release_of, + compare_of, 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..4ee6fa4f1beb 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c @@ -346,6 +346,11 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == data; } +static void release_of(struct device *dev, void *data) +{ + of_node_put(data); +} + static int sti_bind(struct device *dev) { return drm_platform_init(&sti_driver, to_platform_device(dev)); @@ -375,8 +380,8 @@ 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_release(dev, &match, release_of, + compare_of, 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..7e11b5ecdd4a 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_external.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c @@ -135,6 +135,11 @@ static int dev_match_of(struct device *dev, void *data) return dev->of_node == data; } +static void dev_release_of(struct device *dev, void *data) +{ + of_node_put(data); +} + int tilcdc_get_external_components(struct device *dev, struct component_match **match) { @@ -152,8 +157,8 @@ 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); - of_node_put(node); + component_match_add_release(dev, match, dev_release_of, + dev_match_of, node); count++; }