[U-Boot] [PATCH v2 1/1] core/uclass: iterate over all devices of a uclass

Heinrich Schuchardt
2017-04-23T03:44:59Z

On 04/23/2017 04:10 AM, Simon Glass wrote:
> Hi Heinrick,
>
> On 19 April 2017 at 05:26, Heinrich Schuchardt <xypron.glpk@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.
>
> I just re-read this thread and saw this point again.
>
> If this is not on the board, shouldn't the device have "disabled" in its node?
>

I wanted to reproduce the probkem Andreas had with his board.

In the U-Boot repository this device is disabled.

Best regards

Heinrich Schuchardt

>>
>> 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.
>>
>> Debug output is provided for the two functions.
>>
>> Reported-by: Andreas Färber <afaerber@suse.de>
>> Cc: Simon Glass <sjg@chromium.org>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@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
>