summaryrefslogtreecommitdiff
path: root/cmd/usb.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2016-04-03 00:04:39 +0200
committerMarek Vasut <marex@denx.de>2016-04-10 17:18:43 +0200
commit192eab9357473e09218e0a4448b220d691d9d886 (patch)
tree07094d5df3b66ca8e9902d807c77759f667b04b1 /cmd/usb.c
parentbf313230642ca6ce1e5cb67d49f6cc72a6d752ae (diff)
dm: usb: Do not reprobe usb hosts on "usb tree" command
Some usb hosts may have failed to probe on "usb start", i.e. an otg host without an otg-host cable plugged in. "usb tree" would cause the probe method of these hosts to get called again, something which should only happen on "usb reset". This commit fixes this. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'cmd/usb.c')
-rw-r--r--cmd/usb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/usb.c b/cmd/usb.c
index 97dd6f0099d..f1a7debdf3d 100644
--- a/cmd/usb.c
+++ b/cmd/usb.c
@@ -15,6 +15,7 @@
#include <command.h>
#include <console.h>
#include <dm.h>
+#include <dm/uclass-internal.h>
#include <memalign.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
@@ -442,12 +443,15 @@ void usb_show_tree(void)
#ifdef CONFIG_DM_USB
struct udevice *bus;
- for (uclass_first_device(UCLASS_USB, &bus);
+ for (uclass_find_first_device(UCLASS_USB, &bus);
bus;
- uclass_next_device(&bus)) {
+ uclass_find_next_device(&bus)) {
struct usb_device *udev;
struct udevice *dev;
+ if (!device_active(bus))
+ continue;
+
device_find_first_child(bus, &dev);
if (dev && device_active(dev)) {
udev = dev_get_parent_priv(dev);