diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-30 18:21:33 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-01 17:35:08 -0500 |
commit | 2c044a4803804708984931bcbd03314732e995d5 (patch) | |
tree | cdc71cc31b21d180df7752ebafb8b8b869b26f0c | |
parent | 3e35bf39e0b9091d47a40e26fc2704b3b24e1ec4 (diff) |
USB: fix codingstyle issues in drivers/usb/core/*.c
Fixes a number of coding style issues in the remaining .c files in
drivers/usb/core/
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/core/buffer.c | 11 | ||||
-rw-r--r-- | drivers/usb/core/config.c | 14 | ||||
-rw-r--r-- | drivers/usb/core/driver.c | 30 | ||||
-rw-r--r-- | drivers/usb/core/sysfs.c | 20 | ||||
-rw-r--r-- | drivers/usb/core/urb.c | 22 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 51 |
6 files changed, 74 insertions, 74 deletions
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index acd9f00a0b76..cadb2dc1d28a 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c | |||
@@ -57,8 +57,9 @@ int hcd_buffer_create(struct usb_hcd *hcd) | |||
57 | !(hcd->driver->flags & HCD_LOCAL_MEM)) | 57 | !(hcd->driver->flags & HCD_LOCAL_MEM)) |
58 | return 0; | 58 | return 0; |
59 | 59 | ||
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 | size = pool_max[i]; |
62 | if (!size) | ||
62 | continue; | 63 | continue; |
63 | snprintf(name, sizeof name, "buffer-%d", size); | 64 | snprintf(name, sizeof name, "buffer-%d", size); |
64 | hcd->pool[i] = dma_pool_create(name, hcd->self.controller, | 65 | hcd->pool[i] = dma_pool_create(name, hcd->self.controller, |
@@ -81,10 +82,10 @@ int hcd_buffer_create(struct usb_hcd *hcd) | |||
81 | */ | 82 | */ |
82 | void hcd_buffer_destroy(struct usb_hcd *hcd) | 83 | void hcd_buffer_destroy(struct usb_hcd *hcd) |
83 | { | 84 | { |
84 | int i; | 85 | int i; |
85 | 86 | ||
86 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { | 87 | for (i = 0; i < HCD_BUFFER_POOLS; i++) { |
87 | struct dma_pool *pool = hcd->pool[i]; | 88 | struct dma_pool *pool = hcd->pool[i]; |
88 | if (pool) { | 89 | if (pool) { |
89 | dma_pool_destroy(pool); | 90 | dma_pool_destroy(pool); |
90 | hcd->pool[i] = NULL; | 91 | hcd->pool[i] = NULL; |
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 1a8edcee7f30..a92122a216bc 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -238,7 +238,7 @@ static int usb_parse_interface(struct device *ddev, int cfgno, | |||
238 | 238 | ||
239 | /* Allocate space for the right(?) number of endpoints */ | 239 | /* Allocate space for the right(?) number of endpoints */ |
240 | num_ep = num_ep_orig = alt->desc.bNumEndpoints; | 240 | num_ep = num_ep_orig = alt->desc.bNumEndpoints; |
241 | alt->desc.bNumEndpoints = 0; // Use as a counter | 241 | alt->desc.bNumEndpoints = 0; /* Use as a counter */ |
242 | if (num_ep > USB_MAXENDPOINTS) { | 242 | if (num_ep > USB_MAXENDPOINTS) { |
243 | dev_warn(ddev, "too many endpoints for config %d interface %d " | 243 | dev_warn(ddev, "too many endpoints for config %d interface %d " |
244 | "altsetting %d: %d, using maximum allowed: %d\n", | 244 | "altsetting %d: %d, using maximum allowed: %d\n", |
@@ -246,7 +246,8 @@ static int usb_parse_interface(struct device *ddev, int cfgno, | |||
246 | num_ep = USB_MAXENDPOINTS; | 246 | num_ep = USB_MAXENDPOINTS; |
247 | } | 247 | } |
248 | 248 | ||
249 | if (num_ep > 0) { /* Can't allocate 0 bytes */ | 249 | if (num_ep > 0) { |
250 | /* Can't allocate 0 bytes */ | ||
250 | len = sizeof(struct usb_host_endpoint) * num_ep; | 251 | len = sizeof(struct usb_host_endpoint) * num_ep; |
251 | alt->endpoint = kzalloc(len, GFP_KERNEL); | 252 | alt->endpoint = kzalloc(len, GFP_KERNEL); |
252 | if (!alt->endpoint) | 253 | if (!alt->endpoint) |
@@ -475,8 +476,9 @@ static int usb_parse_configuration(struct device *ddev, int cfgidx, | |||
475 | return 0; | 476 | return 0; |
476 | } | 477 | } |
477 | 478 | ||
478 | // hub-only!! ... and only exported for reset/reinit path. | 479 | /* hub-only!! ... and only exported for reset/reinit path. |
479 | // otherwise used internally on disconnect/destroy path | 480 | * otherwise used internally on disconnect/destroy path |
481 | */ | ||
480 | void usb_destroy_configuration(struct usb_device *dev) | 482 | void usb_destroy_configuration(struct usb_device *dev) |
481 | { | 483 | { |
482 | int c, i; | 484 | int c, i; |
@@ -498,7 +500,7 @@ void usb_destroy_configuration(struct usb_device *dev) | |||
498 | kfree(cf->string); | 500 | kfree(cf->string); |
499 | for (i = 0; i < cf->desc.bNumInterfaces; i++) { | 501 | for (i = 0; i < cf->desc.bNumInterfaces; i++) { |
500 | if (cf->intf_cache[i]) | 502 | if (cf->intf_cache[i]) |
501 | kref_put(&cf->intf_cache[i]->ref, | 503 | kref_put(&cf->intf_cache[i]->ref, |
502 | usb_release_interface_cache); | 504 | usb_release_interface_cache); |
503 | } | 505 | } |
504 | } | 506 | } |
@@ -525,7 +527,7 @@ int usb_get_configuration(struct usb_device *dev) | |||
525 | unsigned int cfgno, length; | 527 | unsigned int cfgno, length; |
526 | unsigned char *buffer; | 528 | unsigned char *buffer; |
527 | unsigned char *bigbuffer; | 529 | unsigned char *bigbuffer; |
528 | struct usb_config_descriptor *desc; | 530 | struct usb_config_descriptor *desc; |
529 | 531 | ||
530 | cfgno = 0; | 532 | cfgno = 0; |
531 | if (dev->authorized == 0) /* Not really an error */ | 533 | if (dev->authorized == 0) /* Not really an error */ |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 7e7f2c42494c..801b6f142fa7 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -202,10 +202,10 @@ static int usb_probe_interface(struct device *dev) | |||
202 | intf = to_usb_interface(dev); | 202 | intf = to_usb_interface(dev); |
203 | udev = interface_to_usbdev(intf); | 203 | udev = interface_to_usbdev(intf); |
204 | 204 | ||
205 | if (udev->authorized == 0) { | 205 | if (udev->authorized == 0) { |
206 | dev_err(&intf->dev, "Device is not authorized for usage\n"); | 206 | dev_err(&intf->dev, "Device is not authorized for usage\n"); |
207 | return -ENODEV; | 207 | return -ENODEV; |
208 | } | 208 | } |
209 | 209 | ||
210 | id = usb_match_id(intf, driver->id_table); | 210 | id = usb_match_id(intf, driver->id_table); |
211 | if (!id) | 211 | if (!id) |
@@ -299,7 +299,7 @@ static int usb_unbind_interface(struct device *dev) | |||
299 | * lock. | 299 | * lock. |
300 | */ | 300 | */ |
301 | int usb_driver_claim_interface(struct usb_driver *driver, | 301 | int usb_driver_claim_interface(struct usb_driver *driver, |
302 | struct usb_interface *iface, void* priv) | 302 | struct usb_interface *iface, void *priv) |
303 | { | 303 | { |
304 | struct device *dev = &iface->dev; | 304 | struct device *dev = &iface->dev; |
305 | struct usb_device *udev = interface_to_usbdev(iface); | 305 | struct usb_device *udev = interface_to_usbdev(iface); |
@@ -398,7 +398,7 @@ int usb_match_device(struct usb_device *dev, const struct usb_device_id *id) | |||
398 | return 0; | 398 | return 0; |
399 | 399 | ||
400 | if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) && | 400 | if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_SUBCLASS) && |
401 | (id->bDeviceSubClass!= dev->descriptor.bDeviceSubClass)) | 401 | (id->bDeviceSubClass != dev->descriptor.bDeviceSubClass)) |
402 | return 0; | 402 | return 0; |
403 | 403 | ||
404 | if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && | 404 | if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_PROTOCOL) && |
@@ -586,7 +586,7 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
586 | struct usb_device *usb_dev; | 586 | struct usb_device *usb_dev; |
587 | 587 | ||
588 | /* driver is often null here; dev_dbg() would oops */ | 588 | /* driver is often null here; dev_dbg() would oops */ |
589 | pr_debug ("usb %s: uevent\n", dev->bus_id); | 589 | pr_debug("usb %s: uevent\n", dev->bus_id); |
590 | 590 | ||
591 | if (is_usb_device(dev)) | 591 | if (is_usb_device(dev)) |
592 | usb_dev = to_usb_device(dev); | 592 | usb_dev = to_usb_device(dev); |
@@ -596,11 +596,11 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
596 | } | 596 | } |
597 | 597 | ||
598 | if (usb_dev->devnum < 0) { | 598 | if (usb_dev->devnum < 0) { |
599 | pr_debug ("usb %s: already deleted?\n", dev->bus_id); | 599 | pr_debug("usb %s: already deleted?\n", dev->bus_id); |
600 | return -ENODEV; | 600 | return -ENODEV; |
601 | } | 601 | } |
602 | if (!usb_dev->bus) { | 602 | if (!usb_dev->bus) { |
603 | pr_debug ("usb %s: bus removed?\n", dev->bus_id); | 603 | pr_debug("usb %s: bus removed?\n", dev->bus_id); |
604 | return -ENODEV; | 604 | return -ENODEV; |
605 | } | 605 | } |
606 | 606 | ||
@@ -854,8 +854,10 @@ static int usb_suspend_interface(struct usb_interface *intf, pm_message_t msg) | |||
854 | dev_err(&intf->dev, "%s error %d\n", | 854 | dev_err(&intf->dev, "%s error %d\n", |
855 | "suspend", status); | 855 | "suspend", status); |
856 | } else { | 856 | } else { |
857 | // FIXME else if there's no suspend method, disconnect... | 857 | /* |
858 | // Not possible if auto_pm is set... | 858 | * FIXME else if there's no suspend method, disconnect... |
859 | * Not possible if auto_pm is set... | ||
860 | */ | ||
859 | dev_warn(&intf->dev, "no suspend for driver %s?\n", | 861 | dev_warn(&intf->dev, "no suspend for driver %s?\n", |
860 | driver->name); | 862 | driver->name); |
861 | mark_quiesced(intf); | 863 | mark_quiesced(intf); |
@@ -894,7 +896,7 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume) | |||
894 | dev_err(&intf->dev, "%s error %d\n", | 896 | dev_err(&intf->dev, "%s error %d\n", |
895 | "reset_resume", status); | 897 | "reset_resume", status); |
896 | } else { | 898 | } else { |
897 | // status = -EOPNOTSUPP; | 899 | /* status = -EOPNOTSUPP; */ |
898 | dev_warn(&intf->dev, "no %s for driver %s?\n", | 900 | dev_warn(&intf->dev, "no %s for driver %s?\n", |
899 | "reset_resume", driver->name); | 901 | "reset_resume", driver->name); |
900 | } | 902 | } |
@@ -905,7 +907,7 @@ static int usb_resume_interface(struct usb_interface *intf, int reset_resume) | |||
905 | dev_err(&intf->dev, "%s error %d\n", | 907 | dev_err(&intf->dev, "%s error %d\n", |
906 | "resume", status); | 908 | "resume", status); |
907 | } else { | 909 | } else { |
908 | // status = -EOPNOTSUPP; | 910 | /* status = -EOPNOTSUPP; */ |
909 | dev_warn(&intf->dev, "no %s for driver %s?\n", | 911 | dev_warn(&intf->dev, "no %s for driver %s?\n", |
910 | "resume", driver->name); | 912 | "resume", driver->name); |
911 | } | 913 | } |
@@ -1175,7 +1177,7 @@ static int usb_resume_both(struct usb_device *udev) | |||
1175 | * so if a root hub's controller is suspended | 1177 | * so if a root hub's controller is suspended |
1176 | * then we're stuck. */ | 1178 | * then we're stuck. */ |
1177 | status = usb_resume_device(udev); | 1179 | status = usb_resume_device(udev); |
1178 | } | 1180 | } |
1179 | } else { | 1181 | } else { |
1180 | 1182 | ||
1181 | /* Needed for setting udev->dev.power.power_state.event, | 1183 | /* Needed for setting udev->dev.power.power_state.event, |
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index 021b1d37462c..a37ccbd1e007 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -72,7 +72,7 @@ set_bConfigurationValue(struct device *dev, struct device_attribute *attr, | |||
72 | return (value < 0) ? value : count; | 72 | return (value < 0) ? value : count; |
73 | } | 73 | } |
74 | 74 | ||
75 | static DEVICE_ATTR(bConfigurationValue, S_IRUGO | S_IWUSR, | 75 | static DEVICE_ATTR(bConfigurationValue, S_IRUGO | S_IWUSR, |
76 | show_bConfigurationValue, set_bConfigurationValue); | 76 | show_bConfigurationValue, set_bConfigurationValue); |
77 | 77 | ||
78 | /* String fields */ | 78 | /* String fields */ |
@@ -650,21 +650,21 @@ void usb_remove_sysfs_dev_files(struct usb_device *udev) | |||
650 | /* Interface Accociation Descriptor fields */ | 650 | /* Interface Accociation Descriptor fields */ |
651 | #define usb_intf_assoc_attr(field, format_string) \ | 651 | #define usb_intf_assoc_attr(field, format_string) \ |
652 | static ssize_t \ | 652 | static ssize_t \ |
653 | show_iad_##field (struct device *dev, struct device_attribute *attr, \ | 653 | show_iad_##field(struct device *dev, struct device_attribute *attr, \ |
654 | char *buf) \ | 654 | char *buf) \ |
655 | { \ | 655 | { \ |
656 | struct usb_interface *intf = to_usb_interface (dev); \ | 656 | struct usb_interface *intf = to_usb_interface(dev); \ |
657 | \ | 657 | \ |
658 | return sprintf (buf, format_string, \ | 658 | return sprintf(buf, format_string, \ |
659 | intf->intf_assoc->field); \ | 659 | intf->intf_assoc->field); \ |
660 | } \ | 660 | } \ |
661 | static DEVICE_ATTR(iad_##field, S_IRUGO, show_iad_##field, NULL); | 661 | static DEVICE_ATTR(iad_##field, S_IRUGO, show_iad_##field, NULL); |
662 | 662 | ||
663 | usb_intf_assoc_attr (bFirstInterface, "%02x\n") | 663 | usb_intf_assoc_attr(bFirstInterface, "%02x\n") |
664 | usb_intf_assoc_attr (bInterfaceCount, "%02d\n") | 664 | usb_intf_assoc_attr(bInterfaceCount, "%02d\n") |
665 | usb_intf_assoc_attr (bFunctionClass, "%02x\n") | 665 | usb_intf_assoc_attr(bFunctionClass, "%02x\n") |
666 | usb_intf_assoc_attr (bFunctionSubClass, "%02x\n") | 666 | usb_intf_assoc_attr(bFunctionSubClass, "%02x\n") |
667 | usb_intf_assoc_attr (bFunctionProtocol, "%02x\n") | 667 | usb_intf_assoc_attr(bFunctionProtocol, "%02x\n") |
668 | 668 | ||
669 | /* Interface fields */ | 669 | /* Interface fields */ |
670 | #define usb_intf_attr(field, format_string) \ | 670 | #define usb_intf_attr(field, format_string) \ |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 0b54dc174e2c..9d7e63292c01 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -103,7 +103,7 @@ EXPORT_SYMBOL_GPL(usb_free_urb); | |||
103 | * | 103 | * |
104 | * A pointer to the urb with the incremented reference counter is returned. | 104 | * A pointer to the urb with the incremented reference counter is returned. |
105 | */ | 105 | */ |
106 | struct urb * usb_get_urb(struct urb *urb) | 106 | struct urb *usb_get_urb(struct urb *urb) |
107 | { | 107 | { |
108 | if (urb) | 108 | if (urb) |
109 | kref_get(&urb->kref); | 109 | kref_get(&urb->kref); |
@@ -176,7 +176,7 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb); | |||
176 | * describing that request to the USB subsystem. Request completion will | 176 | * describing that request to the USB subsystem. Request completion will |
177 | * be indicated later, asynchronously, by calling the completion handler. | 177 | * be indicated later, asynchronously, by calling the completion handler. |
178 | * The three types of completion are success, error, and unlink | 178 | * The three types of completion are success, error, and unlink |
179 | * (a software-induced fault, also called "request cancellation"). | 179 | * (a software-induced fault, also called "request cancellation"). |
180 | * | 180 | * |
181 | * URBs may be submitted in interrupt context. | 181 | * URBs may be submitted in interrupt context. |
182 | * | 182 | * |
@@ -259,7 +259,7 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb); | |||
259 | * semaphores), or | 259 | * semaphores), or |
260 | * (c) current->state != TASK_RUNNING, this is the case only after | 260 | * (c) current->state != TASK_RUNNING, this is the case only after |
261 | * you've changed it. | 261 | * you've changed it. |
262 | * | 262 | * |
263 | * GFP_NOIO is used in the block io path and error handling of storage | 263 | * GFP_NOIO is used in the block io path and error handling of storage |
264 | * devices. | 264 | * devices. |
265 | * | 265 | * |
@@ -288,7 +288,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
288 | 288 | ||
289 | if (!urb || urb->hcpriv || !urb->complete) | 289 | if (!urb || urb->hcpriv || !urb->complete) |
290 | return -EINVAL; | 290 | return -EINVAL; |
291 | if (!(dev = urb->dev) || dev->state < USB_STATE_DEFAULT) | 291 | dev = urb->dev; |
292 | if ((!dev) || (dev->state < USB_STATE_DEFAULT)) | ||
292 | return -ENODEV; | 293 | return -ENODEV; |
293 | 294 | ||
294 | /* For now, get the endpoint from the pipe. Eventually drivers | 295 | /* For now, get the endpoint from the pipe. Eventually drivers |
@@ -351,11 +352,11 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
351 | max *= mult; | 352 | max *= mult; |
352 | } | 353 | } |
353 | 354 | ||
354 | if (urb->number_of_packets <= 0) | 355 | if (urb->number_of_packets <= 0) |
355 | return -EINVAL; | 356 | return -EINVAL; |
356 | for (n = 0; n < urb->number_of_packets; n++) { | 357 | for (n = 0; n < urb->number_of_packets; n++) { |
357 | len = urb->iso_frame_desc[n].length; | 358 | len = urb->iso_frame_desc[n].length; |
358 | if (len < 0 || len > max) | 359 | if (len < 0 || len > max) |
359 | return -EMSGSIZE; | 360 | return -EMSGSIZE; |
360 | urb->iso_frame_desc[n].status = -EXDEV; | 361 | urb->iso_frame_desc[n].status = -EXDEV; |
361 | urb->iso_frame_desc[n].actual_length = 0; | 362 | urb->iso_frame_desc[n].actual_length = 0; |
@@ -420,7 +421,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
420 | /* too big? */ | 421 | /* too big? */ |
421 | switch (dev->speed) { | 422 | switch (dev->speed) { |
422 | case USB_SPEED_HIGH: /* units are microframes */ | 423 | case USB_SPEED_HIGH: /* units are microframes */ |
423 | // NOTE usb handles 2^15 | 424 | /* NOTE usb handles 2^15 */ |
424 | if (urb->interval > (1024 * 8)) | 425 | if (urb->interval > (1024 * 8)) |
425 | urb->interval = 1024 * 8; | 426 | urb->interval = 1024 * 8; |
426 | max = 1024 * 8; | 427 | max = 1024 * 8; |
@@ -430,12 +431,12 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
430 | if (xfertype == USB_ENDPOINT_XFER_INT) { | 431 | if (xfertype == USB_ENDPOINT_XFER_INT) { |
431 | if (urb->interval > 255) | 432 | if (urb->interval > 255) |
432 | return -EINVAL; | 433 | return -EINVAL; |
433 | // NOTE ohci only handles up to 32 | 434 | /* NOTE ohci only handles up to 32 */ |
434 | max = 128; | 435 | max = 128; |
435 | } else { | 436 | } else { |
436 | if (urb->interval > 1024) | 437 | if (urb->interval > 1024) |
437 | urb->interval = 1024; | 438 | urb->interval = 1024; |
438 | // NOTE usb and ohci handle up to 2^15 | 439 | /* NOTE usb and ohci handle up to 2^15 */ |
439 | max = 1024; | 440 | max = 1024; |
440 | } | 441 | } |
441 | break; | 442 | break; |
@@ -574,7 +575,8 @@ void usb_kill_anchored_urbs(struct usb_anchor *anchor) | |||
574 | 575 | ||
575 | spin_lock_irq(&anchor->lock); | 576 | spin_lock_irq(&anchor->lock); |
576 | while (!list_empty(&anchor->urb_list)) { | 577 | while (!list_empty(&anchor->urb_list)) { |
577 | victim = list_entry(anchor->urb_list.prev, struct urb, anchor_list); | 578 | victim = list_entry(anchor->urb_list.prev, struct urb, |
579 | anchor_list); | ||
578 | /* we must make sure the URB isn't freed before we kill it*/ | 580 | /* we must make sure the URB isn't freed before we kill it*/ |
579 | usb_get_urb(victim); | 581 | usb_get_urb(victim); |
580 | spin_unlock_irq(&anchor->lock); | 582 | spin_unlock_irq(&anchor->lock); |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 8c6319afa757..4e984060c984 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -116,8 +116,9 @@ EXPORT_SYMBOL_GPL(usb_ifnum_to_if); | |||
116 | * Don't call this function unless you are bound to the intf interface | 116 | * Don't call this function unless you are bound to the intf interface |
117 | * or you have locked the device! | 117 | * or you have locked the device! |
118 | */ | 118 | */ |
119 | struct usb_host_interface *usb_altnum_to_altsetting(const struct usb_interface *intf, | 119 | struct usb_host_interface *usb_altnum_to_altsetting( |
120 | unsigned int altnum) | 120 | const struct usb_interface *intf, |
121 | unsigned int altnum) | ||
121 | { | 122 | { |
122 | int i; | 123 | int i; |
123 | 124 | ||
@@ -134,7 +135,7 @@ struct find_interface_arg { | |||
134 | struct usb_interface *interface; | 135 | struct usb_interface *interface; |
135 | }; | 136 | }; |
136 | 137 | ||
137 | static int __find_interface(struct device * dev, void * data) | 138 | static int __find_interface(struct device *dev, void *data) |
138 | { | 139 | { |
139 | struct find_interface_arg *arg = data; | 140 | struct find_interface_arg *arg = data; |
140 | struct usb_interface *intf; | 141 | struct usb_interface *intf; |
@@ -156,7 +157,7 @@ static int __find_interface(struct device * dev, void * data) | |||
156 | * @drv: the driver whose current configuration is considered | 157 | * @drv: the driver whose current configuration is considered |
157 | * @minor: the minor number of the desired device | 158 | * @minor: the minor number of the desired device |
158 | * | 159 | * |
159 | * This walks the driver device list and returns a pointer to the interface | 160 | * This walks the driver device list and returns a pointer to the interface |
160 | * with the matching minor. Note, this only works for devices that share the | 161 | * with the matching minor. Note, this only works for devices that share the |
161 | * USB major number. | 162 | * USB major number. |
162 | */ | 163 | */ |
@@ -272,8 +273,8 @@ static unsigned usb_bus_is_wusb(struct usb_bus *bus) | |||
272 | * | 273 | * |
273 | * This call may not be used in a non-sleeping context. | 274 | * This call may not be used in a non-sleeping context. |
274 | */ | 275 | */ |
275 | struct usb_device * | 276 | struct usb_device *usb_alloc_dev(struct usb_device *parent, |
276 | usb_alloc_dev(struct usb_device *parent, struct usb_bus *bus, unsigned port1) | 277 | struct usb_bus *bus, unsigned port1) |
277 | { | 278 | { |
278 | struct usb_device *dev; | 279 | struct usb_device *dev; |
279 | struct usb_hcd *usb_hcd = container_of(bus, struct usb_hcd, self); | 280 | struct usb_hcd *usb_hcd = container_of(bus, struct usb_hcd, self); |
@@ -469,11 +470,11 @@ int usb_lock_device_for_reset(struct usb_device *udev, | |||
469 | return -EHOSTUNREACH; | 470 | return -EHOSTUNREACH; |
470 | if (iface) { | 471 | if (iface) { |
471 | switch (iface->condition) { | 472 | switch (iface->condition) { |
472 | case USB_INTERFACE_BINDING: | 473 | case USB_INTERFACE_BINDING: |
473 | return 0; | 474 | return 0; |
474 | case USB_INTERFACE_BOUND: | 475 | case USB_INTERFACE_BOUND: |
475 | break; | 476 | break; |
476 | default: | 477 | default: |
477 | return -EINTR; | 478 | return -EINTR; |
478 | } | 479 | } |
479 | } | 480 | } |
@@ -548,10 +549,10 @@ struct usb_device *usb_find_device(u16 vendor_id, u16 product_id) | |||
548 | struct list_head *buslist; | 549 | struct list_head *buslist; |
549 | struct usb_bus *bus; | 550 | struct usb_bus *bus; |
550 | struct usb_device *dev = NULL; | 551 | struct usb_device *dev = NULL; |
551 | 552 | ||
552 | mutex_lock(&usb_bus_list_lock); | 553 | mutex_lock(&usb_bus_list_lock); |
553 | for (buslist = usb_bus_list.next; | 554 | for (buslist = usb_bus_list.next; |
554 | buslist != &usb_bus_list; | 555 | buslist != &usb_bus_list; |
555 | buslist = buslist->next) { | 556 | buslist = buslist->next) { |
556 | bus = container_of(buslist, struct usb_bus, bus_list); | 557 | bus = container_of(buslist, struct usb_bus, bus_list); |
557 | if (!bus->root_hub) | 558 | if (!bus->root_hub) |
@@ -593,7 +594,7 @@ EXPORT_SYMBOL_GPL(usb_get_current_frame_number); | |||
593 | */ | 594 | */ |
594 | 595 | ||
595 | int __usb_get_extra_descriptor(char *buffer, unsigned size, | 596 | int __usb_get_extra_descriptor(char *buffer, unsigned size, |
596 | unsigned char type, void **ptr) | 597 | unsigned char type, void **ptr) |
597 | { | 598 | { |
598 | struct usb_descriptor_header *header; | 599 | struct usb_descriptor_header *header; |
599 | 600 | ||
@@ -604,7 +605,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size, | |||
604 | printk(KERN_ERR | 605 | printk(KERN_ERR |
605 | "%s: bogus descriptor, type %d length %d\n", | 606 | "%s: bogus descriptor, type %d length %d\n", |
606 | usbcore_name, | 607 | usbcore_name, |
607 | header->bDescriptorType, | 608 | header->bDescriptorType, |
608 | header->bLength); | 609 | header->bLength); |
609 | return -1; | 610 | return -1; |
610 | } | 611 | } |
@@ -643,12 +644,8 @@ EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor); | |||
643 | * | 644 | * |
644 | * When the buffer is no longer used, free it with usb_buffer_free(). | 645 | * When the buffer is no longer used, free it with usb_buffer_free(). |
645 | */ | 646 | */ |
646 | void *usb_buffer_alloc( | 647 | void *usb_buffer_alloc(struct usb_device *dev, size_t size, gfp_t mem_flags, |
647 | struct usb_device *dev, | 648 | dma_addr_t *dma) |
648 | size_t size, | ||
649 | gfp_t mem_flags, | ||
650 | dma_addr_t *dma | ||
651 | ) | ||
652 | { | 649 | { |
653 | if (!dev || !dev->bus) | 650 | if (!dev || !dev->bus) |
654 | return NULL; | 651 | return NULL; |
@@ -667,12 +664,8 @@ EXPORT_SYMBOL_GPL(usb_buffer_alloc); | |||
667 | * been allocated using usb_buffer_alloc(), and the parameters must match | 664 | * been allocated using usb_buffer_alloc(), and the parameters must match |
668 | * those provided in that allocation request. | 665 | * those provided in that allocation request. |
669 | */ | 666 | */ |
670 | void usb_buffer_free( | 667 | void usb_buffer_free(struct usb_device *dev, size_t size, void *addr, |
671 | struct usb_device *dev, | 668 | dma_addr_t dma) |
672 | size_t size, | ||
673 | void *addr, | ||
674 | dma_addr_t dma | ||
675 | ) | ||
676 | { | 669 | { |
677 | if (!dev || !dev->bus) | 670 | if (!dev || !dev->bus) |
678 | return; | 671 | return; |
@@ -720,8 +713,8 @@ struct urb *usb_buffer_map(struct urb *urb) | |||
720 | urb->setup_packet, | 713 | urb->setup_packet, |
721 | sizeof(struct usb_ctrlrequest), | 714 | sizeof(struct usb_ctrlrequest), |
722 | DMA_TO_DEVICE); | 715 | DMA_TO_DEVICE); |
723 | // FIXME generic api broken like pci, can't report errors | 716 | /* FIXME generic api broken like pci, can't report errors */ |
724 | // if (urb->transfer_dma == DMA_ADDR_INVALID) return 0; | 717 | /* if (urb->transfer_dma == DMA_ADDR_INVALID) return 0; */ |
725 | } else | 718 | } else |
726 | urb->transfer_dma = ~0; | 719 | urb->transfer_dma = ~0; |
727 | urb->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | 720 | urb->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP |
@@ -843,7 +836,7 @@ int usb_buffer_map_sg(const struct usb_device *dev, int is_in, | |||
843 | || !controller->dma_mask) | 836 | || !controller->dma_mask) |
844 | return -1; | 837 | return -1; |
845 | 838 | ||
846 | // FIXME generic api broken like pci, can't report errors | 839 | /* FIXME generic api broken like pci, can't report errors */ |
847 | return dma_map_sg(controller, sg, nents, | 840 | return dma_map_sg(controller, sg, nents, |
848 | is_in ? DMA_FROM_DEVICE : DMA_TO_DEVICE); | 841 | is_in ? DMA_FROM_DEVICE : DMA_TO_DEVICE); |
849 | } | 842 | } |
@@ -937,7 +930,7 @@ static int __init usb_init(void) | |||
937 | if (retval) | 930 | if (retval) |
938 | goto out; | 931 | goto out; |
939 | retval = bus_register(&usb_bus_type); | 932 | retval = bus_register(&usb_bus_type); |
940 | if (retval) | 933 | if (retval) |
941 | goto bus_register_failed; | 934 | goto bus_register_failed; |
942 | retval = usb_host_init(); | 935 | retval = usb_host_init(); |
943 | if (retval) | 936 | if (retval) |