summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-03-02 10:12:57 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-03-20 10:07:16 +0100
commit01ded7403eded4e3732ad2360f6fe6a9373cb927 (patch)
tree7e1489b53c57ca3625e0dbe59d0e241f4d628de8
parent454a7670ee3872847bcfe2713138c484104ba71b (diff)
downloadbarebox-01ded7403eded4e3732ad2360f6fe6a9373cb927.tar.gz
usb: Set new USB device name earlier
in usb_new_device() set the device name as early as possible to let dev_* functions print a meaningful name. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/usb/core/usb.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 8a144c9..e1ff443 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -316,6 +316,14 @@ int usb_new_device(struct usb_device *dev)
struct usb_device *parent = dev->parent;
char str[16];
+ if (parent)
+ dev_set_name(&dev->dev, "%s-%d", parent->dev.name,
+ dev->portnr - 1);
+ else
+ dev_set_name(&dev->dev, "usb%d", dev->host->busnum);
+
+ dev->dev.id = DEVICE_ID_SINGLE;
+
buf = dma_alloc(USB_BUFSIZ);
/* We still haven't set the Address yet */
@@ -424,15 +432,6 @@ int usb_new_device(struct usb_device *dev)
usb_string(dev, dev->descriptor->iSerialNumber,
dev->serial, sizeof(dev->serial));
- if (parent) {
- dev_set_name(&dev->dev, "%s-%d", parent->dev.name,
- dev->portnr - 1);
- } else {
- dev_set_name(&dev->dev, "usb%d", dev->host->busnum);
- }
-
- dev->dev.id = DEVICE_ID_SINGLE;
-
print_usb_device(dev);
err = register_device(&dev->dev);