diff options
author | Simon Glass <sjg@chromium.org> | 2023-01-17 10:47:44 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-01-23 18:11:40 -0500 |
commit | 6febc264711cbebcd91cb06c2d1bf0b181178fcc (patch) | |
tree | c57e84cf775858ea2e0382e4d590684a2b041bfd /drivers/scsi | |
parent | ca93d281717acb121960b50e6e9d7eebab3d950d (diff) | |
download | u-boot-6febc264711cbebcd91cb06c2d1bf0b181178fcc.tar.gz |
scsi: Remove all children of SCSI devices before rescanning
At present this only unbinds block devices of a certain type. But SCSI
device can have different types of children, including bootdevs.
Unbind all children so tht everything is clean and ready for a new scan.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index f7add08db8..4a2d8d009a 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -644,12 +644,23 @@ int scsi_scan(bool verbose) if (verbose) printf("scanning bus for devices...\n"); - blk_unbind_all(UCLASS_SCSI); - ret = uclass_get(UCLASS_SCSI, &uc); if (ret) return ret; + /* remove all children of the SCSI devices */ + uclass_foreach_dev(dev, uc) { + log_debug("unbind %s\n", dev->name); + ret = device_chld_remove(dev, NULL, DM_REMOVE_NORMAL); + if (!ret) + ret = device_chld_unbind(dev, NULL); + if (ret) { + if (verbose) + printf("unable to unbind devices (%dE)\n", ret); + return log_msg_ret("unb", ret); + } + } + uclass_foreach_dev(dev, uc) { ret = scsi_scan_dev(dev, verbose); if (ret) |