summaryrefslogtreecommitdiff
path: root/drivers/usb/core/devices.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2016-01-25 20:30:30 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-03 13:26:30 -0800
commit5363de75307e333d89df7531f9dd8310d973ecdb (patch)
tree5c90ec1dbcf6d1626984ec6306db7d73ee8dd3ab /drivers/usb/core/devices.c
parentd78540419866887345cec480016b0f87f6a5aca2 (diff)
usb: core: switch bus numbering to using idr
USB bus numbering is based on directly dealing with bitmaps and defines a separate list of busses. This can be simplified and unified by using existing idr functionality. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/devices.c')
-rw-r--r--drivers/usb/core/devices.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index b35a6a52210f..6118a04f0b84 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -110,13 +110,6 @@ static const char format_endpt[] =
/* E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=D?s */
"E: Ad=%02x(%c) Atr=%02x(%-4s) MxPS=%4d Ivl=%d%cs\n";
-
-/*
- * Need access to the driver and USB bus lists.
- * extern struct list_head usb_bus_list;
- * However, these will come from functions that return ptrs to each of them.
- */
-
/*
* Wait for an connect/disconnect event to happen. We initialize
* the event counter with an odd number, and each event will increment
@@ -618,6 +611,7 @@ static ssize_t usb_device_read(struct file *file, char __user *buf,
struct usb_bus *bus;
ssize_t ret, total_written = 0;
loff_t skip_bytes = *ppos;
+ int id;
if (*ppos < 0)
return -EINVAL;
@@ -628,7 +622,7 @@ static ssize_t usb_device_read(struct file *file, char __user *buf,
mutex_lock(&usb_bus_list_lock);
/* print devices for all busses */
- list_for_each_entry(bus, &usb_bus_list, bus_list) {
+ idr_for_each_entry(&usb_bus_idr, bus, id) {
/* recurse through all children of the root hub */
if (!bus_to_hcd(bus)->rh_registered)
continue;