diff options
| author | Matthias Beyer <mail@beyermatthias.de> | 2013-10-05 17:09:15 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-11 19:58:01 -0400 |
| commit | 059239adfe577866115cd5270eba40e3cac33f8a (patch) | |
| tree | ebeda4730820ebae0af9c1b73e0e2d9a516fcfed /drivers/usb/core | |
| parent | 29824c167bead38986d5e8d33008680c62478777 (diff) | |
drivers: usb: core: hcd.c: converted busmap from struct to bitmap
The DECLARE_BITMAP macro should be used for declaring this bitmap.
This commit converts the busmap from a struct to a simple (static)
bitmap, using the DECLARE_BITMAP macro from linux/types.h.
Please review, as I'm new to kernel development, I don't know if this
has any hidden side effects!
Suggested by joe@perches.com
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
| -rw-r--r-- | drivers/usb/core/hcd.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 149cdf129293..6ec8dda31118 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #include <linux/platform_device.h> | 40 | #include <linux/platform_device.h> |
| 41 | #include <linux/workqueue.h> | 41 | #include <linux/workqueue.h> |
| 42 | #include <linux/pm_runtime.h> | 42 | #include <linux/pm_runtime.h> |
| 43 | #include <linux/types.h> | ||
| 43 | 44 | ||
| 44 | #include <linux/usb.h> | 45 | #include <linux/usb.h> |
| 45 | #include <linux/usb/hcd.h> | 46 | #include <linux/usb/hcd.h> |
| @@ -92,10 +93,7 @@ EXPORT_SYMBOL_GPL (usb_bus_list); | |||
| 92 | 93 | ||
| 93 | /* used when allocating bus numbers */ | 94 | /* used when allocating bus numbers */ |
| 94 | #define USB_MAXBUS 64 | 95 | #define USB_MAXBUS 64 |
| 95 | struct usb_busmap { | 96 | static DECLARE_BITMAP(busmap, USB_MAXBUS); |
| 96 | unsigned long busmap[USB_MAXBUS / (8*sizeof (unsigned long))]; | ||
| 97 | }; | ||
| 98 | static struct usb_busmap busmap; | ||
| 99 | 97 | ||
| 100 | /* used when updating list of hcds */ | 98 | /* used when updating list of hcds */ |
| 101 | DEFINE_MUTEX(usb_bus_list_lock); /* exported only for usbfs */ | 99 | DEFINE_MUTEX(usb_bus_list_lock); /* exported only for usbfs */ |
| @@ -941,12 +939,12 @@ static int usb_register_bus(struct usb_bus *bus) | |||
| 941 | int busnum; | 939 | int busnum; |
| 942 | 940 | ||
| 943 | mutex_lock(&usb_bus_list_lock); | 941 | mutex_lock(&usb_bus_list_lock); |
| 944 | busnum = find_next_zero_bit (busmap.busmap, USB_MAXBUS, 1); | 942 | busnum = find_next_zero_bit(busmap, USB_MAXBUS, 1); |
| 945 | if (busnum >= USB_MAXBUS) { | 943 | if (busnum >= USB_MAXBUS) { |
| 946 | printk (KERN_ERR "%s: too many buses\n", usbcore_name); | 944 | printk (KERN_ERR "%s: too many buses\n", usbcore_name); |
| 947 | goto error_find_busnum; | 945 | goto error_find_busnum; |
| 948 | } | 946 | } |
| 949 | set_bit (busnum, busmap.busmap); | 947 | set_bit(busnum, busmap); |
| 950 | bus->busnum = busnum; | 948 | bus->busnum = busnum; |
| 951 | 949 | ||
| 952 | /* Add it to the local list of buses */ | 950 | /* Add it to the local list of buses */ |
| @@ -987,7 +985,7 @@ static void usb_deregister_bus (struct usb_bus *bus) | |||
| 987 | 985 | ||
| 988 | usb_notify_remove_bus(bus); | 986 | usb_notify_remove_bus(bus); |
| 989 | 987 | ||
| 990 | clear_bit (bus->busnum, busmap.busmap); | 988 | clear_bit(bus->busnum, busmap); |
| 991 | } | 989 | } |
| 992 | 990 | ||
| 993 | /** | 991 | /** |
