diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-07 22:23:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-07 22:23:21 -0500 |
commit | c96e2c92072d3e78954c961f53d8c7352f7abbd7 (patch) | |
tree | d844f26f926ff40e98e9eae0e11fd71acad81df4 /drivers/usb/core | |
parent | f2aca47dc3c2d0c2d5dbd972558557e74232bbce (diff) | |
parent | 64358164f5bfe5e11d4040c1eb674c29e1436ce5 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (70 commits)
USB: remove duplicate device id from zc0301
USB: remove duplicate device id from usb_storage
USB: remove duplicate device id from keyspan
USB: remove duplicate device id from ftdi_sio
USB: remove duplicate device id from visor
USB: a bit more coding style cleanup
usbcore: trivial whitespace fixes
usb-storage: use first bulk endpoints, not last
EHCI: fix interrupt-driven remote wakeup
USB: switch ehci-hcd to new polling scheme
USB: autosuspend for usb printer driver
USB Input: Added kernel module to support all GTCO CalComp USB InterWrite School products
USB: Sierra Wireless auto set D0
USB: usb ethernet gadget recognizes HUSB2DEV
USB: list atmel husb2_udc gadget controller
USB: gadgetfs AIO tweaks
USB: gadgetfs behaves better on userspace init bug
USB: gadgetfs race fix
USB: gadgetfs simplifications
USB: gadgetfs cleanups
...
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/Kconfig | 13 | ||||
-rw-r--r-- | drivers/usb/core/buffer.c | 36 | ||||
-rw-r--r-- | drivers/usb/core/devices.c | 22 | ||||
-rw-r--r-- | drivers/usb/core/devio.c | 25 | ||||
-rw-r--r-- | drivers/usb/core/driver.c | 35 | ||||
-rw-r--r-- | drivers/usb/core/file.c | 13 | ||||
-rw-r--r-- | drivers/usb/core/generic.c | 28 | ||||
-rw-r--r-- | drivers/usb/core/hcd.c | 137 | ||||
-rw-r--r-- | drivers/usb/core/hcd.h | 6 | ||||
-rw-r--r-- | drivers/usb/core/hub.c | 64 | ||||
-rw-r--r-- | drivers/usb/core/message.c | 6 | ||||
-rw-r--r-- | drivers/usb/core/sysfs.c | 98 | ||||
-rw-r--r-- | drivers/usb/core/urb.c | 21 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 96 |
14 files changed, 218 insertions, 382 deletions
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index 3e66b2a9974a..2fc0f88a3d86 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig | |||
@@ -33,19 +33,6 @@ config USB_DEVICEFS | |||
33 | 33 | ||
34 | Most users want to say Y here. | 34 | Most users want to say Y here. |
35 | 35 | ||
36 | config USB_BANDWIDTH | ||
37 | bool "Enforce USB bandwidth allocation (EXPERIMENTAL)" | ||
38 | depends on USB && EXPERIMENTAL | ||
39 | help | ||
40 | If you say Y here, the USB subsystem enforces USB bandwidth | ||
41 | allocation and will prevent some device opens from succeeding | ||
42 | if they would cause USB bandwidth usage to go above 90% of | ||
43 | the bus bandwidth. | ||
44 | |||
45 | If you say N here, these conditions will cause warning messages | ||
46 | about USB bandwidth usage to be logged and some devices or | ||
47 | drivers may not work correctly. | ||
48 | |||
49 | config USB_DYNAMIC_MINORS | 36 | config USB_DYNAMIC_MINORS |
50 | bool "Dynamic USB minor allocation (EXPERIMENTAL)" | 37 | bool "Dynamic USB minor allocation (EXPERIMENTAL)" |
51 | depends on USB && EXPERIMENTAL | 38 | depends on USB && EXPERIMENTAL |
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index c3915dc28608..ead2475406b8 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c | |||
@@ -49,9 +49,9 @@ static const size_t pool_max [HCD_BUFFER_POOLS] = { | |||
49 | * | 49 | * |
50 | * Call hcd_buffer_destroy() to clean up after using those pools. | 50 | * Call hcd_buffer_destroy() to clean up after using those pools. |
51 | */ | 51 | */ |
52 | int hcd_buffer_create (struct usb_hcd *hcd) | 52 | int hcd_buffer_create(struct usb_hcd *hcd) |
53 | { | 53 | { |
54 | char name [16]; | 54 | char name[16]; |
55 | int i, size; | 55 | int i, size; |
56 | 56 | ||
57 | if (!hcd->self.controller->dma_mask) | 57 | if (!hcd->self.controller->dma_mask) |
@@ -60,11 +60,11 @@ int hcd_buffer_create (struct usb_hcd *hcd) | |||
60 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { | 60 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { |
61 | if (!(size = pool_max [i])) | 61 | if (!(size = pool_max [i])) |
62 | continue; | 62 | continue; |
63 | snprintf (name, sizeof name, "buffer-%d", size); | 63 | snprintf(name, sizeof name, "buffer-%d", size); |
64 | hcd->pool [i] = dma_pool_create (name, hcd->self.controller, | 64 | hcd->pool[i] = dma_pool_create(name, hcd->self.controller, |
65 | size, size, 0); | 65 | size, size, 0); |
66 | if (!hcd->pool [i]) { | 66 | if (!hcd->pool [i]) { |
67 | hcd_buffer_destroy (hcd); | 67 | hcd_buffer_destroy(hcd); |
68 | return -ENOMEM; | 68 | return -ENOMEM; |
69 | } | 69 | } |
70 | } | 70 | } |
@@ -79,14 +79,14 @@ int hcd_buffer_create (struct usb_hcd *hcd) | |||
79 | * | 79 | * |
80 | * This frees the buffer pools created by hcd_buffer_create(). | 80 | * This frees the buffer pools created by hcd_buffer_create(). |
81 | */ | 81 | */ |
82 | void hcd_buffer_destroy (struct usb_hcd *hcd) | 82 | void hcd_buffer_destroy(struct usb_hcd *hcd) |
83 | { | 83 | { |
84 | int i; | 84 | int i; |
85 | 85 | ||
86 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { | 86 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { |
87 | struct dma_pool *pool = hcd->pool [i]; | 87 | struct dma_pool *pool = hcd->pool[i]; |
88 | if (pool) { | 88 | if (pool) { |
89 | dma_pool_destroy (pool); | 89 | dma_pool_destroy(pool); |
90 | hcd->pool[i] = NULL; | 90 | hcd->pool[i] = NULL; |
91 | } | 91 | } |
92 | } | 92 | } |
@@ -97,8 +97,8 @@ void hcd_buffer_destroy (struct usb_hcd *hcd) | |||
97 | * better sharing and to leverage mm/slab.c intelligence. | 97 | * better sharing and to leverage mm/slab.c intelligence. |
98 | */ | 98 | */ |
99 | 99 | ||
100 | void *hcd_buffer_alloc ( | 100 | void *hcd_buffer_alloc( |
101 | struct usb_bus *bus, | 101 | struct usb_bus *bus, |
102 | size_t size, | 102 | size_t size, |
103 | gfp_t mem_flags, | 103 | gfp_t mem_flags, |
104 | dma_addr_t *dma | 104 | dma_addr_t *dma |
@@ -110,18 +110,18 @@ void *hcd_buffer_alloc ( | |||
110 | /* some USB hosts just use PIO */ | 110 | /* some USB hosts just use PIO */ |
111 | if (!bus->controller->dma_mask) { | 111 | if (!bus->controller->dma_mask) { |
112 | *dma = ~(dma_addr_t) 0; | 112 | *dma = ~(dma_addr_t) 0; |
113 | return kmalloc (size, mem_flags); | 113 | return kmalloc(size, mem_flags); |
114 | } | 114 | } |
115 | 115 | ||
116 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { | 116 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { |
117 | if (size <= pool_max [i]) | 117 | if (size <= pool_max [i]) |
118 | return dma_pool_alloc (hcd->pool [i], mem_flags, dma); | 118 | return dma_pool_alloc(hcd->pool [i], mem_flags, dma); |
119 | } | 119 | } |
120 | return dma_alloc_coherent (hcd->self.controller, size, dma, 0); | 120 | return dma_alloc_coherent(hcd->self.controller, size, dma, 0); |
121 | } | 121 | } |
122 | 122 | ||
123 | void hcd_buffer_free ( | 123 | void hcd_buffer_free( |
124 | struct usb_bus *bus, | 124 | struct usb_bus *bus, |
125 | size_t size, | 125 | size_t size, |
126 | void *addr, | 126 | void *addr, |
127 | dma_addr_t dma | 127 | dma_addr_t dma |
@@ -134,15 +134,15 @@ void hcd_buffer_free ( | |||
134 | return; | 134 | return; |
135 | 135 | ||
136 | if (!bus->controller->dma_mask) { | 136 | if (!bus->controller->dma_mask) { |
137 | kfree (addr); | 137 | kfree(addr); |
138 | return; | 138 | return; |
139 | } | 139 | } |
140 | 140 | ||
141 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { | 141 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { |
142 | if (size <= pool_max [i]) { | 142 | if (size <= pool_max [i]) { |
143 | dma_pool_free (hcd->pool [i], addr, dma); | 143 | dma_pool_free(hcd->pool [i], addr, dma); |
144 | return; | 144 | return; |
145 | } | 145 | } |
146 | } | 146 | } |
147 | dma_free_coherent (hcd->self.controller, size, addr, dma); | 147 | dma_free_coherent(hcd->self.controller, size, addr, dma); |
148 | } | 148 | } |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index ea398e5d50af..a47c30b2d764 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -104,7 +104,7 @@ static const char *format_config = | |||
104 | 104 | ||
105 | static const char *format_iface = | 105 | static const char *format_iface = |
106 | /* I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=xxxx*/ | 106 | /* I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=xxxx*/ |
107 | "I: If#=%2d Alt=%2d #EPs=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x Driver=%s\n"; | 107 | "I:%c If#=%2d Alt=%2d #EPs=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x Driver=%s\n"; |
108 | 108 | ||
109 | static const char *format_endpt = | 109 | static const char *format_endpt = |
110 | /* E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=D?s */ | 110 | /* E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=D?s */ |
@@ -164,10 +164,10 @@ static const char *class_decode(const int class) | |||
164 | for (ix = 0; clas_info[ix].class != -1; ix++) | 164 | for (ix = 0; clas_info[ix].class != -1; ix++) |
165 | if (clas_info[ix].class == class) | 165 | if (clas_info[ix].class == class) |
166 | break; | 166 | break; |
167 | return (clas_info[ix].class_name); | 167 | return clas_info[ix].class_name; |
168 | } | 168 | } |
169 | 169 | ||
170 | static char *usb_dump_endpoint_descriptor ( | 170 | static char *usb_dump_endpoint_descriptor( |
171 | int speed, | 171 | int speed, |
172 | char *start, | 172 | char *start, |
173 | char *end, | 173 | char *end, |
@@ -212,9 +212,9 @@ static char *usb_dump_endpoint_descriptor ( | |||
212 | break; | 212 | break; |
213 | case USB_ENDPOINT_XFER_INT: | 213 | case USB_ENDPOINT_XFER_INT: |
214 | type = "Int."; | 214 | type = "Int."; |
215 | if (speed == USB_SPEED_HIGH) { | 215 | if (speed == USB_SPEED_HIGH) |
216 | interval = 1 << (desc->bInterval - 1); | 216 | interval = 1 << (desc->bInterval - 1); |
217 | } else | 217 | else |
218 | interval = desc->bInterval; | 218 | interval = desc->bInterval; |
219 | break; | 219 | break; |
220 | default: /* "can't happen" */ | 220 | default: /* "can't happen" */ |
@@ -242,15 +242,19 @@ static char *usb_dump_interface_descriptor(char *start, char *end, | |||
242 | { | 242 | { |
243 | const struct usb_interface_descriptor *desc = &intfc->altsetting[setno].desc; | 243 | const struct usb_interface_descriptor *desc = &intfc->altsetting[setno].desc; |
244 | const char *driver_name = ""; | 244 | const char *driver_name = ""; |
245 | int active = 0; | ||
245 | 246 | ||
246 | if (start > end) | 247 | if (start > end) |
247 | return start; | 248 | return start; |
248 | down_read(&usb_bus_type.subsys.rwsem); | 249 | down_read(&usb_bus_type.subsys.rwsem); |
249 | if (iface) | 250 | if (iface) { |
250 | driver_name = (iface->dev.driver | 251 | driver_name = (iface->dev.driver |
251 | ? iface->dev.driver->name | 252 | ? iface->dev.driver->name |
252 | : "(none)"); | 253 | : "(none)"); |
254 | active = (desc == &iface->cur_altsetting->desc); | ||
255 | } | ||
253 | start += sprintf(start, format_iface, | 256 | start += sprintf(start, format_iface, |
257 | active ? '*' : ' ', /* mark active altsetting */ | ||
254 | desc->bInterfaceNumber, | 258 | desc->bInterfaceNumber, |
255 | desc->bAlternateSetting, | 259 | desc->bAlternateSetting, |
256 | desc->bNumEndpoints, | 260 | desc->bNumEndpoints, |
@@ -343,7 +347,7 @@ static char *usb_dump_device_descriptor(char *start, char *end, const struct usb | |||
343 | 347 | ||
344 | if (start > end) | 348 | if (start > end) |
345 | return start; | 349 | return start; |
346 | start += sprintf (start, format_device1, | 350 | start += sprintf(start, format_device1, |
347 | bcdUSB >> 8, bcdUSB & 0xff, | 351 | bcdUSB >> 8, bcdUSB & 0xff, |
348 | desc->bDeviceClass, | 352 | desc->bDeviceClass, |
349 | class_decode (desc->bDeviceClass), | 353 | class_decode (desc->bDeviceClass), |
@@ -363,7 +367,7 @@ static char *usb_dump_device_descriptor(char *start, char *end, const struct usb | |||
363 | /* | 367 | /* |
364 | * Dump the different strings that this device holds. | 368 | * Dump the different strings that this device holds. |
365 | */ | 369 | */ |
366 | static char *usb_dump_device_strings (char *start, char *end, struct usb_device *dev) | 370 | static char *usb_dump_device_strings(char *start, char *end, struct usb_device *dev) |
367 | { | 371 | { |
368 | if (start > end) | 372 | if (start > end) |
369 | return start; | 373 | return start; |
@@ -395,7 +399,7 @@ static char *usb_dump_desc(char *start, char *end, struct usb_device *dev) | |||
395 | if (start > end) | 399 | if (start > end) |
396 | return start; | 400 | return start; |
397 | 401 | ||
398 | start = usb_dump_device_strings (start, end, dev); | 402 | start = usb_dump_device_strings(start, end, dev); |
399 | 403 | ||
400 | for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { | 404 | for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { |
401 | if (start > end) | 405 | if (start > end) |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 4b3a6ab29bd3..2087766f9e88 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -522,19 +522,19 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsig | |||
522 | 522 | ||
523 | static struct usb_device *usbdev_lookup_minor(int minor) | 523 | static struct usb_device *usbdev_lookup_minor(int minor) |
524 | { | 524 | { |
525 | struct class_device *class_dev; | 525 | struct device *device; |
526 | struct usb_device *dev = NULL; | 526 | struct usb_device *udev = NULL; |
527 | 527 | ||
528 | down(&usb_device_class->sem); | 528 | down(&usb_device_class->sem); |
529 | list_for_each_entry(class_dev, &usb_device_class->children, node) { | 529 | list_for_each_entry(device, &usb_device_class->devices, node) { |
530 | if (class_dev->devt == MKDEV(USB_DEVICE_MAJOR, minor)) { | 530 | if (device->devt == MKDEV(USB_DEVICE_MAJOR, minor)) { |
531 | dev = class_dev->class_data; | 531 | udev = device->platform_data; |
532 | break; | 532 | break; |
533 | } | 533 | } |
534 | } | 534 | } |
535 | up(&usb_device_class->sem); | 535 | up(&usb_device_class->sem); |
536 | 536 | ||
537 | return dev; | 537 | return udev; |
538 | }; | 538 | }; |
539 | 539 | ||
540 | /* | 540 | /* |
@@ -570,6 +570,7 @@ static int usbdev_open(struct inode *inode, struct file *file) | |||
570 | ps->dev = dev; | 570 | ps->dev = dev; |
571 | ps->file = file; | 571 | ps->file = file; |
572 | spin_lock_init(&ps->lock); | 572 | spin_lock_init(&ps->lock); |
573 | INIT_LIST_HEAD(&ps->list); | ||
573 | INIT_LIST_HEAD(&ps->async_pending); | 574 | INIT_LIST_HEAD(&ps->async_pending); |
574 | INIT_LIST_HEAD(&ps->async_completed); | 575 | INIT_LIST_HEAD(&ps->async_completed); |
575 | init_waitqueue_head(&ps->wait); | 576 | init_waitqueue_head(&ps->wait); |
@@ -1596,19 +1597,19 @@ static int usbdev_add(struct usb_device *dev) | |||
1596 | { | 1597 | { |
1597 | int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1); | 1598 | int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1); |
1598 | 1599 | ||
1599 | dev->class_dev = class_device_create(usb_device_class, NULL, | 1600 | dev->usbfs_dev = device_create(usb_device_class, &dev->dev, |
1600 | MKDEV(USB_DEVICE_MAJOR, minor), &dev->dev, | 1601 | MKDEV(USB_DEVICE_MAJOR, minor), |
1601 | "usbdev%d.%d", dev->bus->busnum, dev->devnum); | 1602 | "usbdev%d.%d", dev->bus->busnum, dev->devnum); |
1602 | if (IS_ERR(dev->class_dev)) | 1603 | if (IS_ERR(dev->usbfs_dev)) |
1603 | return PTR_ERR(dev->class_dev); | 1604 | return PTR_ERR(dev->usbfs_dev); |
1604 | 1605 | ||
1605 | dev->class_dev->class_data = dev; | 1606 | dev->usbfs_dev->platform_data = dev; |
1606 | return 0; | 1607 | return 0; |
1607 | } | 1608 | } |
1608 | 1609 | ||
1609 | static void usbdev_remove(struct usb_device *dev) | 1610 | static void usbdev_remove(struct usb_device *dev) |
1610 | { | 1611 | { |
1611 | class_device_unregister(dev->class_dev); | 1612 | device_unregister(dev->usbfs_dev); |
1612 | } | 1613 | } |
1613 | 1614 | ||
1614 | static int usbdev_notify(struct notifier_block *self, unsigned long action, | 1615 | static int usbdev_notify(struct notifier_block *self, unsigned long action, |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index d505926aa9cc..600d1bc8272a 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -28,24 +28,16 @@ | |||
28 | #include "hcd.h" | 28 | #include "hcd.h" |
29 | #include "usb.h" | 29 | #include "usb.h" |
30 | 30 | ||
31 | static int usb_match_one_id(struct usb_interface *interface, | ||
32 | const struct usb_device_id *id); | ||
33 | |||
34 | struct usb_dynid { | ||
35 | struct list_head node; | ||
36 | struct usb_device_id id; | ||
37 | }; | ||
38 | |||
39 | #ifdef CONFIG_HOTPLUG | 31 | #ifdef CONFIG_HOTPLUG |
40 | 32 | ||
41 | /* | 33 | /* |
42 | * Adds a new dynamic USBdevice ID to this driver, | 34 | * Adds a new dynamic USBdevice ID to this driver, |
43 | * and cause the driver to probe for all devices again. | 35 | * and cause the driver to probe for all devices again. |
44 | */ | 36 | */ |
45 | static ssize_t store_new_id(struct device_driver *driver, | 37 | ssize_t usb_store_new_id(struct usb_dynids *dynids, |
46 | const char *buf, size_t count) | 38 | struct device_driver *driver, |
39 | const char *buf, size_t count) | ||
47 | { | 40 | { |
48 | struct usb_driver *usb_drv = to_usb_driver(driver); | ||
49 | struct usb_dynid *dynid; | 41 | struct usb_dynid *dynid; |
50 | u32 idVendor = 0; | 42 | u32 idVendor = 0; |
51 | u32 idProduct = 0; | 43 | u32 idProduct = 0; |
@@ -65,9 +57,9 @@ static ssize_t store_new_id(struct device_driver *driver, | |||
65 | dynid->id.idProduct = idProduct; | 57 | dynid->id.idProduct = idProduct; |
66 | dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE; | 58 | dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE; |
67 | 59 | ||
68 | spin_lock(&usb_drv->dynids.lock); | 60 | spin_lock(&dynids->lock); |
69 | list_add_tail(&usb_drv->dynids.list, &dynid->node); | 61 | list_add_tail(&dynids->list, &dynid->node); |
70 | spin_unlock(&usb_drv->dynids.lock); | 62 | spin_unlock(&dynids->lock); |
71 | 63 | ||
72 | if (get_driver(driver)) { | 64 | if (get_driver(driver)) { |
73 | retval = driver_attach(driver); | 65 | retval = driver_attach(driver); |
@@ -78,6 +70,15 @@ static ssize_t store_new_id(struct device_driver *driver, | |||
78 | return retval; | 70 | return retval; |
79 | return count; | 71 | return count; |
80 | } | 72 | } |
73 | EXPORT_SYMBOL_GPL(usb_store_new_id); | ||
74 | |||
75 | static ssize_t store_new_id(struct device_driver *driver, | ||
76 | const char *buf, size_t count) | ||
77 | { | ||
78 | struct usb_driver *usb_drv = to_usb_driver(driver); | ||
79 | |||
80 | return usb_store_new_id(&usb_drv->dynids, driver, buf, count); | ||
81 | } | ||
81 | static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); | 82 | static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); |
82 | 83 | ||
83 | static int usb_create_newid_file(struct usb_driver *usb_drv) | 84 | static int usb_create_newid_file(struct usb_driver *usb_drv) |
@@ -365,8 +366,8 @@ void usb_driver_release_interface(struct usb_driver *driver, | |||
365 | EXPORT_SYMBOL(usb_driver_release_interface); | 366 | EXPORT_SYMBOL(usb_driver_release_interface); |
366 | 367 | ||
367 | /* returns 0 if no match, 1 if match */ | 368 | /* returns 0 if no match, 1 if match */ |
368 | static int usb_match_one_id(struct usb_interface *interface, | 369 | int usb_match_one_id(struct usb_interface *interface, |
369 | const struct usb_device_id *id) | 370 | const struct usb_device_id *id) |
370 | { | 371 | { |
371 | struct usb_host_interface *intf; | 372 | struct usb_host_interface *intf; |
372 | struct usb_device *dev; | 373 | struct usb_device *dev; |
@@ -432,6 +433,8 @@ static int usb_match_one_id(struct usb_interface *interface, | |||
432 | 433 | ||
433 | return 1; | 434 | return 1; |
434 | } | 435 | } |
436 | EXPORT_SYMBOL_GPL(usb_match_one_id); | ||
437 | |||
435 | /** | 438 | /** |
436 | * usb_match_id - find first usb_device_id matching device or interface | 439 | * usb_match_id - find first usb_device_id matching device or interface |
437 | * @interface: the interface of interest | 440 | * @interface: the interface of interest |
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index f794f07cfb33..01c857ac27af 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
@@ -194,14 +194,13 @@ int usb_register_dev(struct usb_interface *intf, | |||
194 | ++temp; | 194 | ++temp; |
195 | else | 195 | else |
196 | temp = name; | 196 | temp = name; |
197 | intf->class_dev = class_device_create(usb_class->class, NULL, | 197 | intf->usb_dev = device_create(usb_class->class, &intf->dev, |
198 | MKDEV(USB_MAJOR, minor), | 198 | MKDEV(USB_MAJOR, minor), "%s", temp); |
199 | &intf->dev, "%s", temp); | 199 | if (IS_ERR(intf->usb_dev)) { |
200 | if (IS_ERR(intf->class_dev)) { | ||
201 | spin_lock (&minor_lock); | 200 | spin_lock (&minor_lock); |
202 | usb_minors[intf->minor] = NULL; | 201 | usb_minors[intf->minor] = NULL; |
203 | spin_unlock (&minor_lock); | 202 | spin_unlock (&minor_lock); |
204 | retval = PTR_ERR(intf->class_dev); | 203 | retval = PTR_ERR(intf->usb_dev); |
205 | } | 204 | } |
206 | exit: | 205 | exit: |
207 | return retval; | 206 | return retval; |
@@ -242,8 +241,8 @@ void usb_deregister_dev(struct usb_interface *intf, | |||
242 | spin_unlock (&minor_lock); | 241 | spin_unlock (&minor_lock); |
243 | 242 | ||
244 | snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); | 243 | snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); |
245 | class_device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor)); | 244 | device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor)); |
246 | intf->class_dev = NULL; | 245 | intf->usb_dev = NULL; |
247 | intf->minor = -1; | 246 | intf->minor = -1; |
248 | destroy_usb_class(); | 247 | destroy_usb_class(); |
249 | } | 248 | } |
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c index ebb20ff7ac58..b531a4fd30c2 100644 --- a/drivers/usb/core/generic.c +++ b/drivers/usb/core/generic.c | |||
@@ -25,6 +25,20 @@ static inline const char *plural(int n) | |||
25 | return (n == 1 ? "" : "s"); | 25 | return (n == 1 ? "" : "s"); |
26 | } | 26 | } |
27 | 27 | ||
28 | static int is_rndis(struct usb_interface_descriptor *desc) | ||
29 | { | ||
30 | return desc->bInterfaceClass == USB_CLASS_COMM | ||
31 | && desc->bInterfaceSubClass == 2 | ||
32 | && desc->bInterfaceProtocol == 0xff; | ||
33 | } | ||
34 | |||
35 | static int is_activesync(struct usb_interface_descriptor *desc) | ||
36 | { | ||
37 | return desc->bInterfaceClass == USB_CLASS_MISC | ||
38 | && desc->bInterfaceSubClass == 1 | ||
39 | && desc->bInterfaceProtocol == 1; | ||
40 | } | ||
41 | |||
28 | static int choose_configuration(struct usb_device *udev) | 42 | static int choose_configuration(struct usb_device *udev) |
29 | { | 43 | { |
30 | int i; | 44 | int i; |
@@ -87,14 +101,12 @@ static int choose_configuration(struct usb_device *udev) | |||
87 | continue; | 101 | continue; |
88 | } | 102 | } |
89 | 103 | ||
90 | /* If the first config's first interface is COMM/2/0xff | 104 | /* When the first config's first interface is one of Microsoft's |
91 | * (MSFT RNDIS), rule it out unless Linux has host-side | 105 | * pet nonstandard Ethernet-over-USB protocols, ignore it unless |
92 | * RNDIS support. */ | 106 | * this kernel has enabled the necessary host side driver. |
93 | if (i == 0 && desc | 107 | */ |
94 | && desc->bInterfaceClass == USB_CLASS_COMM | 108 | if (i == 0 && desc && (is_rndis(desc) || is_activesync(desc))) { |
95 | && desc->bInterfaceSubClass == 2 | 109 | #if !defined(CONFIG_USB_NET_RNDIS_HOST) && !defined(CONFIG_USB_NET_RNDIS_HOST_MODULE) |
96 | && desc->bInterfaceProtocol == 0xff) { | ||
97 | #ifndef CONFIG_USB_NET_RNDIS_HOST | ||
98 | continue; | 110 | continue; |
99 | #else | 111 | #else |
100 | best = c; | 112 | best = c; |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 10064af65d17..b26c19e8d19f 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -45,8 +45,6 @@ | |||
45 | #include "hub.h" | 45 | #include "hub.h" |
46 | 46 | ||
47 | 47 | ||
48 | // #define USB_BANDWIDTH_MESSAGES | ||
49 | |||
50 | /*-------------------------------------------------------------------------*/ | 48 | /*-------------------------------------------------------------------------*/ |
51 | 49 | ||
52 | /* | 50 | /* |
@@ -891,136 +889,6 @@ long usb_calc_bus_time (int speed, int is_input, int isoc, int bytecount) | |||
891 | } | 889 | } |
892 | EXPORT_SYMBOL (usb_calc_bus_time); | 890 | EXPORT_SYMBOL (usb_calc_bus_time); |
893 | 891 | ||
894 | /* | ||
895 | * usb_check_bandwidth(): | ||
896 | * | ||
897 | * old_alloc is from host_controller->bandwidth_allocated in microseconds; | ||
898 | * bustime is from calc_bus_time(), but converted to microseconds. | ||
899 | * | ||
900 | * returns <bustime in us> if successful, | ||
901 | * or -ENOSPC if bandwidth request fails. | ||
902 | * | ||
903 | * FIXME: | ||
904 | * This initial implementation does not use Endpoint.bInterval | ||
905 | * in managing bandwidth allocation. | ||
906 | * It probably needs to be expanded to use Endpoint.bInterval. | ||
907 | * This can be done as a later enhancement (correction). | ||
908 | * | ||
909 | * This will also probably require some kind of | ||
910 | * frame allocation tracking...meaning, for example, | ||
911 | * that if multiple drivers request interrupts every 10 USB frames, | ||
912 | * they don't all have to be allocated at | ||
913 | * frame numbers N, N+10, N+20, etc. Some of them could be at | ||
914 | * N+11, N+21, N+31, etc., and others at | ||
915 | * N+12, N+22, N+32, etc. | ||
916 | * | ||
917 | * Similarly for isochronous transfers... | ||
918 | * | ||
919 | * Individual HCDs can schedule more directly ... this logic | ||
920 | * is not correct for high speed transfers. | ||
921 | */ | ||
922 | int usb_check_bandwidth (struct usb_device *dev, struct urb *urb) | ||
923 | { | ||
924 | unsigned int pipe = urb->pipe; | ||
925 | long bustime; | ||
926 | int is_in = usb_pipein (pipe); | ||
927 | int is_iso = usb_pipeisoc (pipe); | ||
928 | int old_alloc = dev->bus->bandwidth_allocated; | ||
929 | int new_alloc; | ||
930 | |||
931 | |||
932 | bustime = NS_TO_US (usb_calc_bus_time (dev->speed, is_in, is_iso, | ||
933 | usb_maxpacket (dev, pipe, !is_in))); | ||
934 | if (is_iso) | ||
935 | bustime /= urb->number_of_packets; | ||
936 | |||
937 | new_alloc = old_alloc + (int) bustime; | ||
938 | if (new_alloc > FRAME_TIME_MAX_USECS_ALLOC) { | ||
939 | #ifdef DEBUG | ||
940 | char *mode = | ||
941 | #ifdef CONFIG_USB_BANDWIDTH | ||
942 | ""; | ||
943 | #else | ||
944 | "would have "; | ||
945 | #endif | ||
946 | dev_dbg (&dev->dev, "usb_check_bandwidth %sFAILED: %d + %ld = %d usec\n", | ||
947 | mode, old_alloc, bustime, new_alloc); | ||
948 | #endif | ||
949 | #ifdef CONFIG_USB_BANDWIDTH | ||
950 | bustime = -ENOSPC; /* report error */ | ||
951 | #endif | ||
952 | } | ||
953 | |||
954 | return bustime; | ||
955 | } | ||
956 | EXPORT_SYMBOL (usb_check_bandwidth); | ||
957 | |||
958 | |||
959 | /** | ||
960 | * usb_claim_bandwidth - records bandwidth for a periodic transfer | ||
961 | * @dev: source/target of request | ||
962 | * @urb: request (urb->dev == dev) | ||
963 | * @bustime: bandwidth consumed, in (average) microseconds per frame | ||
964 | * @isoc: true iff the request is isochronous | ||
965 | * | ||
966 | * Bus bandwidth reservations are recorded purely for diagnostic purposes. | ||
967 | * HCDs are expected not to overcommit periodic bandwidth, and to record such | ||
968 | * reservations whenever endpoints are added to the periodic schedule. | ||
969 | * | ||
970 | * FIXME averaging per-frame is suboptimal. Better to sum over the HCD's | ||
971 | * entire periodic schedule ... 32 frames for OHCI, 1024 for UHCI, settable | ||
972 | * for EHCI (256/512/1024 frames, default 1024) and have the bus expose how | ||
973 | * large its periodic schedule is. | ||
974 | */ | ||
975 | void usb_claim_bandwidth (struct usb_device *dev, struct urb *urb, int bustime, int isoc) | ||
976 | { | ||
977 | dev->bus->bandwidth_allocated += bustime; | ||
978 | if (isoc) | ||
979 | dev->bus->bandwidth_isoc_reqs++; | ||
980 | else | ||
981 | dev->bus->bandwidth_int_reqs++; | ||
982 | urb->bandwidth = bustime; | ||
983 | |||
984 | #ifdef USB_BANDWIDTH_MESSAGES | ||
985 | dev_dbg (&dev->dev, "bandwidth alloc increased by %d (%s) to %d for %d requesters\n", | ||
986 | bustime, | ||
987 | isoc ? "ISOC" : "INTR", | ||
988 | dev->bus->bandwidth_allocated, | ||
989 | dev->bus->bandwidth_int_reqs + dev->bus->bandwidth_isoc_reqs); | ||
990 | #endif | ||
991 | } | ||
992 | EXPORT_SYMBOL (usb_claim_bandwidth); | ||
993 | |||
994 | |||
995 | /** | ||
996 | * usb_release_bandwidth - reverses effect of usb_claim_bandwidth() | ||
997 | * @dev: source/target of request | ||
998 | * @urb: request (urb->dev == dev) | ||
999 | * @isoc: true iff the request is isochronous | ||
1000 | * | ||
1001 | * This records that previously allocated bandwidth has been released. | ||
1002 | * Bandwidth is released when endpoints are removed from the host controller's | ||
1003 | * periodic schedule. | ||
1004 | */ | ||
1005 | void usb_release_bandwidth (struct usb_device *dev, struct urb *urb, int isoc) | ||
1006 | { | ||
1007 | dev->bus->bandwidth_allocated -= urb->bandwidth; | ||
1008 | if (isoc) | ||
1009 | dev->bus->bandwidth_isoc_reqs--; | ||
1010 | else | ||
1011 | dev->bus->bandwidth_int_reqs--; | ||
1012 | |||
1013 | #ifdef USB_BANDWIDTH_MESSAGES | ||
1014 | dev_dbg (&dev->dev, "bandwidth alloc reduced by %d (%s) to %d for %d requesters\n", | ||
1015 | urb->bandwidth, | ||
1016 | isoc ? "ISOC" : "INTR", | ||
1017 | dev->bus->bandwidth_allocated, | ||
1018 | dev->bus->bandwidth_int_reqs + dev->bus->bandwidth_isoc_reqs); | ||
1019 | #endif | ||
1020 | urb->bandwidth = 0; | ||
1021 | } | ||
1022 | EXPORT_SYMBOL (usb_release_bandwidth); | ||
1023 | |||
1024 | 892 | ||
1025 | /*-------------------------------------------------------------------------*/ | 893 | /*-------------------------------------------------------------------------*/ |
1026 | 894 | ||
@@ -1034,11 +902,6 @@ static void urb_unlink (struct urb *urb) | |||
1034 | { | 902 | { |
1035 | unsigned long flags; | 903 | unsigned long flags; |
1036 | 904 | ||
1037 | /* Release any periodic transfer bandwidth */ | ||
1038 | if (urb->bandwidth) | ||
1039 | usb_release_bandwidth (urb->dev, urb, | ||
1040 | usb_pipeisoc (urb->pipe)); | ||
1041 | |||
1042 | /* clear all state linking urb to this dev (and hcd) */ | 905 | /* clear all state linking urb to this dev (and hcd) */ |
1043 | 906 | ||
1044 | spin_lock_irqsave (&hcd_data_lock, flags); | 907 | spin_lock_irqsave (&hcd_data_lock, flags); |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 8f8df0d4382e..2a269ca20517 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -308,10 +308,6 @@ extern void usb_destroy_configuration(struct usb_device *dev); | |||
308 | #define NS_TO_US(ns) ((ns + 500L) / 1000L) | 308 | #define NS_TO_US(ns) ((ns + 500L) / 1000L) |
309 | /* convert & round nanoseconds to microseconds */ | 309 | /* convert & round nanoseconds to microseconds */ |
310 | 310 | ||
311 | extern void usb_claim_bandwidth (struct usb_device *dev, struct urb *urb, | ||
312 | int bustime, int isoc); | ||
313 | extern void usb_release_bandwidth (struct usb_device *dev, struct urb *urb, | ||
314 | int isoc); | ||
315 | 311 | ||
316 | /* | 312 | /* |
317 | * Full/low speed bandwidth allocation constants/support. | 313 | * Full/low speed bandwidth allocation constants/support. |
@@ -324,8 +320,6 @@ extern void usb_release_bandwidth (struct usb_device *dev, struct urb *urb, | |||
324 | #define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L) | 320 | #define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L) |
325 | #define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L) | 321 | #define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L) |
326 | 322 | ||
327 | extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb); | ||
328 | |||
329 | /* | 323 | /* |
330 | * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed | 324 | * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed |
331 | * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed | 325 | * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 1988224b362b..590ec82d0515 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -87,9 +87,6 @@ static DECLARE_WAIT_QUEUE_HEAD(khubd_wait); | |||
87 | 87 | ||
88 | static struct task_struct *khubd_task; | 88 | static struct task_struct *khubd_task; |
89 | 89 | ||
90 | /* multithreaded probe logic */ | ||
91 | static int multithread_probe = 0; | ||
92 | |||
93 | /* cycle leds on hubs that aren't blinking for attention */ | 90 | /* cycle leds on hubs that aren't blinking for attention */ |
94 | static int blinkenlights = 0; | 91 | static int blinkenlights = 0; |
95 | module_param (blinkenlights, bool, S_IRUGO); | 92 | module_param (blinkenlights, bool, S_IRUGO); |
@@ -1256,9 +1253,28 @@ static inline void show_string(struct usb_device *udev, char *id, char *string) | |||
1256 | static int __usb_port_suspend(struct usb_device *, int port1); | 1253 | static int __usb_port_suspend(struct usb_device *, int port1); |
1257 | #endif | 1254 | #endif |
1258 | 1255 | ||
1259 | static int __usb_new_device(void *void_data) | 1256 | /** |
1257 | * usb_new_device - perform initial device setup (usbcore-internal) | ||
1258 | * @udev: newly addressed device (in ADDRESS state) | ||
1259 | * | ||
1260 | * This is called with devices which have been enumerated, but not yet | ||
1261 | * configured. The device descriptor is available, but not descriptors | ||
1262 | * for any device configuration. The caller must have locked either | ||
1263 | * the parent hub (if udev is a normal device) or else the | ||
1264 | * usb_bus_list_lock (if udev is a root hub). The parent's pointer to | ||
1265 | * udev has already been installed, but udev is not yet visible through | ||
1266 | * sysfs or other filesystem code. | ||
1267 | * | ||
1268 | * It will return if the device is configured properly or not. Zero if | ||
1269 | * the interface was registered with the driver core; else a negative | ||
1270 | * errno value. | ||
1271 | * | ||
1272 | * This call is synchronous, and may not be used in an interrupt context. | ||
1273 | * | ||
1274 | * Only the hub driver or root-hub registrar should ever call this. | ||
1275 | */ | ||
1276 | int usb_new_device(struct usb_device *udev) | ||
1260 | { | 1277 | { |
1261 | struct usb_device *udev = void_data; | ||
1262 | int err; | 1278 | int err; |
1263 | 1279 | ||
1264 | /* Lock ourself into memory in order to keep a probe sequence | 1280 | /* Lock ourself into memory in order to keep a probe sequence |
@@ -1375,44 +1391,6 @@ fail: | |||
1375 | goto exit; | 1391 | goto exit; |
1376 | } | 1392 | } |
1377 | 1393 | ||
1378 | /** | ||
1379 | * usb_new_device - perform initial device setup (usbcore-internal) | ||
1380 | * @udev: newly addressed device (in ADDRESS state) | ||
1381 | * | ||
1382 | * This is called with devices which have been enumerated, but not yet | ||
1383 | * configured. The device descriptor is available, but not descriptors | ||
1384 | * for any device configuration. The caller must have locked either | ||
1385 | * the parent hub (if udev is a normal device) or else the | ||
1386 | * usb_bus_list_lock (if udev is a root hub). The parent's pointer to | ||
1387 | * udev has already been installed, but udev is not yet visible through | ||
1388 | * sysfs or other filesystem code. | ||
1389 | * | ||
1390 | * The return value for this function depends on if the | ||
1391 | * multithread_probe variable is set or not. If it's set, it will | ||
1392 | * return a if the probe thread was successfully created or not. If the | ||
1393 | * variable is not set, it will return if the device is configured | ||
1394 | * properly or not. interfaces, in sysfs); else a negative errno value. | ||
1395 | * | ||
1396 | * This call is synchronous, and may not be used in an interrupt context. | ||
1397 | * | ||
1398 | * Only the hub driver or root-hub registrar should ever call this. | ||
1399 | */ | ||
1400 | int usb_new_device(struct usb_device *udev) | ||
1401 | { | ||
1402 | struct task_struct *probe_task; | ||
1403 | int ret = 0; | ||
1404 | |||
1405 | if (multithread_probe) { | ||
1406 | probe_task = kthread_run(__usb_new_device, udev, | ||
1407 | "usb-probe-%s", udev->devnum); | ||
1408 | if (IS_ERR(probe_task)) | ||
1409 | ret = PTR_ERR(probe_task); | ||
1410 | } else | ||
1411 | ret = __usb_new_device(udev); | ||
1412 | |||
1413 | return ret; | ||
1414 | } | ||
1415 | |||
1416 | static int hub_port_status(struct usb_hub *hub, int port1, | 1394 | static int hub_port_status(struct usb_hub *hub, int port1, |
1417 | u16 *status, u16 *change) | 1395 | u16 *status, u16 *change) |
1418 | { | 1396 | { |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 149aa8bfb1fe..8aca3574c2b5 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1545,11 +1545,7 @@ int usb_driver_set_configuration(struct usb_device *udev, int config) | |||
1545 | INIT_WORK(&req->work, driver_set_config_work); | 1545 | INIT_WORK(&req->work, driver_set_config_work); |
1546 | 1546 | ||
1547 | usb_get_dev(udev); | 1547 | usb_get_dev(udev); |
1548 | if (!schedule_work(&req->work)) { | 1548 | schedule_work(&req->work); |
1549 | usb_put_dev(udev); | ||
1550 | kfree(req); | ||
1551 | return -EINVAL; | ||
1552 | } | ||
1553 | return 0; | 1549 | return 0; |
1554 | } | 1550 | } |
1555 | EXPORT_SYMBOL_GPL(usb_driver_set_configuration); | 1551 | EXPORT_SYMBOL_GPL(usb_driver_set_configuration); |
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 55d8f575206d..4eaa0ee8e72f 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -16,16 +16,16 @@ | |||
16 | 16 | ||
17 | /* Active configuration fields */ | 17 | /* Active configuration fields */ |
18 | #define usb_actconfig_show(field, multiplier, format_string) \ | 18 | #define usb_actconfig_show(field, multiplier, format_string) \ |
19 | static ssize_t show_##field (struct device *dev, \ | 19 | static ssize_t show_##field(struct device *dev, \ |
20 | struct device_attribute *attr, char *buf) \ | 20 | struct device_attribute *attr, char *buf) \ |
21 | { \ | 21 | { \ |
22 | struct usb_device *udev; \ | 22 | struct usb_device *udev; \ |
23 | struct usb_host_config *actconfig; \ | 23 | struct usb_host_config *actconfig; \ |
24 | \ | 24 | \ |
25 | udev = to_usb_device (dev); \ | 25 | udev = to_usb_device(dev); \ |
26 | actconfig = udev->actconfig; \ | 26 | actconfig = udev->actconfig; \ |
27 | if (actconfig) \ | 27 | if (actconfig) \ |
28 | return sprintf (buf, format_string, \ | 28 | return sprintf(buf, format_string, \ |
29 | actconfig->desc.field * multiplier); \ | 29 | actconfig->desc.field * multiplier); \ |
30 | else \ | 30 | else \ |
31 | return 0; \ | 31 | return 0; \ |
@@ -35,9 +35,9 @@ static ssize_t show_##field (struct device *dev, \ | |||
35 | usb_actconfig_show(field, multiplier, format_string) \ | 35 | usb_actconfig_show(field, multiplier, format_string) \ |
36 | static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL); | 36 | static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL); |
37 | 37 | ||
38 | usb_actconfig_attr (bNumInterfaces, 1, "%2d\n") | 38 | usb_actconfig_attr(bNumInterfaces, 1, "%2d\n") |
39 | usb_actconfig_attr (bmAttributes, 1, "%2x\n") | 39 | usb_actconfig_attr(bmAttributes, 1, "%2x\n") |
40 | usb_actconfig_attr (bMaxPower, 2, "%3dmA\n") | 40 | usb_actconfig_attr(bMaxPower, 2, "%3dmA\n") |
41 | 41 | ||
42 | static ssize_t show_configuration_string(struct device *dev, | 42 | static ssize_t show_configuration_string(struct device *dev, |
43 | struct device_attribute *attr, char *buf) | 43 | struct device_attribute *attr, char *buf) |
@@ -45,7 +45,7 @@ static ssize_t show_configuration_string(struct device *dev, | |||
45 | struct usb_device *udev; | 45 | struct usb_device *udev; |
46 | struct usb_host_config *actconfig; | 46 | struct usb_host_config *actconfig; |
47 | 47 | ||
48 | udev = to_usb_device (dev); | 48 | udev = to_usb_device(dev); |
49 | actconfig = udev->actconfig; | 49 | actconfig = udev->actconfig; |
50 | if ((!actconfig) || (!actconfig->string)) | 50 | if ((!actconfig) || (!actconfig->string)) |
51 | return 0; | 51 | return 0; |
@@ -57,16 +57,16 @@ static DEVICE_ATTR(configuration, S_IRUGO, show_configuration_string, NULL); | |||
57 | usb_actconfig_show(bConfigurationValue, 1, "%u\n"); | 57 | usb_actconfig_show(bConfigurationValue, 1, "%u\n"); |
58 | 58 | ||
59 | static ssize_t | 59 | static ssize_t |
60 | set_bConfigurationValue (struct device *dev, struct device_attribute *attr, | 60 | set_bConfigurationValue(struct device *dev, struct device_attribute *attr, |
61 | const char *buf, size_t count) | 61 | const char *buf, size_t count) |
62 | { | 62 | { |
63 | struct usb_device *udev = to_usb_device (dev); | 63 | struct usb_device *udev = to_usb_device(dev); |
64 | int config, value; | 64 | int config, value; |
65 | 65 | ||
66 | if (sscanf (buf, "%u", &config) != 1 || config > 255) | 66 | if (sscanf(buf, "%u", &config) != 1 || config > 255) |
67 | return -EINVAL; | 67 | return -EINVAL; |
68 | usb_lock_device(udev); | 68 | usb_lock_device(udev); |
69 | value = usb_set_configuration (udev, config); | 69 | value = usb_set_configuration(udev, config); |
70 | usb_unlock_device(udev); | 70 | usb_unlock_device(udev); |
71 | return (value < 0) ? value : count; | 71 | return (value < 0) ? value : count; |
72 | } | 72 | } |
@@ -81,7 +81,7 @@ static ssize_t show_##name(struct device *dev, \ | |||
81 | { \ | 81 | { \ |
82 | struct usb_device *udev; \ | 82 | struct usb_device *udev; \ |
83 | \ | 83 | \ |
84 | udev = to_usb_device (dev); \ | 84 | udev = to_usb_device(dev); \ |
85 | return sprintf(buf, "%s\n", udev->name); \ | 85 | return sprintf(buf, "%s\n", udev->name); \ |
86 | } \ | 86 | } \ |
87 | static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL); | 87 | static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL); |
@@ -91,12 +91,12 @@ usb_string_attr(manufacturer); | |||
91 | usb_string_attr(serial); | 91 | usb_string_attr(serial); |
92 | 92 | ||
93 | static ssize_t | 93 | static ssize_t |
94 | show_speed (struct device *dev, struct device_attribute *attr, char *buf) | 94 | show_speed(struct device *dev, struct device_attribute *attr, char *buf) |
95 | { | 95 | { |
96 | struct usb_device *udev; | 96 | struct usb_device *udev; |
97 | char *speed; | 97 | char *speed; |
98 | 98 | ||
99 | udev = to_usb_device (dev); | 99 | udev = to_usb_device(dev); |
100 | 100 | ||
101 | switch (udev->speed) { | 101 | switch (udev->speed) { |
102 | case USB_SPEED_LOW: | 102 | case USB_SPEED_LOW: |
@@ -112,22 +112,22 @@ show_speed (struct device *dev, struct device_attribute *attr, char *buf) | |||
112 | default: | 112 | default: |
113 | speed = "unknown"; | 113 | speed = "unknown"; |
114 | } | 114 | } |
115 | return sprintf (buf, "%s\n", speed); | 115 | return sprintf(buf, "%s\n", speed); |
116 | } | 116 | } |
117 | static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL); | 117 | static DEVICE_ATTR(speed, S_IRUGO, show_speed, NULL); |
118 | 118 | ||
119 | static ssize_t | 119 | static ssize_t |
120 | show_devnum (struct device *dev, struct device_attribute *attr, char *buf) | 120 | show_devnum(struct device *dev, struct device_attribute *attr, char *buf) |
121 | { | 121 | { |
122 | struct usb_device *udev; | 122 | struct usb_device *udev; |
123 | 123 | ||
124 | udev = to_usb_device (dev); | 124 | udev = to_usb_device(dev); |
125 | return sprintf (buf, "%d\n", udev->devnum); | 125 | return sprintf(buf, "%d\n", udev->devnum); |
126 | } | 126 | } |
127 | static DEVICE_ATTR(devnum, S_IRUGO, show_devnum, NULL); | 127 | static DEVICE_ATTR(devnum, S_IRUGO, show_devnum, NULL); |
128 | 128 | ||
129 | static ssize_t | 129 | static ssize_t |
130 | show_version (struct device *dev, struct device_attribute *attr, char *buf) | 130 | show_version(struct device *dev, struct device_attribute *attr, char *buf) |
131 | { | 131 | { |
132 | struct usb_device *udev; | 132 | struct usb_device *udev; |
133 | u16 bcdUSB; | 133 | u16 bcdUSB; |
@@ -139,25 +139,25 @@ show_version (struct device *dev, struct device_attribute *attr, char *buf) | |||
139 | static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); | 139 | static DEVICE_ATTR(version, S_IRUGO, show_version, NULL); |
140 | 140 | ||
141 | static ssize_t | 141 | static ssize_t |
142 | show_maxchild (struct device *dev, struct device_attribute *attr, char *buf) | 142 | show_maxchild(struct device *dev, struct device_attribute *attr, char *buf) |
143 | { | 143 | { |
144 | struct usb_device *udev; | 144 | struct usb_device *udev; |
145 | 145 | ||
146 | udev = to_usb_device (dev); | 146 | udev = to_usb_device(dev); |
147 | return sprintf (buf, "%d\n", udev->maxchild); | 147 | return sprintf(buf, "%d\n", udev->maxchild); |
148 | } | 148 | } |
149 | static DEVICE_ATTR(maxchild, S_IRUGO, show_maxchild, NULL); | 149 | static DEVICE_ATTR(maxchild, S_IRUGO, show_maxchild, NULL); |
150 | 150 | ||
151 | /* Descriptor fields */ | 151 | /* Descriptor fields */ |
152 | #define usb_descriptor_attr_le16(field, format_string) \ | 152 | #define usb_descriptor_attr_le16(field, format_string) \ |
153 | static ssize_t \ | 153 | static ssize_t \ |
154 | show_##field (struct device *dev, struct device_attribute *attr, \ | 154 | show_##field(struct device *dev, struct device_attribute *attr, \ |
155 | char *buf) \ | 155 | char *buf) \ |
156 | { \ | 156 | { \ |
157 | struct usb_device *udev; \ | 157 | struct usb_device *udev; \ |
158 | \ | 158 | \ |
159 | udev = to_usb_device (dev); \ | 159 | udev = to_usb_device(dev); \ |
160 | return sprintf (buf, format_string, \ | 160 | return sprintf(buf, format_string, \ |
161 | le16_to_cpu(udev->descriptor.field)); \ | 161 | le16_to_cpu(udev->descriptor.field)); \ |
162 | } \ | 162 | } \ |
163 | static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL); | 163 | static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL); |
@@ -168,21 +168,21 @@ usb_descriptor_attr_le16(bcdDevice, "%04x\n") | |||
168 | 168 | ||
169 | #define usb_descriptor_attr(field, format_string) \ | 169 | #define usb_descriptor_attr(field, format_string) \ |
170 | static ssize_t \ | 170 | static ssize_t \ |
171 | show_##field (struct device *dev, struct device_attribute *attr, \ | 171 | show_##field(struct device *dev, struct device_attribute *attr, \ |
172 | char *buf) \ | 172 | char *buf) \ |
173 | { \ | 173 | { \ |
174 | struct usb_device *udev; \ | 174 | struct usb_device *udev; \ |
175 | \ | 175 | \ |
176 | udev = to_usb_device (dev); \ | 176 | udev = to_usb_device(dev); \ |
177 | return sprintf (buf, format_string, udev->descriptor.field); \ | 177 | return sprintf(buf, format_string, udev->descriptor.field); \ |
178 | } \ | 178 | } \ |
179 | static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL); | 179 | static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL); |
180 | 180 | ||
181 | usb_descriptor_attr (bDeviceClass, "%02x\n") | 181 | usb_descriptor_attr(bDeviceClass, "%02x\n") |
182 | usb_descriptor_attr (bDeviceSubClass, "%02x\n") | 182 | usb_descriptor_attr(bDeviceSubClass, "%02x\n") |
183 | usb_descriptor_attr (bDeviceProtocol, "%02x\n") | 183 | usb_descriptor_attr(bDeviceProtocol, "%02x\n") |
184 | usb_descriptor_attr (bNumConfigurations, "%d\n") | 184 | usb_descriptor_attr(bNumConfigurations, "%d\n") |
185 | usb_descriptor_attr (bMaxPacketSize0, "%d\n") | 185 | usb_descriptor_attr(bMaxPacketSize0, "%d\n") |
186 | 186 | ||
187 | static struct attribute *dev_attrs[] = { | 187 | static struct attribute *dev_attrs[] = { |
188 | /* current configuration's attributes */ | 188 | /* current configuration's attributes */ |
@@ -220,17 +220,17 @@ int usb_create_sysfs_dev_files(struct usb_device *udev) | |||
220 | return retval; | 220 | return retval; |
221 | 221 | ||
222 | if (udev->manufacturer) { | 222 | if (udev->manufacturer) { |
223 | retval = device_create_file (dev, &dev_attr_manufacturer); | 223 | retval = device_create_file(dev, &dev_attr_manufacturer); |
224 | if (retval) | 224 | if (retval) |
225 | goto error; | 225 | goto error; |
226 | } | 226 | } |
227 | if (udev->product) { | 227 | if (udev->product) { |
228 | retval = device_create_file (dev, &dev_attr_product); | 228 | retval = device_create_file(dev, &dev_attr_product); |
229 | if (retval) | 229 | if (retval) |
230 | goto error; | 230 | goto error; |
231 | } | 231 | } |
232 | if (udev->serial) { | 232 | if (udev->serial) { |
233 | retval = device_create_file (dev, &dev_attr_serial); | 233 | retval = device_create_file(dev, &dev_attr_serial); |
234 | if (retval) | 234 | if (retval) |
235 | goto error; | 235 | goto error; |
236 | } | 236 | } |
@@ -246,7 +246,7 @@ error: | |||
246 | return retval; | 246 | return retval; |
247 | } | 247 | } |
248 | 248 | ||
249 | void usb_remove_sysfs_dev_files (struct usb_device *udev) | 249 | void usb_remove_sysfs_dev_files(struct usb_device *udev) |
250 | { | 250 | { |
251 | struct device *dev = &udev->dev; | 251 | struct device *dev = &udev->dev; |
252 | 252 | ||
@@ -264,22 +264,22 @@ void usb_remove_sysfs_dev_files (struct usb_device *udev) | |||
264 | /* Interface fields */ | 264 | /* Interface fields */ |
265 | #define usb_intf_attr(field, format_string) \ | 265 | #define usb_intf_attr(field, format_string) \ |
266 | static ssize_t \ | 266 | static ssize_t \ |
267 | show_##field (struct device *dev, struct device_attribute *attr, \ | 267 | show_##field(struct device *dev, struct device_attribute *attr, \ |
268 | char *buf) \ | 268 | char *buf) \ |
269 | { \ | 269 | { \ |
270 | struct usb_interface *intf = to_usb_interface (dev); \ | 270 | struct usb_interface *intf = to_usb_interface(dev); \ |
271 | \ | 271 | \ |
272 | return sprintf (buf, format_string, \ | 272 | return sprintf(buf, format_string, \ |
273 | intf->cur_altsetting->desc.field); \ | 273 | intf->cur_altsetting->desc.field); \ |
274 | } \ | 274 | } \ |
275 | static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL); | 275 | static DEVICE_ATTR(field, S_IRUGO, show_##field, NULL); |
276 | 276 | ||
277 | usb_intf_attr (bInterfaceNumber, "%02x\n") | 277 | usb_intf_attr(bInterfaceNumber, "%02x\n") |
278 | usb_intf_attr (bAlternateSetting, "%2d\n") | 278 | usb_intf_attr(bAlternateSetting, "%2d\n") |
279 | usb_intf_attr (bNumEndpoints, "%02x\n") | 279 | usb_intf_attr(bNumEndpoints, "%02x\n") |
280 | usb_intf_attr (bInterfaceClass, "%02x\n") | 280 | usb_intf_attr(bInterfaceClass, "%02x\n") |
281 | usb_intf_attr (bInterfaceSubClass, "%02x\n") | 281 | usb_intf_attr(bInterfaceSubClass, "%02x\n") |
282 | usb_intf_attr (bInterfaceProtocol, "%02x\n") | 282 | usb_intf_attr(bInterfaceProtocol, "%02x\n") |
283 | 283 | ||
284 | static ssize_t show_interface_string(struct device *dev, | 284 | static ssize_t show_interface_string(struct device *dev, |
285 | struct device_attribute *attr, char *buf) | 285 | struct device_attribute *attr, char *buf) |
@@ -288,8 +288,8 @@ static ssize_t show_interface_string(struct device *dev, | |||
288 | struct usb_device *udev; | 288 | struct usb_device *udev; |
289 | int len; | 289 | int len; |
290 | 290 | ||
291 | intf = to_usb_interface (dev); | 291 | intf = to_usb_interface(dev); |
292 | udev = interface_to_usbdev (intf); | 292 | udev = interface_to_usbdev(intf); |
293 | len = snprintf(buf, 256, "%s", intf->cur_altsetting->string); | 293 | len = snprintf(buf, 256, "%s", intf->cur_altsetting->string); |
294 | if (len < 0) | 294 | if (len < 0) |
295 | return 0; | 295 | return 0; |
@@ -384,7 +384,7 @@ error: | |||
384 | return retval; | 384 | return retval; |
385 | } | 385 | } |
386 | 386 | ||
387 | void usb_remove_sysfs_intf_files (struct usb_interface *intf) | 387 | void usb_remove_sysfs_intf_files(struct usb_interface *intf) |
388 | { | 388 | { |
389 | usb_remove_intf_ep_files(intf); | 389 | usb_remove_intf_ep_files(intf); |
390 | sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp); | 390 | sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp); |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 9801d08edacf..94ea9727ff55 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -235,16 +235,15 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
235 | 235 | ||
236 | urb->status = -EINPROGRESS; | 236 | urb->status = -EINPROGRESS; |
237 | urb->actual_length = 0; | 237 | urb->actual_length = 0; |
238 | urb->bandwidth = 0; | ||
239 | 238 | ||
240 | /* Lots of sanity checks, so HCDs can rely on clean data | 239 | /* Lots of sanity checks, so HCDs can rely on clean data |
241 | * and don't need to duplicate tests | 240 | * and don't need to duplicate tests |
242 | */ | 241 | */ |
243 | pipe = urb->pipe; | 242 | pipe = urb->pipe; |
244 | temp = usb_pipetype (pipe); | 243 | temp = usb_pipetype(pipe); |
245 | is_out = usb_pipeout (pipe); | 244 | is_out = usb_pipeout(pipe); |
246 | 245 | ||
247 | if (!usb_pipecontrol (pipe) && dev->state < USB_STATE_CONFIGURED) | 246 | if (!usb_pipecontrol(pipe) && dev->state < USB_STATE_CONFIGURED) |
248 | return -ENODEV; | 247 | return -ENODEV; |
249 | 248 | ||
250 | /* FIXME there should be a sharable lock protecting us against | 249 | /* FIXME there should be a sharable lock protecting us against |
@@ -253,11 +252,11 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
253 | * checks get made.) | 252 | * checks get made.) |
254 | */ | 253 | */ |
255 | 254 | ||
256 | max = usb_maxpacket (dev, pipe, is_out); | 255 | max = usb_maxpacket(dev, pipe, is_out); |
257 | if (max <= 0) { | 256 | if (max <= 0) { |
258 | dev_dbg(&dev->dev, | 257 | dev_dbg(&dev->dev, |
259 | "bogus endpoint ep%d%s in %s (bad maxpacket %d)\n", | 258 | "bogus endpoint ep%d%s in %s (bad maxpacket %d)\n", |
260 | usb_pipeendpoint (pipe), is_out ? "out" : "in", | 259 | usb_pipeendpoint(pipe), is_out ? "out" : "in", |
261 | __FUNCTION__, max); | 260 | __FUNCTION__, max); |
262 | return -EMSGSIZE; | 261 | return -EMSGSIZE; |
263 | } | 262 | } |
@@ -279,11 +278,11 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
279 | if (urb->number_of_packets <= 0) | 278 | if (urb->number_of_packets <= 0) |
280 | return -EINVAL; | 279 | return -EINVAL; |
281 | for (n = 0; n < urb->number_of_packets; n++) { | 280 | for (n = 0; n < urb->number_of_packets; n++) { |
282 | len = urb->iso_frame_desc [n].length; | 281 | len = urb->iso_frame_desc[n].length; |
283 | if (len < 0 || len > max) | 282 | if (len < 0 || len > max) |
284 | return -EMSGSIZE; | 283 | return -EMSGSIZE; |
285 | urb->iso_frame_desc [n].status = -EXDEV; | 284 | urb->iso_frame_desc[n].status = -EXDEV; |
286 | urb->iso_frame_desc [n].actual_length = 0; | 285 | urb->iso_frame_desc[n].actual_length = 0; |
287 | } | 286 | } |
288 | } | 287 | } |
289 | 288 | ||
@@ -322,7 +321,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
322 | 321 | ||
323 | /* fail if submitter gave bogus flags */ | 322 | /* fail if submitter gave bogus flags */ |
324 | if (urb->transfer_flags != orig_flags) { | 323 | if (urb->transfer_flags != orig_flags) { |
325 | err ("BOGUS urb flags, %x --> %x", | 324 | err("BOGUS urb flags, %x --> %x", |
326 | orig_flags, urb->transfer_flags); | 325 | orig_flags, urb->transfer_flags); |
327 | return -EINVAL; | 326 | return -EINVAL; |
328 | } | 327 | } |
@@ -373,7 +372,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
373 | urb->interval = temp; | 372 | urb->interval = temp; |
374 | } | 373 | } |
375 | 374 | ||
376 | return usb_hcd_submit_urb (urb, mem_flags); | 375 | return usb_hcd_submit_urb(urb, mem_flags); |
377 | } | 376 | } |
378 | 377 | ||
379 | /*-------------------------------------------------------------------*/ | 378 | /*-------------------------------------------------------------------*/ |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 02426d0b9a34..3db721cd557a 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -233,7 +233,7 @@ static void usb_autosuspend_work(struct work_struct *work) | |||
233 | * @parent: hub to which device is connected; null to allocate a root hub | 233 | * @parent: hub to which device is connected; null to allocate a root hub |
234 | * @bus: bus used to access the device | 234 | * @bus: bus used to access the device |
235 | * @port1: one-based index of port; ignored for root hubs | 235 | * @port1: one-based index of port; ignored for root hubs |
236 | * Context: !in_interrupt () | 236 | * Context: !in_interrupt() |
237 | * | 237 | * |
238 | * Only hub drivers (including virtual root hub drivers for host | 238 | * Only hub drivers (including virtual root hub drivers for host |
239 | * controllers) should ever call this. | 239 | * controllers) should ever call this. |
@@ -277,22 +277,22 @@ usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus, unsigned port1) | |||
277 | * as stable: bus->busnum changes easily from modprobe order, | 277 | * as stable: bus->busnum changes easily from modprobe order, |
278 | * cardbus or pci hotplugging, and so on. | 278 | * cardbus or pci hotplugging, and so on. |
279 | */ | 279 | */ |
280 | if (unlikely (!parent)) { | 280 | if (unlikely(!parent)) { |
281 | dev->devpath [0] = '0'; | 281 | dev->devpath[0] = '0'; |
282 | 282 | ||
283 | dev->dev.parent = bus->controller; | 283 | dev->dev.parent = bus->controller; |
284 | sprintf (&dev->dev.bus_id[0], "usb%d", bus->busnum); | 284 | sprintf(&dev->dev.bus_id[0], "usb%d", bus->busnum); |
285 | } else { | 285 | } else { |
286 | /* match any labeling on the hubs; it's one-based */ | 286 | /* match any labeling on the hubs; it's one-based */ |
287 | if (parent->devpath [0] == '0') | 287 | if (parent->devpath[0] == '0') |
288 | snprintf (dev->devpath, sizeof dev->devpath, | 288 | snprintf(dev->devpath, sizeof dev->devpath, |
289 | "%d", port1); | 289 | "%d", port1); |
290 | else | 290 | else |
291 | snprintf (dev->devpath, sizeof dev->devpath, | 291 | snprintf(dev->devpath, sizeof dev->devpath, |
292 | "%s.%d", parent->devpath, port1); | 292 | "%s.%d", parent->devpath, port1); |
293 | 293 | ||
294 | dev->dev.parent = &parent->dev; | 294 | dev->dev.parent = &parent->dev; |
295 | sprintf (&dev->dev.bus_id[0], "%d-%s", | 295 | sprintf(&dev->dev.bus_id[0], "%d-%s", |
296 | bus->busnum, dev->devpath); | 296 | bus->busnum, dev->devpath); |
297 | 297 | ||
298 | /* hub driver sets up TT records */ | 298 | /* hub driver sets up TT records */ |
@@ -463,7 +463,7 @@ static struct usb_device *match_device(struct usb_device *dev, | |||
463 | /* see if this device matches */ | 463 | /* see if this device matches */ |
464 | if ((vendor_id == le16_to_cpu(dev->descriptor.idVendor)) && | 464 | if ((vendor_id == le16_to_cpu(dev->descriptor.idVendor)) && |
465 | (product_id == le16_to_cpu(dev->descriptor.idProduct))) { | 465 | (product_id == le16_to_cpu(dev->descriptor.idProduct))) { |
466 | dev_dbg (&dev->dev, "matched this device!\n"); | 466 | dev_dbg(&dev->dev, "matched this device!\n"); |
467 | ret_dev = usb_get_dev(dev); | 467 | ret_dev = usb_get_dev(dev); |
468 | goto exit; | 468 | goto exit; |
469 | } | 469 | } |
@@ -535,7 +535,7 @@ exit: | |||
535 | */ | 535 | */ |
536 | int usb_get_current_frame_number(struct usb_device *dev) | 536 | int usb_get_current_frame_number(struct usb_device *dev) |
537 | { | 537 | { |
538 | return usb_hcd_get_frame_number (dev); | 538 | return usb_hcd_get_frame_number(dev); |
539 | } | 539 | } |
540 | 540 | ||
541 | /*-------------------------------------------------------------------*/ | 541 | /*-------------------------------------------------------------------*/ |
@@ -593,7 +593,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, | |||
593 | * | 593 | * |
594 | * When the buffer is no longer used, free it with usb_buffer_free(). | 594 | * When the buffer is no longer used, free it with usb_buffer_free(). |
595 | */ | 595 | */ |
596 | void *usb_buffer_alloc ( | 596 | void *usb_buffer_alloc( |
597 | struct usb_device *dev, | 597 | struct usb_device *dev, |
598 | size_t size, | 598 | size_t size, |
599 | gfp_t mem_flags, | 599 | gfp_t mem_flags, |
@@ -602,7 +602,7 @@ void *usb_buffer_alloc ( | |||
602 | { | 602 | { |
603 | if (!dev || !dev->bus) | 603 | if (!dev || !dev->bus) |
604 | return NULL; | 604 | return NULL; |
605 | return hcd_buffer_alloc (dev->bus, size, mem_flags, dma); | 605 | return hcd_buffer_alloc(dev->bus, size, mem_flags, dma); |
606 | } | 606 | } |
607 | 607 | ||
608 | /** | 608 | /** |
@@ -616,7 +616,7 @@ void *usb_buffer_alloc ( | |||
616 | * been allocated using usb_buffer_alloc(), and the parameters must match | 616 | * been allocated using usb_buffer_alloc(), and the parameters must match |
617 | * those provided in that allocation request. | 617 | * those provided in that allocation request. |
618 | */ | 618 | */ |
619 | void usb_buffer_free ( | 619 | void usb_buffer_free( |
620 | struct usb_device *dev, | 620 | struct usb_device *dev, |
621 | size_t size, | 621 | size_t size, |
622 | void *addr, | 622 | void *addr, |
@@ -627,7 +627,7 @@ void usb_buffer_free ( | |||
627 | return; | 627 | return; |
628 | if (!addr) | 628 | if (!addr) |
629 | return; | 629 | return; |
630 | hcd_buffer_free (dev->bus, size, addr, dma); | 630 | hcd_buffer_free(dev->bus, size, addr, dma); |
631 | } | 631 | } |
632 | 632 | ||
633 | /** | 633 | /** |
@@ -647,7 +647,7 @@ void usb_buffer_free ( | |||
647 | * Reverse the effect of this call with usb_buffer_unmap(). | 647 | * Reverse the effect of this call with usb_buffer_unmap(). |
648 | */ | 648 | */ |
649 | #if 0 | 649 | #if 0 |
650 | struct urb *usb_buffer_map (struct urb *urb) | 650 | struct urb *usb_buffer_map(struct urb *urb) |
651 | { | 651 | { |
652 | struct usb_bus *bus; | 652 | struct usb_bus *bus; |
653 | struct device *controller; | 653 | struct device *controller; |
@@ -659,14 +659,14 @@ struct urb *usb_buffer_map (struct urb *urb) | |||
659 | return NULL; | 659 | return NULL; |
660 | 660 | ||
661 | if (controller->dma_mask) { | 661 | if (controller->dma_mask) { |
662 | urb->transfer_dma = dma_map_single (controller, | 662 | urb->transfer_dma = dma_map_single(controller, |
663 | urb->transfer_buffer, urb->transfer_buffer_length, | 663 | urb->transfer_buffer, urb->transfer_buffer_length, |
664 | usb_pipein (urb->pipe) | 664 | usb_pipein(urb->pipe) |
665 | ? DMA_FROM_DEVICE : DMA_TO_DEVICE); | 665 | ? DMA_FROM_DEVICE : DMA_TO_DEVICE); |
666 | if (usb_pipecontrol (urb->pipe)) | 666 | if (usb_pipecontrol(urb->pipe)) |
667 | urb->setup_dma = dma_map_single (controller, | 667 | urb->setup_dma = dma_map_single(controller, |
668 | urb->setup_packet, | 668 | urb->setup_packet, |
669 | sizeof (struct usb_ctrlrequest), | 669 | sizeof(struct usb_ctrlrequest), |
670 | DMA_TO_DEVICE); | 670 | DMA_TO_DEVICE); |
671 | // FIXME generic api broken like pci, can't report errors | 671 | // FIXME generic api broken like pci, can't report errors |
672 | // if (urb->transfer_dma == DMA_ADDR_INVALID) return 0; | 672 | // if (urb->transfer_dma == DMA_ADDR_INVALID) return 0; |
@@ -689,7 +689,7 @@ struct urb *usb_buffer_map (struct urb *urb) | |||
689 | * usb_buffer_dmasync - synchronize DMA and CPU view of buffer(s) | 689 | * usb_buffer_dmasync - synchronize DMA and CPU view of buffer(s) |
690 | * @urb: urb whose transfer_buffer/setup_packet will be synchronized | 690 | * @urb: urb whose transfer_buffer/setup_packet will be synchronized |
691 | */ | 691 | */ |
692 | void usb_buffer_dmasync (struct urb *urb) | 692 | void usb_buffer_dmasync(struct urb *urb) |
693 | { | 693 | { |
694 | struct usb_bus *bus; | 694 | struct usb_bus *bus; |
695 | struct device *controller; | 695 | struct device *controller; |
@@ -702,14 +702,14 @@ void usb_buffer_dmasync (struct urb *urb) | |||
702 | return; | 702 | return; |
703 | 703 | ||
704 | if (controller->dma_mask) { | 704 | if (controller->dma_mask) { |
705 | dma_sync_single (controller, | 705 | dma_sync_single(controller, |
706 | urb->transfer_dma, urb->transfer_buffer_length, | 706 | urb->transfer_dma, urb->transfer_buffer_length, |
707 | usb_pipein (urb->pipe) | 707 | usb_pipein(urb->pipe) |
708 | ? DMA_FROM_DEVICE : DMA_TO_DEVICE); | 708 | ? DMA_FROM_DEVICE : DMA_TO_DEVICE); |
709 | if (usb_pipecontrol (urb->pipe)) | 709 | if (usb_pipecontrol(urb->pipe)) |
710 | dma_sync_single (controller, | 710 | dma_sync_single(controller, |
711 | urb->setup_dma, | 711 | urb->setup_dma, |
712 | sizeof (struct usb_ctrlrequest), | 712 | sizeof(struct usb_ctrlrequest), |
713 | DMA_TO_DEVICE); | 713 | DMA_TO_DEVICE); |
714 | } | 714 | } |
715 | } | 715 | } |
@@ -722,7 +722,7 @@ void usb_buffer_dmasync (struct urb *urb) | |||
722 | * Reverses the effect of usb_buffer_map(). | 722 | * Reverses the effect of usb_buffer_map(). |
723 | */ | 723 | */ |
724 | #if 0 | 724 | #if 0 |
725 | void usb_buffer_unmap (struct urb *urb) | 725 | void usb_buffer_unmap(struct urb *urb) |
726 | { | 726 | { |
727 | struct usb_bus *bus; | 727 | struct usb_bus *bus; |
728 | struct device *controller; | 728 | struct device *controller; |
@@ -735,14 +735,14 @@ void usb_buffer_unmap (struct urb *urb) | |||
735 | return; | 735 | return; |
736 | 736 | ||
737 | if (controller->dma_mask) { | 737 | if (controller->dma_mask) { |
738 | dma_unmap_single (controller, | 738 | dma_unmap_single(controller, |
739 | urb->transfer_dma, urb->transfer_buffer_length, | 739 | urb->transfer_dma, urb->transfer_buffer_length, |
740 | usb_pipein (urb->pipe) | 740 | usb_pipein(urb->pipe) |
741 | ? DMA_FROM_DEVICE : DMA_TO_DEVICE); | 741 | ? DMA_FROM_DEVICE : DMA_TO_DEVICE); |
742 | if (usb_pipecontrol (urb->pipe)) | 742 | if (usb_pipecontrol(urb->pipe)) |
743 | dma_unmap_single (controller, | 743 | dma_unmap_single(controller, |
744 | urb->setup_dma, | 744 | urb->setup_dma, |
745 | sizeof (struct usb_ctrlrequest), | 745 | sizeof(struct usb_ctrlrequest), |
746 | DMA_TO_DEVICE); | 746 | DMA_TO_DEVICE); |
747 | } | 747 | } |
748 | urb->transfer_flags &= ~(URB_NO_TRANSFER_DMA_MAP | 748 | urb->transfer_flags &= ~(URB_NO_TRANSFER_DMA_MAP |
@@ -783,15 +783,15 @@ int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe, | |||
783 | struct device *controller; | 783 | struct device *controller; |
784 | 784 | ||
785 | if (!dev | 785 | if (!dev |
786 | || usb_pipecontrol (pipe) | 786 | || usb_pipecontrol(pipe) |
787 | || !(bus = dev->bus) | 787 | || !(bus = dev->bus) |
788 | || !(controller = bus->controller) | 788 | || !(controller = bus->controller) |
789 | || !controller->dma_mask) | 789 | || !controller->dma_mask) |
790 | return -1; | 790 | return -1; |
791 | 791 | ||
792 | // FIXME generic api broken like pci, can't report errors | 792 | // FIXME generic api broken like pci, can't report errors |
793 | return dma_map_sg (controller, sg, nents, | 793 | return dma_map_sg(controller, sg, nents, |
794 | usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); | 794 | usb_pipein(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); |
795 | } | 795 | } |
796 | 796 | ||
797 | /* XXX DISABLED, no users currently. If you wish to re-enable this | 797 | /* XXX DISABLED, no users currently. If you wish to re-enable this |
@@ -823,8 +823,8 @@ void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe, | |||
823 | || !controller->dma_mask) | 823 | || !controller->dma_mask) |
824 | return; | 824 | return; |
825 | 825 | ||
826 | dma_sync_sg (controller, sg, n_hw_ents, | 826 | dma_sync_sg(controller, sg, n_hw_ents, |
827 | usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); | 827 | usb_pipein(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); |
828 | } | 828 | } |
829 | #endif | 829 | #endif |
830 | 830 | ||
@@ -849,8 +849,8 @@ void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe, | |||
849 | || !controller->dma_mask) | 849 | || !controller->dma_mask) |
850 | return; | 850 | return; |
851 | 851 | ||
852 | dma_unmap_sg (controller, sg, n_hw_ents, | 852 | dma_unmap_sg(controller, sg, n_hw_ents, |
853 | usb_pipein (pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); | 853 | usb_pipein(pipe) ? DMA_FROM_DEVICE : DMA_TO_DEVICE); |
854 | } | 854 | } |
855 | 855 | ||
856 | /* format to disable USB on kernel command line is: nousb */ | 856 | /* format to disable USB on kernel command line is: nousb */ |
@@ -871,7 +871,7 @@ static int __init usb_init(void) | |||
871 | { | 871 | { |
872 | int retval; | 872 | int retval; |
873 | if (nousb) { | 873 | if (nousb) { |
874 | pr_info ("%s: USB support disabled\n", usbcore_name); | 874 | pr_info("%s: USB support disabled\n", usbcore_name); |
875 | return 0; | 875 | return 0; |
876 | } | 876 | } |
877 | 877 | ||
@@ -971,19 +971,19 @@ EXPORT_SYMBOL(__usb_get_extra_descriptor); | |||
971 | EXPORT_SYMBOL(usb_find_device); | 971 | EXPORT_SYMBOL(usb_find_device); |
972 | EXPORT_SYMBOL(usb_get_current_frame_number); | 972 | EXPORT_SYMBOL(usb_get_current_frame_number); |
973 | 973 | ||
974 | EXPORT_SYMBOL (usb_buffer_alloc); | 974 | EXPORT_SYMBOL(usb_buffer_alloc); |
975 | EXPORT_SYMBOL (usb_buffer_free); | 975 | EXPORT_SYMBOL(usb_buffer_free); |
976 | 976 | ||
977 | #if 0 | 977 | #if 0 |
978 | EXPORT_SYMBOL (usb_buffer_map); | 978 | EXPORT_SYMBOL(usb_buffer_map); |
979 | EXPORT_SYMBOL (usb_buffer_dmasync); | 979 | EXPORT_SYMBOL(usb_buffer_dmasync); |
980 | EXPORT_SYMBOL (usb_buffer_unmap); | 980 | EXPORT_SYMBOL(usb_buffer_unmap); |
981 | #endif | 981 | #endif |
982 | 982 | ||
983 | EXPORT_SYMBOL (usb_buffer_map_sg); | 983 | EXPORT_SYMBOL(usb_buffer_map_sg); |
984 | #if 0 | 984 | #if 0 |
985 | EXPORT_SYMBOL (usb_buffer_dmasync_sg); | 985 | EXPORT_SYMBOL(usb_buffer_dmasync_sg); |
986 | #endif | 986 | #endif |
987 | EXPORT_SYMBOL (usb_buffer_unmap_sg); | 987 | EXPORT_SYMBOL(usb_buffer_unmap_sg); |
988 | 988 | ||
989 | MODULE_LICENSE("GPL"); | 989 | MODULE_LICENSE("GPL"); |