From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/4] usb: rename USB devices to reflect bus structure
Date: Thu, 20 Jun 2013 16:05:22 +0200 [thread overview]
Message-ID: <1371737125-18820-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1371737125-18820-1-git-send-email-s.hauer@pengutronix.de>
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@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
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-06-20 14:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-20 14:05 [PATCH] usb: implement detect callback Sascha Hauer
2013-06-20 14:05 ` Sascha Hauer [this message]
2013-06-20 14:05 ` [PATCH 2/4] usb: move scanned status into core Sascha Hauer
2013-06-20 14:05 ` [PATCH 3/4] usb: implement a usb_host_detect to scan individual USB hosts Sascha Hauer
2013-06-20 14:05 ` [PATCH 4/4] usb: ehci: implement detect callback Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1371737125-18820-2-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox