diff options
author | Michal Suchanek <msuchanek@suse.de> | 2022-09-27 23:23:53 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2022-11-07 16:24:30 -0700 |
commit | 168a0e45fcf49194fca55795f84a844f16b480f6 (patch) | |
tree | 703dfe2a0ebb2eacb241c19b99c96665a2d66811 /drivers/block | |
parent | 499503e1578fe385e820170af78525ea2f799a4c (diff) | |
download | u-boot-168a0e45fcf49194fca55795f84a844f16b480f6.zip u-boot-168a0e45fcf49194fca55795f84a844f16b480f6.tar.gz u-boot-168a0e45fcf49194fca55795f84a844f16b480f6.tar.bz2 |
dm: blk: Add probe in blk_first_device/blk_next_device
The description claims that the device is probed but it isn't.
Add the device_probe() call.
Also consolidate the iteration into one function.
Fixes: 8a5cbc065d ("dm: blk: Use uclass_find_first/next_device() in blk_first/next_device()")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/blk-uclass.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index bd46bfb..c69fc4d 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -369,45 +369,43 @@ int blk_dselect_hwpart(struct blk_desc *desc, int hwpart) return blk_select_hwpart(desc->bdev, hwpart); } -int blk_first_device(int uclass_id, struct udevice **devp) +static int _blk_next_device(int uclass_id, struct udevice **devp) { struct blk_desc *desc; - int ret; + int ret = 0; + + for (; *devp; uclass_find_next_device(devp)) { + desc = dev_get_uclass_plat(*devp); + if (desc->uclass_id == uclass_id) { + ret = device_probe(*devp); + if (!ret) + return 0; + } + } - ret = uclass_find_first_device(UCLASS_BLK, devp); if (ret) return ret; - if (!*devp) - return -ENODEV; - do { - desc = dev_get_uclass_plat(*devp); - if (desc->uclass_id == uclass_id) - return 0; - ret = uclass_find_next_device(devp); - if (ret) - return ret; - } while (*devp); return -ENODEV; } +int blk_first_device(int uclass_id, struct udevice **devp) +{ + uclass_find_first_device(UCLASS_BLK, devp); + + return _blk_next_device(uclass_id, devp); +} + int blk_next_device(struct udevice **devp) { struct blk_desc *desc; - int ret, uclass_id; + int uclass_id; desc = dev_get_uclass_plat(*devp); uclass_id = desc->uclass_id; - do { - ret = uclass_find_next_device(devp); - if (ret) - return ret; - if (!*devp) - return -ENODEV; - desc = dev_get_uclass_plat(*devp); - if (desc->uclass_id == uclass_id) - return 0; - } while (1); + uclass_find_next_device(devp); + + return _blk_next_device(uclass_id, devp); } int blk_find_device(int uclass_id, int devnum, struct udevice **devp) |