of_path: only handle no driver for device if it is on a bus
PATCH 1/1 of_path: only handle no driver for device if it is on a bus
This fixes a regression in __of_find_path() for flash devices created by the cadence-quadspi driver, which do not have 'dev->driver' set. Such devices do not have 'dev->bus' set either, so we can use that to qualify the existing test.
--- drivers/of/of_path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/of_path.c +1 -1
@@ -66,7 +66,7 @@ static int __of_find_path(struct device_node *node, const char *part, char **outreturn -ENODEV ; } -if (!dev->driver) +if (dev->bus && !dev->driver)return -ENODEV ;device_detect (dev);
Signature · 7 lines
2.11.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 15 lines · Ian Abbott
This fixes a regression in
__of_find_path()for flash devices created by the cadence-quadspi driver, which do not have 'dev->driver' set. Such devices do not have 'dev->bus' set either, so we can use that to qualify the existing test.Signed-off-by Ian Abbott <[email protected]>--- drivers/of/of_path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/of/of_path.c +0
-0
drivers/of/of_path.c static int __of_find_path(struct device_node *node, const char *part, char **out · line 70
Quoted 6 lines
drivers/of/of_path.c +1
-1@@ -66,7 +66,7 @@ static int __of_find_path(struct device_node *node, const char *part, char **outreturn -ENODEV ; } -if (!dev->driver) +if (dev->bus && !dev->driver)return -ENODEV ;
I am not entirely happy with this patch. Let's hope it won't fall on our feet later. Applied for now, let's see.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 19 lines · Sascha Hauer
Quoted 18 lines · Ian Abbott
This fixes a regression in
__of_find_path()for flash devices created by the cadence-quadspi driver, which do not have 'dev->driver' set. Such devices do not have 'dev->bus' set either, so we can use that to qualify the existing test.Signed-off-by Ian Abbott <[email protected]>--- drivers/of/of_path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/of/of_path.c +0
-0@@ -66,7 +66,7 @@ static int __of_find_path(struct device_node *node, const char *part, char **outreturn -ENODEV ; }
Quoted 6 lines
drivers/of/of_path.c static int __of_find_path(struct device_node *node, const char *part, char **out · line 70
Quoted 3 lines
drivers/of/of_path.c +1
-1-if (!dev->driver) +if (dev->bus && !dev->driver)return -ENODEV ;I am not entirely happy with this patch. Let's hope it won't fall on our feet later. Applied for now, let's see.
Thanks! A slightly more robust test, that would still allow drivers to control their own bus-less child devices, would be to find the device or its nearest ancestor that exists and has ->bus set or ->driver set, and that check it has->driver set. That's awkward to explain in English (or German!), so:
struct device_d *bdev; /* ... assuming dev exists ... */ for (bdev = dev; bdev->parent && !bdev->bus && !bdev->driver; bdev = bdev->parent) ; if (!bdev->driver) return -ENODEV; /* or perhaps -EPROBE_DEFER */
Perhaps that's overkill!
Signature · 7 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Web: http://www.mev.co.uk/ )=- _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox