* [PATCH] drm: convert DT component matching to component_match_add_release() @ 2016-06-03 7:58 Russell King 2016-06-03 9:40 ` Liviu Dudau 2016-06-03 10:56 ` Robin Murphy 0 siblings, 2 replies; 20+ messages in thread From: Russell King @ 2016-06-03 7:58 UTC (permalink / raw) To: Liviu Dudau, David Airlie, Rob Clark, Mark Yao, Heiko Stuebner, Benjamin Gaignard, Vincent Abriou, dri-devel, linux-arm-msm, freedreno, linux-arm-kernel, linux-rockchip Convert DT component matching to use component_match_add_release(). Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> --- 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 <drm/drm_crtc.h> #include <drm/drm_of.h> +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++; } -- 2.1.0 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH] drm: convert DT component matching to component_match_add_release() 2016-06-03 7:58 [PATCH] drm: convert DT component matching to component_match_add_release() Russell King @ 2016-06-03 9:40 ` Liviu Dudau 2016-06-03 10:36 ` Russell King - ARM Linux 2016-06-03 10:56 ` Robin Murphy 1 sibling, 1 reply; 20+ messages in thread From: Liviu Dudau @ 2016-06-03 9:40 UTC (permalink / raw) To: Russell King Cc: freedreno, linux-arm-msm, dri-devel, linux-rockchip, Vincent Abriou, linux-arm-kernel On Fri, Jun 03, 2016 at 08:58:10AM +0100, Russell King wrote: > Convert DT component matching to use component_match_add_release(). Hi Russell, Any reason for not keeping the component_match_add() calls in the drivers? Planning to remove it? > > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Looks good to me! Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com> For the HDLCD part: Acked-by: Liviu Dudau <Liviu.Dudau@arm.com> Thanks, Liviu > --- > 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 <drm/drm_crtc.h> > #include <drm/drm_of.h> > > +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++; > } > > -- > 2.1.0 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯ _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] drm: convert DT component matching to component_match_add_release() 2016-06-03 9:40 ` Liviu Dudau @ 2016-06-03 10:36 ` Russell King - ARM Linux 2016-06-03 11:19 ` Liviu Dudau 0 siblings, 1 reply; 20+ messages in thread From: Russell King - ARM Linux @ 2016-06-03 10:36 UTC (permalink / raw) To: Liviu Dudau Cc: David Airlie, Rob Clark, Mark Yao, Heiko Stuebner, Benjamin Gaignard, Vincent Abriou, dri-devel, linux-arm-msm, freedreno, linux-arm-kernel, linux-rockchip On Fri, Jun 03, 2016 at 10:40:48AM +0100, Liviu Dudau wrote: > On Fri, Jun 03, 2016 at 08:58:10AM +0100, Russell King wrote: > > Convert DT component matching to use component_match_add_release(). > > Hi Russell, > > Any reason for not keeping the component_match_add() calls in the drivers? Sorry, I don't understand your comment. If we kept component_match_add() in these drivers, then this patch would not exist, because there wouldn't be any changes to the drivers. > Planning to remove it? Possibly in the longer term, but at the moment there are drivers where the match data that is passed does not need any release functionality eg, data allocated with devm_k*alloc(), or component_match_add(dev->parent, match, dss_component_compare, dev); There are some new cases that need converting which have cropped up during the last merge window, and I expect this to be an on-going educational point for driver authors, so I'm not too bothered about capturing all existing cases in this patch. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] drm: convert DT component matching to component_match_add_release() 2016-06-03 10:36 ` Russell King - ARM Linux @ 2016-06-03 11:19 ` Liviu Dudau 2016-06-03 11:48 ` Russell King - ARM Linux 0 siblings, 1 reply; 20+ messages in thread From: Liviu Dudau @ 2016-06-03 11:19 UTC (permalink / raw) To: Russell King - ARM Linux Cc: David Airlie, Rob Clark, Mark Yao, Heiko Stuebner, Benjamin Gaignard, Vincent Abriou, dri-devel, linux-arm-msm, freedreno, linux-arm-kernel, linux-rockchip On Fri, Jun 03, 2016 at 11:36:33AM +0100, Russell King - ARM Linux wrote: > On Fri, Jun 03, 2016 at 10:40:48AM +0100, Liviu Dudau wrote: > > On Fri, Jun 03, 2016 at 08:58:10AM +0100, Russell King wrote: > > > Convert DT component matching to use component_match_add_release(). > > > > Hi Russell, > > > > Any reason for not keeping the component_match_add() calls in the drivers? > > Sorry, I don't understand your comment. As in: component_match_add() already exists as a macro that calls component_match_add_release(), but with a NULL release function. If it were to be changed to pass a default release_of() function then most of the drivers would not have to change, right? It is just one point of view and I was curious if there was a reason not to choose it, as it would have (probably) generated a smaller delta? > > If we kept component_match_add() in these drivers, then this patch > would not exist, because there wouldn't be any changes to the drivers. > > > Planning to remove it? > > Possibly in the longer term, but at the moment there are drivers where > the match data that is passed does not need any release functionality > eg, data allocated with devm_k*alloc(), or > > component_match_add(dev->parent, match, dss_component_compare, dev); > > There are some new cases that need converting which have cropped up > during the last merge window, and I expect this to be an on-going > educational point for driver authors, so I'm not too bothered about > capturing all existing cases in this patch. Understood. Using managed allocators is definitely a strong point in favor of having the component_match_add() function with a NULL release() hook. Best regards, Liviu > > -- > RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ > FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up > according to speedtest.net. > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯ ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] drm: convert DT component matching to component_match_add_release() 2016-06-03 11:19 ` Liviu Dudau @ 2016-06-03 11:48 ` Russell King - ARM Linux 0 siblings, 0 replies; 20+ messages in thread From: Russell King - ARM Linux @ 2016-06-03 11:48 UTC (permalink / raw) To: Liviu Dudau Cc: David Airlie, Rob Clark, Mark Yao, Heiko Stuebner, Benjamin Gaignard, Vincent Abriou, dri-devel, linux-arm-msm, freedreno, linux-arm-kernel, linux-rockchip On Fri, Jun 03, 2016 at 12:19:41PM +0100, Liviu Dudau wrote: > On Fri, Jun 03, 2016 at 11:36:33AM +0100, Russell King - ARM Linux wrote: > > On Fri, Jun 03, 2016 at 10:40:48AM +0100, Liviu Dudau wrote: > > > On Fri, Jun 03, 2016 at 08:58:10AM +0100, Russell King wrote: > > > > Convert DT component matching to use component_match_add_release(). > > > > > > Hi Russell, > > > > > > Any reason for not keeping the component_match_add() calls in the drivers? > > > > Sorry, I don't understand your comment. > > As in: component_match_add() already exists as a macro that calls > component_match_add_release(), but with a NULL release function. If it > were to be changed to pass a default release_of() function then most of > the drivers would not have to change, right? It is just one point of > view and I was curious if there was a reason not to choose it, as it > would have (probably) generated a smaller delta? And what should the calls that don't pass a DT node be called? What happens to new users who aren't passing a DT node but use component_match_add() ? What you're suggesting sound totally insane to me: you're making the change a flag-day: component_match_add() currently takes anything as the data pointer and users can pass anything that their compare function can handle - and changing that to a function which can only take a device_node. That means all non-DT users of that function need to change at the same time. Flag days are really bad news in kernel development (or any distributed development project), and I won't generate a patch which causes a flag day to occur - especially not one which impacts a large number of users. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] drm: convert DT component matching to component_match_add_release() 2016-06-03 7:58 [PATCH] drm: convert DT component matching to component_match_add_release() Russell King 2016-06-03 9:40 ` Liviu Dudau @ 2016-06-03 10:56 ` Robin Murphy 2016-06-03 14:15 ` Russell King - ARM Linux 1 sibling, 1 reply; 20+ messages in thread From: Robin Murphy @ 2016-06-03 10:56 UTC (permalink / raw) To: Russell King, Liviu Dudau, David Airlie, Rob Clark, Mark Yao, Heiko Stuebner, Benjamin Gaignard, Vincent Abriou, dri-devel, linux-arm-msm, freedreno, linux-arm-kernel, linux-rockchip Hi Russell, On 03/06/16 08:58, Russell King wrote: > Convert DT component matching to use component_match_add_release(). > > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> > --- > 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); > +} Considering that there's 7 identical copies of this function in this patch alone, perhaps there's some mileage in defining it commonly as a static __maybe_unused default_release_of() in component.h or drm_of.h (and maybe default_compare_of() similarly)? (Apologies if there's already been some strong argument against that which I've not seen, but it seems like a reasonable thing to do.) Robin. > + > 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 <drm/drm_crtc.h> > #include <drm/drm_of.h> > > +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++; > } > > ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH] drm: convert DT component matching to component_match_add_release() 2016-06-03 10:56 ` Robin Murphy @ 2016-06-03 14:15 ` Russell King - ARM Linux 2016-06-03 14:21 ` [PATCH v2 1/3] of: add common OF-based component functionality Russell King ` (2 more replies) 0 siblings, 3 replies; 20+ messages in thread From: Russell King - ARM Linux @ 2016-06-03 14:15 UTC (permalink / raw) To: Robin Murphy Cc: Liviu Dudau, David Airlie, Rob Clark, Mark Yao, Heiko Stuebner, Benjamin Gaignard, Vincent Abriou, dri-devel, linux-arm-msm, freedreno, linux-arm-kernel, linux-rockchip On Fri, Jun 03, 2016 at 11:56:40AM +0100, Robin Murphy wrote: > Hi Russell, > > On 03/06/16 08:58, Russell King wrote: > >Convert DT component matching to use component_match_add_release(). > > > >Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> > >--- > > 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); > >+} > > Considering that there's 7 identical copies of this function in this patch > alone, perhaps there's some mileage in defining it commonly as a static > __maybe_unused default_release_of() in component.h or drm_of.h (and maybe > default_compare_of() similarly)? > > (Apologies if there's already been some strong argument against that which > I've not seen, but it seems like a reasonable thing to do.) What we could do is extract out the common bits of OF-component matching into drivers/of/of_component.c and make the whole thing a tad better. I'll send a v2 series threaded to this message. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 1/3] of: add common OF-based component functionality 2016-06-03 14:15 ` Russell King - ARM Linux @ 2016-06-03 14:21 ` Russell King [not found] ` <E1b8pyR-0005OJ-V3-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org> 2016-06-03 14:21 ` [PATCH v2 2/3] drm: convert DT component matching to component_match_add_release() Russell King 2016-06-03 14:21 ` [PATCH v2 3/3] iommu: " Russell King 2 siblings, 1 reply; 20+ messages in thread From: Russell King @ 2016-06-03 14:21 UTC (permalink / raw) To: devicetree, dri-devel, linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-rockchip Cc: Rob Herring, Frank Rowand, Grant Likely Add common OF-based component functionality for matching devices by device node, and releasing the device node at the appropraite time. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> --- drivers/of/Makefile | 2 +- drivers/of/of_component.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/linux/of_component.h | 14 ++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 drivers/of/of_component.c create mode 100644 include/linux/of_component.h diff --git a/drivers/of/Makefile b/drivers/of/Makefile index d7efd9d458aa..6a4a5e2c0839 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile @@ -1,4 +1,4 @@ -obj-y = base.o device.o platform.o +obj-y = base.o of_component.o device.o platform.o obj-$(CONFIG_OF_DYNAMIC) += dynamic.o obj-$(CONFIG_OF_FLATTREE) += fdt.o obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o diff --git a/drivers/of/of_component.c b/drivers/of/of_component.c new file mode 100644 index 000000000000..41e6e817d264 --- /dev/null +++ b/drivers/of/of_component.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2016 Russell King. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include <linux/component.h> +#include <linux/device.h> +#include <linux/of.h> +#include <linux/of_component.h> +#include <linux/of_graph.h> + +static void component_release_of(struct device *dev, void *data) +{ + of_node_put(data); +} + +void component_match_add_of_compare(struct device *master, + struct component_match **matchptr, + int (*compare)(struct device *, void *), struct device_node *node) +{ + of_node_get(node); + component_match_add_release(master, matchptr, component_release_of, + compare, node); +} +EXPORT_SYMBOL_GPL(component_match_add_of_compare); + +static void component_compare_of(struct device *dev, void *data) +{ + return dev->of_node == data; +} + +void component_match_add_of(struct device *master, + struct component_match **matchptr, struct device_node *node) +{ + of_node_get(node); + component_match_add_release(master, matchptr, component_release_of, + component_compare_of, node); +} +EXPORT_SYMBOL_GPL(component_match_add_of); diff --git a/include/linux/of_component.h b/include/linux/of_component.h new file mode 100644 index 000000000000..a8170ba3b786 --- /dev/null +++ b/include/linux/of_component.h @@ -0,0 +1,14 @@ +#ifndef __LINUX_COMPONENT_OF_H +#define __LINUX_COMPONENT_OF_H + +struct component_match; +struct device; +struct device_node; + +void component_match_add_of_compare(struct device *master, + struct component_match **matchptr, + int (*compare)(struct device *, void *), struct device_node *node); +void component_match_add_of(struct device *master, + struct component_match **matchptr, struct device_node *node); + +#endif -- 2.1.0 ^ permalink raw reply related [flat|nested] 20+ messages in thread
[parent not found: <E1b8pyR-0005OJ-V3-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org>]
* Re: [PATCH v2 1/3] of: add common OF-based component functionality [not found] ` <E1b8pyR-0005OJ-V3-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org> @ 2016-06-03 15:29 ` Rob Herring 2016-06-03 15:36 ` Russell King - ARM Linux 2016-06-03 15:44 ` Thierry Reding 1 sibling, 1 reply; 20+ messages in thread From: Rob Herring @ 2016-06-03 15:29 UTC (permalink / raw) To: Russell King Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, dri-devel, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-arm-msm, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, open list:ARM/Rockchip SoC..., Frank Rowand, Grant Likely On Fri, Jun 3, 2016 at 9:21 AM, Russell King <rmk+kernel-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org> wrote: > Add common OF-based component functionality for matching devices by > device node, and releasing the device node at the appropraite time. > > Signed-off-by: Russell King <rmk+kernel-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org> > --- > drivers/of/Makefile | 2 +- > drivers/of/of_component.c | 41 +++++++++++++++++++++++++++++++++++++++++ > include/linux/of_component.h | 14 ++++++++++++++ I'd prefer this to go into drivers/base/component.c. That's the general direction we've been moving. I'd expect this would cause some build failures unless the cases you converted all depend on CONFIG_OF. Rob -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 1/3] of: add common OF-based component functionality 2016-06-03 15:29 ` Rob Herring @ 2016-06-03 15:36 ` Russell King - ARM Linux 2016-06-03 19:52 ` Rob Herring 0 siblings, 1 reply; 20+ messages in thread From: Russell King - ARM Linux @ 2016-06-03 15:36 UTC (permalink / raw) To: Rob Herring Cc: devicetree@vger.kernel.org, dri-devel, linux-arm-kernel@lists.infradead.org, linux-arm-msm, linux-mediatek, open list:ARM/Rockchip SoC..., Frank Rowand, Grant Likely On Fri, Jun 03, 2016 at 10:29:40AM -0500, Rob Herring wrote: > On Fri, Jun 3, 2016 at 9:21 AM, Russell King <rmk+kernel@armlinux.org.uk> wrote: > > Add common OF-based component functionality for matching devices by > > device node, and releasing the device node at the appropraite time. > > > > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> > > --- > > drivers/of/Makefile | 2 +- > > drivers/of/of_component.c | 41 +++++++++++++++++++++++++++++++++++++++++ > > include/linux/of_component.h | 14 ++++++++++++++ > > I'd prefer this to go into drivers/base/component.c. That's the > general direction we've been moving. I'd prefer not to, I don't want to turn the component helpers into something OF specific. They aren't OF specific. > I'd expect this would cause some build failures unless the cases you > converted all depend on CONFIG_OF. Okay, I'll stick with v1 then, and the duplication that v1 involves. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 1/3] of: add common OF-based component functionality 2016-06-03 15:36 ` Russell King - ARM Linux @ 2016-06-03 19:52 ` Rob Herring 0 siblings, 0 replies; 20+ messages in thread From: Rob Herring @ 2016-06-03 19:52 UTC (permalink / raw) To: Russell King - ARM Linux Cc: devicetree@vger.kernel.org, linux-arm-msm, dri-devel, open list:ARM/Rockchip SoC..., linux-mediatek, Grant Likely, Frank Rowand, linux-arm-kernel@lists.infradead.org On Fri, Jun 3, 2016 at 10:36 AM, Russell King - ARM Linux <linux@armlinux.org.uk> wrote: > On Fri, Jun 03, 2016 at 10:29:40AM -0500, Rob Herring wrote: >> On Fri, Jun 3, 2016 at 9:21 AM, Russell King <rmk+kernel@armlinux.org.uk> wrote: >> > Add common OF-based component functionality for matching devices by >> > device node, and releasing the device node at the appropraite time. >> > >> > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> >> > --- >> > drivers/of/Makefile | 2 +- >> > drivers/of/of_component.c | 41 +++++++++++++++++++++++++++++++++++++++++ >> > include/linux/of_component.h | 14 ++++++++++++++ >> >> I'd prefer this to go into drivers/base/component.c. That's the >> general direction we've been moving. > > I'd prefer not to, I don't want to turn the component helpers into > something OF specific. They aren't OF specific. Fine, not enough code to argue about... >> I'd expect this would cause some build failures unless the cases you >> converted all depend on CONFIG_OF. > > Okay, I'll stick with v1 then, and the duplication that v1 involves. Why? You don't want to add empty functions? Seems like good clean-up. Rob ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 1/3] of: add common OF-based component functionality [not found] ` <E1b8pyR-0005OJ-V3-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org> 2016-06-03 15:29 ` Rob Herring @ 2016-06-03 15:44 ` Thierry Reding 2016-06-03 16:11 ` Russell King - ARM Linux 1 sibling, 1 reply; 20+ messages in thread From: Thierry Reding @ 2016-06-03 15:44 UTC (permalink / raw) To: Russell King Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Grant Likely, Rob Herring, Frank Rowand [-- Attachment #1: Type: text/plain, Size: 354 bytes --] On Fri, Jun 03, 2016 at 03:21:19PM +0100, Russell King wrote: [...] > diff --git a/drivers/of/of_component.c b/drivers/of/of_component.c [...] > +static void component_compare_of(struct device *dev, void *data) > +{ > + return dev->of_node == data; > +} The return statement here doesn't match the return value. Didn't GCC complain about this? Thierry [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 1/3] of: add common OF-based component functionality 2016-06-03 15:44 ` Thierry Reding @ 2016-06-03 16:11 ` Russell King - ARM Linux 0 siblings, 0 replies; 20+ messages in thread From: Russell King - ARM Linux @ 2016-06-03 16:11 UTC (permalink / raw) To: Thierry Reding Cc: devicetree, dri-devel, linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-rockchip, Grant Likely, Rob Herring, Frank Rowand On Fri, Jun 03, 2016 at 05:44:30PM +0200, Thierry Reding wrote: > On Fri, Jun 03, 2016 at 03:21:19PM +0100, Russell King wrote: > [...] > > diff --git a/drivers/of/of_component.c b/drivers/of/of_component.c > [...] > > +static void component_compare_of(struct device *dev, void *data) > > +{ > > + return dev->of_node == data; > > +} > > The return statement here doesn't match the return value. Didn't GCC > complain about this? I didn't build-test it, because I wanted people's opinions on it first (building means rebuilding my entire tree...) Anyway, the patch series is dead because I'm not prepared to make the changes which Rob mentioned, so we're back to v1 instead. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net. ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 2/3] drm: convert DT component matching to component_match_add_release() 2016-06-03 14:15 ` Russell King - ARM Linux 2016-06-03 14:21 ` [PATCH v2 1/3] of: add common OF-based component functionality Russell King @ 2016-06-03 14:21 ` Russell King 2016-06-03 15:10 ` Lucas Stach [not found] ` <E1b8pyX-0005OP-2s-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org> 2016-06-03 14:21 ` [PATCH v2 3/3] iommu: " Russell King 2 siblings, 2 replies; 20+ messages in thread From: Russell King @ 2016-06-03 14:21 UTC (permalink / raw) To: devicetree, dri-devel, linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-rockchip Cc: Liviu Dudau, David Airlie, Lucas Stach, Christian Gmeiner, Rob Clark, Mark Yao, Heiko Stuebner, Benjamin Gaignard, Vincent Abriou, freedreno Convert DT component matching to use component_match_add_release(). Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> --- 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 <linux/clk.h> #include <linux/component.h> #include <linux/list.h> +#include <linux/of_component.h> #include <linux/of_graph.h> #include <linux/of_reserved_mem.h> #include <linux/pm_runtime.h> @@ -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 <linux/component.h> #include <linux/module.h> #include <linux/of_graph.h> +#include <linux/of_component.h> #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_of.h> @@ -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 <linux/component.h> #include <linux/export.h> #include <linux/list.h> +#include <linux/of_component.h> #include <linux/of_graph.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> @@ -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 <linux/component.h> +#include <linux/of_component.h> #include <linux/of_platform.h> #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 <linux/list.h> #include <linux/iommu.h> #include <linux/types.h> +#include <linux/of_component.h> #include <linux/of_graph.h> #include <linux/of_device.h> #include <asm/sizes.h> 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 <linux/dma-mapping.h> #include <linux/pm_runtime.h> #include <linux/module.h> +#include <linux/of_component.h> #include <linux/of_graph.h> #include <linux/component.h> @@ -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 <linux/debugfs.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/of_component.h> #include <linux/of_platform.h> #include <drm/drm_atomic.h> @@ -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 <linux/component.h> +#include <linux/of_component.h> #include <linux/of_graph.h> #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++; } -- 2.1.0 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v2 2/3] drm: convert DT component matching to component_match_add_release() 2016-06-03 14:21 ` [PATCH v2 2/3] drm: convert DT component matching to component_match_add_release() Russell King @ 2016-06-03 15:10 ` Lucas Stach [not found] ` <E1b8pyX-0005OP-2s-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org> 1 sibling, 0 replies; 20+ messages in thread From: Lucas Stach @ 2016-06-03 15:10 UTC (permalink / raw) To: Russell King Cc: devicetree, linux-arm-msm, Liviu Dudau, dri-devel, linux-rockchip, linux-mediatek, freedreno, Vincent Abriou, linux-arm-kernel Am Freitag, den 03.06.2016, 15:21 +0100 schrieb Russell King: > Convert DT component matching to use component_match_add_release(). > > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> > --- > 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 ++--------- For the etnaviv part: Acked-by: Lucas Stach <l.stach@pengutronix.de> _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 20+ messages in thread
[parent not found: <E1b8pyX-0005OP-2s-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org>]
* Re: [PATCH v2 2/3] drm: convert DT component matching to component_match_add_release() [not found] ` <E1b8pyX-0005OP-2s-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org> @ 2016-06-07 13:39 ` Liviu Dudau 2016-06-07 14:26 ` Vincent ABRIOU 1 sibling, 0 replies; 20+ messages in thread From: Liviu Dudau @ 2016-06-07 13:39 UTC (permalink / raw) To: Russell King Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, David Airlie, Lucas Stach, Christian Gmeiner, Rob Clark, Mark Yao, Heiko Stuebner, Benjamin Gaignard, Vincent Abriou, freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW On Fri, Jun 03, 2016 at 03:21:25PM +0100, Russell King wrote: > Convert DT component matching to use component_match_add_release(). > > Signed-off-by: Russell King <rmk+kernel-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org> > --- > 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 <linux/clk.h> > #include <linux/component.h> > #include <linux/list.h> > +#include <linux/of_component.h> > #include <linux/of_graph.h> > #include <linux/of_reserved_mem.h> > #include <linux/pm_runtime.h> > @@ -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); For the HDLCD part of v2: Acked-by: Liviu Dudau <Liviu.Dudau-5wv7dgnIgG8@public.gmane.org> > 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 <linux/component.h> > #include <linux/module.h> > #include <linux/of_graph.h> > +#include <linux/of_component.h> > #include <drm/drmP.h> > #include <drm/drm_crtc_helper.h> > #include <drm/drm_of.h> > @@ -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 <linux/component.h> > #include <linux/export.h> > #include <linux/list.h> > +#include <linux/of_component.h> > #include <linux/of_graph.h> > #include <drm/drmP.h> > #include <drm/drm_crtc.h> > @@ -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 <linux/component.h> > +#include <linux/of_component.h> > #include <linux/of_platform.h> > > #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 <linux/list.h> > #include <linux/iommu.h> > #include <linux/types.h> > +#include <linux/of_component.h> > #include <linux/of_graph.h> > #include <linux/of_device.h> > #include <asm/sizes.h> > 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 <linux/dma-mapping.h> > #include <linux/pm_runtime.h> > #include <linux/module.h> > +#include <linux/of_component.h> > #include <linux/of_graph.h> > #include <linux/component.h> > > @@ -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 <linux/debugfs.h> > #include <linux/kernel.h> > #include <linux/module.h> > +#include <linux/of_component.h> > #include <linux/of_platform.h> > > #include <drm/drm_atomic.h> > @@ -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 <linux/component.h> > +#include <linux/of_component.h> > #include <linux/of_graph.h> > > #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++; > } > -- > 2.1.0 > -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯ -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 2/3] drm: convert DT component matching to component_match_add_release() [not found] ` <E1b8pyX-0005OP-2s-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org> 2016-06-07 13:39 ` Liviu Dudau @ 2016-06-07 14:26 ` Vincent ABRIOU 1 sibling, 0 replies; 20+ messages in thread From: Vincent ABRIOU @ 2016-06-07 14:26 UTC (permalink / raw) To: Russell King, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org Cc: Heiko Stuebner, David Airlie, Liviu Dudau, Rob Clark, Christian Gmeiner, Benjamin Gaignard, Lucas Stach, freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Mark Yao On 06/03/2016 04:21 PM, Russell King wrote: > Convert DT component matching to use component_match_add_release(). > > Signed-off-by: Russell King <rmk+kernel-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org> > --- > 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/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 <linux/debugfs.h> > #include <linux/kernel.h> > #include <linux/module.h> > +#include <linux/of_component.h> > #include <linux/of_platform.h> > > #include <drm/drm_atomic.h> > @@ -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); > } > Hi Russel, Ok for the sti driver. Acked-by: Vincent Abriou <vincent.abriou-qxv4g6HH51o@public.gmane.org> ^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 3/3] iommu: convert DT component matching to component_match_add_release() 2016-06-03 14:15 ` Russell King - ARM Linux 2016-06-03 14:21 ` [PATCH v2 1/3] of: add common OF-based component functionality Russell King 2016-06-03 14:21 ` [PATCH v2 2/3] drm: convert DT component matching to component_match_add_release() Russell King @ 2016-06-03 14:21 ` Russell King 2016-06-03 15:20 ` Matthias Brugger 2016-06-15 13:31 ` Joerg Roedel 2 siblings, 2 replies; 20+ messages in thread From: Russell King @ 2016-06-03 14:21 UTC (permalink / raw) To: devicetree, dri-devel, linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-rockchip Cc: Joerg Roedel, Matthias Brugger, iommu Convert DT component matching to use component_match_add_release(). Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> --- drivers/iommu/mtk_iommu.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index c3043d8754e3..71cf62af4e24 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -24,6 +24,7 @@ #include <linux/iopoll.h> #include <linux/list.h> #include <linux/of_address.h> +#include <linux/of_component.h> #include <linux/of_iommu.h> #include <linux/of_irq.h> #include <linux/of_platform.h> @@ -552,11 +553,6 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data) return 0; } -static int compare_of(struct device *dev, void *data) -{ - return dev->of_node == data; -} - static int mtk_iommu_bind(struct device *dev) { struct mtk_iommu_data *data = dev_get_drvdata(dev); @@ -630,17 +626,19 @@ static int mtk_iommu_probe(struct platform_device *pdev) continue; plarbdev = of_find_device_by_node(larbnode); - of_node_put(larbnode); if (!plarbdev) { plarbdev = of_platform_device_create( larbnode, NULL, platform_bus_type.dev_root); - if (!plarbdev) + if (!plarbdev) { + of_node_put(larbnode); return -EPROBE_DEFER; + } } data->smi_imu.larb_imu[i].dev = &plarbdev->dev; - component_match_add(dev, &match, compare_of, larbnode); + component_match_add_of(dev, &match, larbnode); + of_node_put(larbnode); } platform_set_drvdata(pdev, data); -- 2.1.0 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH v2 3/3] iommu: convert DT component matching to component_match_add_release() 2016-06-03 14:21 ` [PATCH v2 3/3] iommu: " Russell King @ 2016-06-03 15:20 ` Matthias Brugger 2016-06-15 13:31 ` Joerg Roedel 1 sibling, 0 replies; 20+ messages in thread From: Matthias Brugger @ 2016-06-03 15:20 UTC (permalink / raw) To: Russell King, devicetree, dri-devel, linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-rockchip Cc: Joerg Roedel, iommu On 03/06/16 16:21, Russell King wrote: > Convert DT component matching to use component_match_add_release(). > > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com> > --- > drivers/iommu/mtk_iommu.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c > index c3043d8754e3..71cf62af4e24 100644 > --- a/drivers/iommu/mtk_iommu.c > +++ b/drivers/iommu/mtk_iommu.c > @@ -24,6 +24,7 @@ > #include <linux/iopoll.h> > #include <linux/list.h> > #include <linux/of_address.h> > +#include <linux/of_component.h> > #include <linux/of_iommu.h> > #include <linux/of_irq.h> > #include <linux/of_platform.h> > @@ -552,11 +553,6 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data) > return 0; > } > > -static int compare_of(struct device *dev, void *data) > -{ > - return dev->of_node == data; > -} > - > static int mtk_iommu_bind(struct device *dev) > { > struct mtk_iommu_data *data = dev_get_drvdata(dev); > @@ -630,17 +626,19 @@ static int mtk_iommu_probe(struct platform_device *pdev) > continue; > > plarbdev = of_find_device_by_node(larbnode); > - of_node_put(larbnode); > if (!plarbdev) { > plarbdev = of_platform_device_create( > larbnode, NULL, > platform_bus_type.dev_root); > - if (!plarbdev) > + if (!plarbdev) { > + of_node_put(larbnode); > return -EPROBE_DEFER; > + } > } > data->smi_imu.larb_imu[i].dev = &plarbdev->dev; > > - component_match_add(dev, &match, compare_of, larbnode); > + component_match_add_of(dev, &match, larbnode); > + of_node_put(larbnode); > } > > platform_set_drvdata(pdev, data); > ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v2 3/3] iommu: convert DT component matching to component_match_add_release() 2016-06-03 14:21 ` [PATCH v2 3/3] iommu: " Russell King 2016-06-03 15:20 ` Matthias Brugger @ 2016-06-15 13:31 ` Joerg Roedel 1 sibling, 0 replies; 20+ messages in thread From: Joerg Roedel @ 2016-06-15 13:31 UTC (permalink / raw) To: Russell King Cc: devicetree, dri-devel, linux-arm-kernel, linux-arm-msm, linux-mediatek, linux-rockchip, Matthias Brugger, iommu On Fri, Jun 03, 2016 at 03:21:30PM +0100, Russell King wrote: > Convert DT component matching to use component_match_add_release(). > > Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> > --- > drivers/iommu/mtk_iommu.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) Applied, thanks. ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2016-06-15 13:33 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-03  7:58 [PATCH] drm: convert DT component matching to component_match_add_release() Russell King
2016-06-03  9:40 ` Liviu Dudau
2016-06-03 10:36   ` Russell King - ARM Linux
2016-06-03 11:19     ` Liviu Dudau
2016-06-03 11:48       ` Russell King - ARM Linux
2016-06-03 10:56 ` Robin Murphy
2016-06-03 14:15   ` Russell King - ARM Linux
2016-06-03 14:21     ` [PATCH v2 1/3] of: add common OF-based component functionality Russell King
     [not found]       ` <E1b8pyR-0005OJ-V3-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org>
2016-06-03 15:29         ` Rob Herring
2016-06-03 15:36           ` Russell King - ARM Linux
2016-06-03 19:52             ` Rob Herring
2016-06-03 15:44         ` Thierry Reding
2016-06-03 16:11           ` Russell King - ARM Linux
2016-06-03 14:21     ` [PATCH v2 2/3] drm: convert DT component matching to component_match_add_release() Russell King
2016-06-03 15:10       ` Lucas Stach
     [not found]       ` <E1b8pyX-0005OP-2s-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org>
2016-06-07 13:39         ` Liviu Dudau
2016-06-07 14:26         ` Vincent ABRIOU
2016-06-03 14:21     ` [PATCH v2 3/3] iommu: " Russell King
2016-06-03 15:20       ` Matthias Brugger
2016-06-15 13:31       ` Joerg Roedel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).