mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] of_path: only handle no driver for device if it is on a bus
@ 2017-01-12 12:20 Ian Abbott
  2017-01-13  7:37 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Abbott @ 2017-01-12 12:20 UTC (permalink / raw)
  To: barebox; +Cc: 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 <abbotti@mev.co.uk>
---
 drivers/of/of_path.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
index 946b9c7aa..e0b2dc124 100644
--- a/drivers/of/of_path.c
+++ b/drivers/of/of_path.c
@@ -66,7 +66,7 @@ static int __of_find_path(struct device_node *node, const char *part, char **out
 			return -ENODEV;
 	}
 
-	if (!dev->driver)
+	if (dev->bus && !dev->driver)
 		return -ENODEV;
 
 	device_detect(dev);
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] of_path: only handle no driver for device if it is on a bus
  2017-01-12 12:20 [PATCH] of_path: only handle no driver for device if it is on a bus Ian Abbott
@ 2017-01-13  7:37 ` Sascha Hauer
  2017-01-13 11:13   ` Ian Abbott
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2017-01-13  7:37 UTC (permalink / raw)
  To: Ian Abbott; +Cc: barebox

On Thu, Jan 12, 2017 at 12:20:05PM +0000, Ian Abbott wrote:
> 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 <abbotti@mev.co.uk>
> ---
>  drivers/of/of_path.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
> index 946b9c7aa..e0b2dc124 100644
> --- a/drivers/of/of_path.c
> +++ b/drivers/of/of_path.c
> @@ -66,7 +66,7 @@ static int __of_find_path(struct device_node *node, const char *part, char **out
>  			return -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


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] of_path: only handle no driver for device if it is on a bus
  2017-01-13  7:37 ` Sascha Hauer
@ 2017-01-13 11:13   ` Ian Abbott
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Abbott @ 2017-01-13 11:13 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 13/01/17 07:37, Sascha Hauer wrote:
> On Thu, Jan 12, 2017 at 12:20:05PM +0000, Ian Abbott wrote:
>> 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 <abbotti@mev.co.uk>
>> ---
>>  drivers/of/of_path.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
>> index 946b9c7aa..e0b2dc124 100644
>> --- a/drivers/of/of_path.c
>> +++ b/drivers/of/of_path.c
>> @@ -66,7 +66,7 @@ static int __of_find_path(struct device_node *node, const char *part, char **out
>>  			return -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.

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!

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-13 11:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-12 12:20 [PATCH] of_path: only handle no driver for device if it is on a bus Ian Abbott
2017-01-13  7:37 ` Sascha Hauer
2017-01-13 11:13   ` Ian Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox