UPSTREAM: dm: blk: Use uclass_find_first/next_device() in blk_first/next_device()
This patch changes the calls to uclass_first/next_device() in blk_first/ next_device() to use uclass_find_first/next_device() instead. These functions don't prepare the devices, which is correct in this case. With this patch applied, the "usb storage" command now works again as expected: => usb storage Device 0: Vendor: SanDisk Rev: 1.00 Prod: Ultra Type: Removable Hard Disk Capacity: 58656.0 MB = 57.2 GB (120127488 x 512) Without this patch, it used to generate this buggy output: => usb storage Card did not respond to voltage select! mmc_init: -95, time 26 No storage devices, perhaps not 'usb start'ed..? Change-Id: I5a037217a568d9e4eedb089bce5a283eadff1310 Signed-off-by: Stefan Roese <sr@denx.de> Suggested-by: Simon Glass <sjg@chromium.org> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> (cherry picked from commit 8a5cbc065dfe1f258e3a7be823ea128184b90b5b)
This commit is contained in:
parent
29b6917330
commit
6a2ff3f44f
|
|
@ -10,6 +10,7 @@
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <dm/device-internal.h>
|
#include <dm/device-internal.h>
|
||||||
#include <dm/lists.h>
|
#include <dm/lists.h>
|
||||||
|
#include <dm/uclass-internal.h>
|
||||||
|
|
||||||
static const char *if_typename_str[IF_TYPE_COUNT] = {
|
static const char *if_typename_str[IF_TYPE_COUNT] = {
|
||||||
[IF_TYPE_IDE] = "ide",
|
[IF_TYPE_IDE] = "ide",
|
||||||
|
|
@ -333,7 +334,7 @@ int blk_first_device(int if_type, struct udevice **devp)
|
||||||
struct blk_desc *desc;
|
struct blk_desc *desc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = uclass_first_device(UCLASS_BLK, devp);
|
ret = uclass_find_first_device(UCLASS_BLK, devp);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
if (!*devp)
|
if (!*devp)
|
||||||
|
|
@ -342,7 +343,7 @@ int blk_first_device(int if_type, struct udevice **devp)
|
||||||
desc = dev_get_uclass_platdata(*devp);
|
desc = dev_get_uclass_platdata(*devp);
|
||||||
if (desc->if_type == if_type)
|
if (desc->if_type == if_type)
|
||||||
return 0;
|
return 0;
|
||||||
ret = uclass_next_device(devp);
|
ret = uclass_find_next_device(devp);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
} while (*devp);
|
} while (*devp);
|
||||||
|
|
@ -358,7 +359,7 @@ int blk_next_device(struct udevice **devp)
|
||||||
desc = dev_get_uclass_platdata(*devp);
|
desc = dev_get_uclass_platdata(*devp);
|
||||||
if_type = desc->if_type;
|
if_type = desc->if_type;
|
||||||
do {
|
do {
|
||||||
ret = uclass_next_device(devp);
|
ret = uclass_find_next_device(devp);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
if (!*devp)
|
if (!*devp)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue