diff options
-rw-r--r-- | drivers/usb/core/usb.c | 10 | ||||
-rw-r--r-- | include/linux/usb.h | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 020b58528d90..f026991d0bdf 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -375,18 +375,24 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent, | |||
375 | */ | 375 | */ |
376 | if (unlikely(!parent)) { | 376 | if (unlikely(!parent)) { |
377 | dev->devpath[0] = '0'; | 377 | dev->devpath[0] = '0'; |
378 | dev->route = 0; | ||
378 | 379 | ||
379 | dev->dev.parent = bus->controller; | 380 | dev->dev.parent = bus->controller; |
380 | dev_set_name(&dev->dev, "usb%d", bus->busnum); | 381 | dev_set_name(&dev->dev, "usb%d", bus->busnum); |
381 | root_hub = 1; | 382 | root_hub = 1; |
382 | } else { | 383 | } else { |
383 | /* match any labeling on the hubs; it's one-based */ | 384 | /* match any labeling on the hubs; it's one-based */ |
384 | if (parent->devpath[0] == '0') | 385 | if (parent->devpath[0] == '0') { |
385 | snprintf(dev->devpath, sizeof dev->devpath, | 386 | snprintf(dev->devpath, sizeof dev->devpath, |
386 | "%d", port1); | 387 | "%d", port1); |
387 | else | 388 | /* Root ports are not counted in route string */ |
389 | dev->route = 0; | ||
390 | } else { | ||
388 | snprintf(dev->devpath, sizeof dev->devpath, | 391 | snprintf(dev->devpath, sizeof dev->devpath, |
389 | "%s.%d", parent->devpath, port1); | 392 | "%s.%d", parent->devpath, port1); |
393 | dev->route = parent->route + | ||
394 | (port1 << ((parent->level - 1)*4)); | ||
395 | } | ||
390 | 396 | ||
391 | dev->dev.parent = &parent->dev; | 397 | dev->dev.parent = &parent->dev; |
392 | dev_set_name(&dev->dev, "%d-%s", bus->busnum, dev->devpath); | 398 | dev_set_name(&dev->dev, "%d-%s", bus->busnum, dev->devpath); |
diff --git a/include/linux/usb.h b/include/linux/usb.h index fb1f2a32ae05..2b380a16c62f 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -362,6 +362,7 @@ struct usb_tt; | |||
362 | * struct usb_device - kernel's representation of a USB device | 362 | * struct usb_device - kernel's representation of a USB device |
363 | * @devnum: device number; address on a USB bus | 363 | * @devnum: device number; address on a USB bus |
364 | * @devpath: device ID string for use in messages (e.g., /port/...) | 364 | * @devpath: device ID string for use in messages (e.g., /port/...) |
365 | * @route: tree topology hex string for use with xHCI | ||
365 | * @state: device state: configured, not attached, etc. | 366 | * @state: device state: configured, not attached, etc. |
366 | * @speed: device speed: high/full/low (or error) | 367 | * @speed: device speed: high/full/low (or error) |
367 | * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub | 368 | * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub |
@@ -427,6 +428,7 @@ struct usb_tt; | |||
427 | struct usb_device { | 428 | struct usb_device { |
428 | int devnum; | 429 | int devnum; |
429 | char devpath [16]; | 430 | char devpath [16]; |
431 | u32 route; | ||
430 | enum usb_device_state state; | 432 | enum usb_device_state state; |
431 | enum usb_device_speed speed; | 433 | enum usb_device_speed speed; |
432 | 434 | ||