[PATCH v6 17/20] dm: core: Switch uclass_*_device_err to use uclass_*_device_check

Simon Glass sjg at chromium.org
Mon Oct 17 23:29:09 CEST 2022


The _err variant iterators use the simple iterators without suffix as
basis.

However, there is no user that uclass_next_device_err for iteration,
many users of uclass_first_device_err use it to get the first and
(assumed) only device of an uclass, and a couple that use
uclass_next_device_err to get the device following a known device in the
uclass list.

While there are some truly singleton device classes in which more than
one device cannot exist these are quite rare, and most classes can have
multiple devices even if it is not the case on the SoC's EVB.

In a later patch the simple iterators will be updated to not stop on
error and return next device instead. With this in many cases the code
that expects the first device or an error if it fails to probe may get
the next device instead. Use the _check iterators as the basis of _err
iterators to preserve the old behavior.

Signed-off-by: Michal Suchanek <msuchanek at suse.de>
Reviewed-by: Simon Glass <sjg at chromium.org>
---
v5: - udate documentation
    - fix up a few more cases where device returned on error may cause
      problem
v6: - split the additional changes into separate patches
---
 drivers/core/uclass.c | 28 ++++++++++++++--------------
 include/dm/uclass.h   | 22 +++++++++++-----------
 2 files changed, 25 insertions(+), 25 deletions(-)

Applied to u-boot-dm, thanks!


More information about the U-Boot mailing list