Skip to contentSkip to conversation

dm: blk: Use uclass_find_first/next_device() in blk_first/next_device()

PATCH New Stefan Roese 4 participants 4 messages Nov 29, 2017 – Dec 8, 2017 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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..?

---
 drivers/block/blk-uclass.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/block/blk-uclass.c +4 -3
index 537cf5f0bb..010ed32d3a 100644
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
+#include <dm/uclass-internal.h>
 
 static const char *if_typename_str[IF_TYPE_COUNT] = {
 	[IF_TYPE_IDE]		= "ide",
@@ -331,7 +332,7 @@ int blk_first_device(int if_type, struct udevice **devp)
 	struct blk_desc *desc;
 	int ret;
 
-	ret = uclass_first_device(UCLASS_BLK, devp);
+	ret = uclass_find_first_device(UCLASS_BLK, devp);
 	if (ret)
 		return ret;
 	if (!*devp)
@@ -340,7 +341,7 @@ int blk_first_device(int if_type, struct udevice **devp)
 		desc = dev_get_uclass_platdata(*devp);
 		if (desc->if_type == if_type)
 			return 0;
-		ret = uclass_next_device(devp);
+		ret = uclass_find_next_device(devp);
 		if (ret)
 			return ret;
 	} while (*devp);
@@ -356,7 +357,7 @@ int blk_next_device(struct udevice **devp)
 	desc = dev_get_uclass_platdata(*devp);
 	if_type = desc->if_type;
 	do {
-		ret = uclass_next_device(devp);
+		ret = uclass_find_next_device(devp);
 		if (ret)
 			return ret;
 		if (!*devp)
Signature · 1 line
2.15.1
#1 lore raw

PATCH 1/1 dm: blk: Use uclass_find_first/next_device() in blk_first/next_device()

Quoted 19 lines · Stefan Roese

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..?

Quoted 8 lines
---
 drivers/block/blk-uclass.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
#2 lore raw

PATCH 1/1 dm: blk: Use uclass_find_first/next_device() in blk_first/next_device()

In reply to Stefan Roese
Quoted 19 lines · Stefan Roese

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..?

Quoted 7 lines
---
 drivers/block/blk-uclass.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
#3 lore raw

PATCH 1/1 dm: blk: Use uclass_find_first/next_device() in blk_first/next_device()

Quoted 19 lines · Stefan Roese

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..?

Quoted 7 lines
---
 drivers/block/blk-uclass.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Applied to u-boot-dm thanks!