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>

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