[U-Boot] [PATCH v2 1/1] core/uclass: iterate over all devices of a uclass
Heinrich Schuchardt
xypron.glpk at gmx.de
Wed Apr 19 15:55:47 UTC 2017
On 04/19/2017 04:28 PM, Simon Glass wrote:
> Hi Heinrich,
>
> On 19 April 2017 at 05:26, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>> When iterating over the devices of an uclass the iteration stops
>> at the first device that cannot be probed.
>> When calling booefi this will result in no block device being
>> passed to the EFI executable if the first device cannot be probed.
>>
>> The problem was reported by Andreas Färber in
>> https://lists.denx.de/pipermail/u-boot/2017-April/287432.html
>>
>> For testing I used an odroid-c2 with a dts including
>> &sd_emmc_a {
>> status = "okay";
>> }
>> This device does not exist on the board and cannot be initialized.
>>
>> With the patch uclass_first_device and uclass_next_device
>> iterate internally until they find the first device that can be
>> probed or the end of the device list is reached.
>
> I would like to avoid changing the API that much. Can you please
> change it to stop calling the tail function and always set the device,
> like you did in v1?
Hello Simon,
with the patch nothing changes if the the available devices an
contiguous starting at index 0.
Not calling the tail function would really change the API function in
all cases. So why would we want to do so?
The current behavior is to stop at the first device that cannot be
probed. Which use of uclass_first_device/uclass_next_device do you see
in the U-Boot code that would benefit from this?
>
> Also don't forget to add a test for this bahaviour. You may need to
> have sandbox device that returns an error when probing. Perhaps add
> another compatible string to denx,u-boot-fdt-test?
I will give it a try.
Best regards
Heinrich
>
>>
>> Debug output is provided for the two functions.
>>
>> Reported-by: Andreas Färber <afaerber at suse.de>
>> Cc: Simon Glass <sjg at chromium.org>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>> ---
>> v2:
>> As suggested by Simon Glass correct uclass_first_device() and
>> uclass_next_device() instead of uclass_get_device_tail() to
>> avoid side effects.
>> v1:
>> The original patch was posted as
>> core/uclass: uclass_get_device_tail: always set devp
>> https://lists.denx.de/pipermail/u-boot/2017-April/288068.html
>> ---
>> drivers/core/uclass.c | 44 +++++++++++++++++++++++++++++++++-----------
>> 1 file changed, 33 insertions(+), 11 deletions(-)
>>
>
> Regards,
> Simon
>
More information about the U-Boot
mailing list