]> git.karo-electronics.de Git - karo-tx-uboot.git/commit
dm: usb: Fix "usb tree" output
authorHans de Goede <hdegoede@redhat.com>
Wed, 17 Jun 2015 19:33:50 +0000 (21:33 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 9 Sep 2015 11:48:56 +0000 (13:48 +0200)
commit3a672cc9af7766af9a3305caf7259febc8b0de38
treed02789f1e6bdb755f331b1d5cbaa73da786db521
parentd1dcd1664597b4efacc284ba23afcefbc0b12aa3
dm: usb: Fix "usb tree" output

last_child was abused by the old usb code to first store 1 if the
usb_device was not the root of the usb tree, and then later on re-used
to store whether or not the usb_device is actually the last child.

The dm-usb code was always setting it to actually reflect the last-child
status which is wrong for the last child leading to output like this:

USB device tree:
  1  Hub (12 Mb/s, 100mA)
  |  ALCOR USB Hub 2.0
  |
  | 2  Mass Storage (12 Mb/s, 100mA)
  |    USB Flash Disk 4C0E960F
  |
  +-3  Human Interface (1.5 Mb/s, 100mA)
       SINO WEALTH USB Composite Device

Instead of this:

USB device tree:
  1  Hub (12 Mb/s, 100mA)
  |  ALCOR USB Hub 2.0
  |
  +-2  Mass Storage (12 Mb/s, 100mA)
  |    USB Flash Disk 4C0E960F
  |
  +-3  Human Interface (1.5 Mb/s, 100mA)
       SINO WEALTH USB Composite Device

This commit fixes this by first checking that the device is not root,
and then setting last_child. This commit also updates the old code to not
abuse the last_child variable to store the root check result.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
common/cmd_usb.c