drm: convert DT component matching to component_match_add_release()
Subsystems (16)
PATCH 1/1 drm: convert DT component matching to component_match_add_release()
Convert DT component matching to use component_match_add_release().
--- 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(-)
drivers/gpu/drm/arm/hdlcd_drv.c +8 -2
@@ -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);
drivers/gpu/drm/armada/armada_drv.c +7 -2
@@ -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); } }
drivers/gpu/drm/drm_of.c +9 -4
@@ -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); }
drivers/gpu/drm/msm/msm_drv.c +7 -1
@@ -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 ;
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +10 -3
@@ -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); }
drivers/gpu/drm/sti/sti_drv.c +7 -2
@@ -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); }
drivers/gpu/drm/tilcdc/tilcdc_external.c +7 -2
@@ -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++; }
Signature · 1 line
2.1.0
Quoted 1 line · Russell King
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?
Quoted 2 lines
Signed-off-by Russell King <[email protected]>
Looks good to me!
For the HDLCD part:
Thanks,
Liviu
Quoted 234 lines
--- 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(-)drivers/gpu/drm/arm/hdlcd_drv.c +8
-2@@ -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);drivers/gpu/drm/armada/armada_drv.c +7
-2@@ -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); } }drivers/gpu/drm/drm_of.c +9
-4@@ -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); }drivers/gpu/drm/msm/msm_drv.c +7
-1@@ -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 ;drivers/gpu/drm/rockchip/rockchip_drm_drv.c +10
-3@@ -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); }drivers/gpu/drm/sti/sti_drv.c +7
-2@@ -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); }drivers/gpu/drm/tilcdc/tilcdc_external.c +7
-2@@ -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++; }Signature · 7 lines
2.1.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 12 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-develRussell King - ARM Linux
maintainerQuoted 6 lines · Liviu Dudau
Quoted 1 line · Russell King
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.
Quoted 1 line
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.
Signature · 3 lines
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.
Liviu Dudau
maintainerQuoted 9 lines · Russell King - ARM Linux
Quoted 6 lines · Liviu Dudau
Quoted 1 line · Russell King
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?
Quoted 10 lines
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.Quoted 1 line
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
Quoted 6 lines
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
Quoted 6 lines
Signature · 4 lines
-- 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.
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯Russell King - ARM Linux
maintainerQuoted 9 lines · Liviu Dudau
Quoted 8 lines · Russell King - ARM Linux
Quoted 6 lines · Liviu Dudau
Quoted 1 line · Russell King
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?
Quoted 8 lines
Quoted 1 line
Sorry, I don't understand your comment.
As in:
component_match_add()already exists as a macro that callscomponent_match_add_release(), but with a NULL release function. If it were to be changed to pass a defaultrelease_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.
Signature · 3 lines
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.
Robin Murphy
reviewerHi Russell,
Quoted 21 lines · Russell King
Convert DT component matching to use
component_match_add_release().Signed-off-by Russell King <[email protected]>--- 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(-)drivers/gpu/drm/arm/hdlcd_drv.c +0
-0@@ -443,11 +443,16 @@ static const struct component_master_ops hdlcd_master_ops = { .unbind = hdlcd_drm_unbind, };
drivers/gpu/drm/arm/hdlcd_drv.c static const struct component_master_ops hdlcd_master_ops = { · line 454
Quoted 10 lines
drivers/gpu/drm/arm/hdlcd_drv.c +5
-1-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.
Quoted 198 lines
drivers/gpu/drm/arm/hdlcd_drv.c +3
-1+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);drivers/gpu/drm/armada/armada_drv.c +7
-2@@ -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); } }drivers/gpu/drm/drm_of.c +9
-4@@ -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); }drivers/gpu/drm/msm/msm_drv.c +7
-1@@ -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 ;drivers/gpu/drm/rockchip/rockchip_drm_drv.c +10
-3@@ -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); }drivers/gpu/drm/sti/sti_drv.c +7
-2@@ -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); }drivers/gpu/drm/tilcdc/tilcdc_external.c +7
-2@@ -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++; }
Russell King - ARM Linux
maintainerQuoted 40 lines · Robin Murphy
Hi Russell,
Quoted 21 lines · Russell King
Convert DT component matching to use
component_match_add_release().Signed-off-by Russell King <[email protected]>--- 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(-)drivers/gpu/drm/arm/hdlcd_drv.c +0
-0@@ -443,11 +443,16 @@ static const struct component_master_ops hdlcd_master_ops = { .unbind = hdlcd_drm_unbind, };drivers/gpu/drm/arm/hdlcd_drv.c static const struct component_master_ops hdlcd_master_ops = { · line 454
Quoted 10 lines
drivers/gpu/drm/arm/hdlcd_drv.c +5
-1-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_unuseddefault_release_of()incomponent.hordrm_of.h(and maybedefault_compare_of()similarly)?
Quoted 2 lines
(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.
Signature · 3 lines
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.
PATCH v2 1/3 of: add common OF-based component functionality
Add common OF-based component functionality for matching devices by device node, and releasing the device node at the appropraite time.
--- 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
drivers/of/Makefile +1 -1
@@ -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
drivers/of/of_component.c new file +41 -0
41 lines not on this page · raw message
include/linux/of_component.h new file +14 -0
@@ -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
Signature · 1 line
2.1.0
A message that is not in the archive (sent off-list or not yet received): E1b8pyR-0005OJ-V3-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org
Re: [PATCH v2 1/3] of: add common OF-based component functionality
Quoted 8 lines · Russell King
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 <[email protected]>--- 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Russell King - ARM Linux
maintainerRe: [PATCH v2 1/3] of: add common OF-based component functionality
Quoted 4 lines · Rob Herring
Quoted 3 lines · Russell King
Add common OF-based component functionality for matching devices by device node, and releasing the device node at the appropraite time.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Russell King <[email protected]>--- 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.
Quoted 2 lines
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.
Signature · 3 lines
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.
Re: [PATCH v2 1/3] of: add common OF-based component functionality
Quoted 11 lines · Russell King - ARM Linux
Quoted 10 lines · Rob Herring
Quoted 8 lines · Russell King
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 <[email protected]>--- drivers/of/Makefile | 2 +- drivers/of/of_component.c | 41 +++++++++++++++++++++++++++++++++++++++++ include/linux/of_component.h | 14 ++++++++++++++
Quoted 5 lines
Quoted 2 lines
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...
Quoted 4 lines
Quoted 2 lines
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
Re: [PATCH v2 1/3] of: add common OF-based component functionality
In reply to a message not in the archiveOn Fri, Jun 03, 2016 at 03:21:19PM +0100, Russell King wrote:
[...]
Quoted 1 line
drivers/of/of_component.c +0
-0
[...]
drivers/of/of_component.c line 32
Quoted 4 lines
drivers/of/of_component.c +4
-0+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
Russell King - ARM Linux
maintainerRe: [PATCH v2 1/3] of: add common OF-based component functionality
Quoted 11 lines · Thierry Reding
On Fri, Jun 03, 2016 at 03:21:19PM +0100, Russell King wrote:
[...]Quoted 1 line
drivers/of/of_component.c +0
-0[...]
drivers/of/of_component.c line 32
Quoted 4 lines
drivers/of/of_component.c +4
-0+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.
Signature · 3 lines
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.
PATCH v2 2/3 drm: convert DT component matching to component_match_add_release()
In reply to Russell King - ARM LinuxConvert DT component matching to use component_match_add_release().
--- 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(-)
drivers/gpu/drm/arm/hdlcd_drv.c +3 -6
@@ -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);
drivers/gpu/drm/armada/armada_drv.c +2 -6
@@ -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); } }
drivers/gpu/drm/drm_of.c +4 -2
@@ -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);
drivers/gpu/drm/etnaviv/etnaviv_drv.c +2 -9
@@ -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) {
drivers/gpu/drm/msm/msm_drv.c +2 -6
@@ -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 ;
drivers/gpu/drm/msm/msm_drv.h +1 -0
@@ -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>
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +3 -9
@@ -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); }
drivers/gpu/drm/sti/sti_drv.c +2 -7
@@ -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); }
drivers/gpu/drm/tilcdc/tilcdc_external.c +2 -6
@@ -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++; }
Signature · 1 line
2.1.0
Am Freitag, den 03.06.2016, 15:21 +0100 schrieb Russell King:
Quoted 8 lines
Convert DT component matching to use
component_match_add_release().Signed-off-by Russell King <[email protected]>--- 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:
A message that is not in the archive (sent off-list or not yet received): E1b8pyX-0005OP-2s-eh5Bv4kxaXIk46pC+1QYvQNdhmdF6hFW@public.gmane.org
Liviu Dudau
Acked-byQuoted 40 lines · Russell King
Convert DT component matching to use
component_match_add_release().Signed-off-by Russell King <[email protected]>--- 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(-)drivers/gpu/drm/arm/hdlcd_drv.c +1
-5@@ -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;
drivers/gpu/drm/arm/hdlcd_drv.c static int hdlcd_probe(struct platform_device *pdev) · line 477
Quoted 9 lines
drivers/gpu/drm/arm/hdlcd_drv.c +2
-1@@ -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:
Quoted 252 lines
drivers/gpu/drm/armada/armada_drv.c +2
-6@@ -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); } }drivers/gpu/drm/drm_of.c +4
-2@@ -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);drivers/gpu/drm/etnaviv/etnaviv_drv.c +2
-9@@ -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) {drivers/gpu/drm/msm/msm_drv.c +2
-6@@ -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 ;drivers/gpu/drm/msm/msm_drv.h +1
-0@@ -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> drivers/gpu/drm/rockchip/rockchip_drm_drv.c +3
-9@@ -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); }drivers/gpu/drm/sti/sti_drv.c +2
-7@@ -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); }drivers/gpu/drm/tilcdc/tilcdc_external.c +2
-6@@ -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++; }Signature · 1 line
2.1.0
Signature · 12 lines
====================
| 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.htmlVincent ABRIOU
Acked-byQuoted 41 lines · Russell King
Convert DT component matching to use
component_match_add_release().Signed-off-by Russell King <[email protected]>--- 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(-)drivers/gpu/drm/sti/sti_drv.c +1
-5@@ -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));
drivers/gpu/drm/sti/sti_drv.c static int sti_platform_probe(struct platform_device *pdev) · line 377
Quoted 9 lines
drivers/gpu/drm/sti/sti_drv.c +1
-2@@ -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.
PATCH v2 3/3 iommu: convert DT component matching to component_match_add_release()
In reply to Russell King - ARM LinuxConvert DT component matching to use component_match_add_release().
--- drivers/iommu/mtk_iommu.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/iommu/mtk_iommu.c +6 -8
@@ -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);
Signature · 1 line
2.1.0
Re: [PATCH v2 3/3] iommu: convert DT component matching to component_match_add_release()
Quoted 3 lines · Russell King
Convert DT component matching to use
component_match_add_release().Signed-off-by Russell King <[email protected]>
Quoted 52 lines
--- drivers/iommu/mtk_iommu.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)drivers/iommu/mtk_iommu.c +6
-8@@ -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);
Re: [PATCH v2 3/3] iommu: convert DT component matching to component_match_add_release()
In reply to Russell KingQuoted 6 lines · Russell King
Convert DT component matching to use
component_match_add_release().Signed-off-by Russell King <[email protected]>--- drivers/iommu/mtk_iommu.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
Applied, thanks.