[PATCH 1/4] usb: rename USB devices to reflect bus structure
Sascha Hauer
s.hauer at pengutronix.de
Thu Jun 20 10:05:22 EDT 2013
This renames the USB devices to reflect the bus structure.
The base name for a USB device is usb<devno>. For each child
device we add a -<parent-port-no>. This makes it more easy
to identify devices.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/usb/core/usb.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 9a0723a..e232111 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -431,14 +431,22 @@ static int usb_new_device(struct usb_device *dev)
if (dev->descriptor->iSerialNumber)
usb_string(dev, dev->descriptor->iSerialNumber,
dev->serial, sizeof(dev->serial));
+
+ if (parent) {
+ sprintf(dev->dev.name, "%s-%d", parent->dev.name, port);
+ } else {
+ sprintf(dev->dev.name, "usb%d", dev->host->busnum);
+ }
+
+ dev->dev.id = DEVICE_ID_SINGLE;
+
+ register_device(&dev->dev);
+
/* now prode if the device is a hub */
usb_hub_probe(dev, 0);
- sprintf(dev->dev.name, "usb%d-%d", dev->host->busnum, dev->devnum);
-
print_usb_device(dev);
- register_device(&dev->dev);
dev_add_param_int_ro(&dev->dev, "iManufacturer",
dev->descriptor->iManufacturer, "%d");
dev_add_param_int_ro(&dev->dev, "iProduct",
--
1.8.3.1
More information about the barebox
mailing list