[PATCH 08/24] usb: Set new USB device name earlier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 drivers/usb/core/usb.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 8a144c9447..e1ff443d29 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);
-- 
2.26.0.rc2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux