USB: fix codingstyle issues in drivers/usb/core/devices.c

Fixes a number of coding style issues in the devices.c file.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

+82 -72
+82 -72
drivers/usb/core/devices.c
··· 89 89 static const char *format_bandwidth = 90 90 /* B: Alloc=ddd/ddd us (xx%), #Int=ddd, #Iso=ddd */ 91 91 "B: Alloc=%3d/%3d us (%2d%%), #Int=%3d, #Iso=%3d\n"; 92 - 92 + 93 93 static const char *format_device1 = 94 94 /* D: Ver=xx.xx Cls=xx(sssss) Sub=xx Prot=xx MxPS=dd #Cfgs=dd */ 95 95 "D: Ver=%2x.%02x Cls=%02x(%-5s) Sub=%02x Prot=%02x MxPS=%2d #Cfgs=%3d\n"; ··· 101 101 static const char *format_config = 102 102 /* C: #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA */ 103 103 "C:%c #Ifs=%2d Cfg#=%2d Atr=%02x MxPwr=%3dmA\n"; 104 - 104 + 105 105 static const char *format_iad = 106 106 /* A: FirstIf#=dd IfCount=dd Cls=xx(sssss) Sub=xx Prot=xx */ 107 107 "A: FirstIf#=%2d IfCount=%2d Cls=%02x(%-5s) Sub=%02x Prot=%02x\n"; ··· 122 122 */ 123 123 124 124 static DECLARE_WAIT_QUEUE_HEAD(deviceconndiscwq); 125 - static unsigned int conndiscevcnt = 0; 125 + static unsigned int conndiscevcnt; 126 126 127 127 /* this struct stores the poll state for <mountpoint>/devices pollers */ 128 128 struct usb_device_status { ··· 172 172 return clas_info[ix].class_name; 173 173 } 174 174 175 - static char *usb_dump_endpoint_descriptor( 176 - int speed, 177 - char *start, 178 - char *end, 179 - const struct usb_endpoint_descriptor *desc 180 - ) 175 + static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end, 176 + const struct usb_endpoint_descriptor *desc) 181 177 { 182 178 char dir, unit, *type; 183 179 unsigned interval, bandwidth = 1; ··· 231 235 232 236 start += sprintf(start, format_endpt, desc->bEndpointAddress, dir, 233 237 desc->bmAttributes, type, 234 - (le16_to_cpu(desc->wMaxPacketSize) & 0x07ff) * bandwidth, 238 + (le16_to_cpu(desc->wMaxPacketSize) & 0x07ff) * 239 + bandwidth, 235 240 interval, unit); 236 241 return start; 237 242 } 238 243 239 244 static char *usb_dump_interface_descriptor(char *start, char *end, 240 - const struct usb_interface_cache *intfc, 241 - const struct usb_interface *iface, 242 - int setno) 245 + const struct usb_interface_cache *intfc, 246 + const struct usb_interface *iface, 247 + int setno) 243 248 { 244 - const struct usb_interface_descriptor *desc = &intfc->altsetting[setno].desc; 249 + const struct usb_interface_descriptor *desc; 245 250 const char *driver_name = ""; 246 251 int active = 0; 247 252 248 253 if (start > end) 249 254 return start; 255 + desc = &intfc->altsetting[setno].desc; 250 256 if (iface) { 251 257 driver_name = (iface->dev.driver 252 258 ? iface->dev.driver->name ··· 268 270 return start; 269 271 } 270 272 271 - static char *usb_dump_interface( 272 - int speed, 273 - char *start, 274 - char *end, 275 - const struct usb_interface_cache *intfc, 276 - const struct usb_interface *iface, 277 - int setno 278 - ) { 273 + static char *usb_dump_interface(int speed, char *start, char *end, 274 + const struct usb_interface_cache *intfc, 275 + const struct usb_interface *iface, int setno) 276 + { 279 277 const struct usb_host_interface *desc = &intfc->altsetting[setno]; 280 278 int i; 281 279 ··· 286 292 } 287 293 288 294 static char *usb_dump_iad_descriptor(char *start, char *end, 289 - const struct usb_interface_assoc_descriptor *iad) 295 + const struct usb_interface_assoc_descriptor *iad) 290 296 { 291 297 if (start > end) 292 298 return start; ··· 305 311 * 1. marking active interface altsettings (code lists all, but should mark 306 312 * which ones are active, if any) 307 313 */ 308 - 309 - static char *usb_dump_config_descriptor(char *start, char *end, const struct usb_config_descriptor *desc, int active) 314 + static char *usb_dump_config_descriptor(char *start, char *end, 315 + const struct usb_config_descriptor *desc, 316 + int active) 310 317 { 311 318 if (start > end) 312 319 return start; 313 320 start += sprintf(start, format_config, 314 - active ? '*' : ' ', /* mark active/actual/current cfg. */ 321 + /* mark active/actual/current cfg. */ 322 + active ? '*' : ' ', 315 323 desc->bNumInterfaces, 316 324 desc->bConfigurationValue, 317 325 desc->bmAttributes, ··· 321 325 return start; 322 326 } 323 327 324 - static char *usb_dump_config ( 325 - int speed, 326 - char *start, 327 - char *end, 328 - const struct usb_host_config *config, 329 - int active 330 - ) 328 + static char *usb_dump_config(int speed, char *start, char *end, 329 + const struct usb_host_config *config, int active) 331 330 { 332 331 int i, j; 333 332 struct usb_interface_cache *intfc; ··· 330 339 331 340 if (start > end) 332 341 return start; 333 - if (!config) /* getting these some in 2.3.7; none in 2.3.6 */ 342 + if (!config) 343 + /* getting these some in 2.3.7; none in 2.3.6 */ 334 344 return start + sprintf(start, "(null Cfg. desc.)\n"); 335 345 start = usb_dump_config_descriptor(start, end, &config->desc, active); 336 346 for (i = 0; i < USB_MAXIADS; i++) { ··· 356 364 /* 357 365 * Dump the different USB descriptors. 358 366 */ 359 - static char *usb_dump_device_descriptor(char *start, char *end, const struct usb_device_descriptor *desc) 367 + static char *usb_dump_device_descriptor(char *start, char *end, 368 + const struct usb_device_descriptor *desc) 360 369 { 361 370 u16 bcdUSB = le16_to_cpu(desc->bcdUSB); 362 371 u16 bcdDevice = le16_to_cpu(desc->bcdDevice); ··· 367 374 start += sprintf(start, format_device1, 368 375 bcdUSB >> 8, bcdUSB & 0xff, 369 376 desc->bDeviceClass, 370 - class_decode (desc->bDeviceClass), 377 + class_decode(desc->bDeviceClass), 371 378 desc->bDeviceSubClass, 372 379 desc->bDeviceProtocol, 373 380 desc->bMaxPacketSize0, ··· 384 391 /* 385 392 * Dump the different strings that this device holds. 386 393 */ 387 - static char *usb_dump_device_strings(char *start, char *end, struct usb_device *dev) 394 + static char *usb_dump_device_strings(char *start, char *end, 395 + struct usb_device *dev) 388 396 { 389 397 if (start > end) 390 398 return start; 391 399 if (dev->manufacturer) 392 - start += sprintf(start, format_string_manufacturer, dev->manufacturer); 400 + start += sprintf(start, format_string_manufacturer, 401 + dev->manufacturer); 393 402 if (start > end) 394 403 goto out; 395 404 if (dev->product) ··· 400 405 goto out; 401 406 #ifdef ALLOW_SERIAL_NUMBER 402 407 if (dev->serial) 403 - start += sprintf(start, format_string_serialnumber, dev->serial); 408 + start += sprintf(start, format_string_serialnumber, 409 + dev->serial); 404 410 #endif 405 411 out: 406 412 return start; ··· 413 417 414 418 if (start > end) 415 419 return start; 416 - 420 + 417 421 start = usb_dump_device_descriptor(start, end, &dev->descriptor); 418 422 419 423 if (start > end) 420 424 return start; 421 - 425 + 422 426 start = usb_dump_device_strings(start, end, dev); 423 427 424 428 for (i = 0; i < dev->descriptor.bNumConfigurations; i++) { ··· 435 439 436 440 #ifdef PROC_EXTRA /* TBD: may want to add this code later */ 437 441 438 - static char *usb_dump_hub_descriptor(char *start, char *end, const struct usb_hub_descriptor * desc) 442 + static char *usb_dump_hub_descriptor(char *start, char *end, 443 + const struct usb_hub_descriptor *desc) 439 444 { 440 445 int leng = USB_DT_HUB_NONVAR_SIZE; 441 446 unsigned char *ptr = (unsigned char *)desc; ··· 452 455 return start; 453 456 } 454 457 455 - static char *usb_dump_string(char *start, char *end, const struct usb_device *dev, char *id, int index) 458 + static char *usb_dump_string(char *start, char *end, 459 + const struct usb_device *dev, char *id, int index) 456 460 { 457 461 if (start > end) 458 462 return start; 459 463 start += sprintf(start, "Interface:"); 460 - if (index <= dev->maxstring && dev->stringindex && dev->stringindex[index]) 461 - start += sprintf(start, "%s: %.100s ", id, dev->stringindex[index]); 464 + if (index <= dev->maxstring && dev->stringindex && 465 + dev->stringindex[index]) 466 + start += sprintf(start, "%s: %.100s ", id, 467 + dev->stringindex[index]); 462 468 return start; 463 469 } 464 470 ··· 476 476 * file_offset - the offset into the devices file on completion 477 477 * The caller must own the device lock. 478 478 */ 479 - static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, loff_t *skip_bytes, loff_t *file_offset, 480 - struct usb_device *usbdev, struct usb_bus *bus, int level, int index, int count) 479 + static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes, 480 + loff_t *skip_bytes, loff_t *file_offset, 481 + struct usb_device *usbdev, struct usb_bus *bus, 482 + int level, int index, int count) 481 483 { 482 484 int chix; 483 485 int ret, cnt = 0; ··· 487 485 char *pages_start, *data_end, *speed; 488 486 unsigned int length; 489 487 ssize_t total_written = 0; 490 - 488 + 491 489 /* don't bother with anything else if we're not writing any data */ 492 490 if (*nbytes <= 0) 493 491 return 0; 494 - 492 + 495 493 if (level > MAX_TOPO_LEVEL) 496 494 return 0; 497 - /* allocate 2^1 pages = 8K (on i386); should be more than enough for one device */ 498 - if (!(pages_start = (char*) __get_free_pages(GFP_KERNEL,1))) 499 - return -ENOMEM; 500 - 495 + /* allocate 2^1 pages = 8K (on i386); 496 + * should be more than enough for one device */ 497 + pages_start = (char *)__get_free_pages(GFP_KERNEL, 1); 498 + if (!pages_start) 499 + return -ENOMEM; 500 + 501 501 if (usbdev->parent && usbdev->parent->devnum != -1) 502 502 parent_devnum = usbdev->parent->devnum; 503 503 /* ··· 545 541 bus->bandwidth_allocated, max, 546 542 (100 * bus->bandwidth_allocated + max / 2) 547 543 / max, 548 - bus->bandwidth_int_reqs, 549 - bus->bandwidth_isoc_reqs); 550 - 544 + bus->bandwidth_int_reqs, 545 + bus->bandwidth_isoc_reqs); 546 + 551 547 } 552 - data_end = usb_dump_desc(data_end, pages_start + (2 * PAGE_SIZE) - 256, usbdev); 553 - 548 + data_end = usb_dump_desc(data_end, pages_start + (2 * PAGE_SIZE) - 256, 549 + usbdev); 550 + 554 551 if (data_end > (pages_start + (2 * PAGE_SIZE) - 256)) 555 552 data_end += sprintf(data_end, "(truncated)\n"); 556 - 553 + 557 554 length = data_end - pages_start; 558 555 /* if we can start copying some data to the user */ 559 556 if (length > *skip_bytes) { ··· 572 567 *skip_bytes = 0; 573 568 } else 574 569 *skip_bytes -= length; 575 - 570 + 576 571 free_pages((unsigned long)pages_start, 1); 577 - 572 + 578 573 /* Now look at all of this device's children. */ 579 574 for (chix = 0; chix < usbdev->maxchild; chix++) { 580 575 struct usb_device *childdev = usbdev->children[chix]; 581 576 582 577 if (childdev) { 583 578 usb_lock_device(childdev); 584 - ret = usb_device_dump(buffer, nbytes, skip_bytes, file_offset, childdev, 585 - bus, level + 1, chix, ++cnt); 579 + ret = usb_device_dump(buffer, nbytes, skip_bytes, 580 + file_offset, childdev, bus, 581 + level + 1, chix, ++cnt); 586 582 usb_unlock_device(childdev); 587 583 if (ret == -EFAULT) 588 584 return total_written; ··· 593 587 return total_written; 594 588 } 595 589 596 - static ssize_t usb_device_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) 590 + static ssize_t usb_device_read(struct file *file, char __user *buf, 591 + size_t nbytes, loff_t *ppos) 597 592 { 598 593 struct usb_bus *bus; 599 594 ssize_t ret, total_written = 0; ··· 614 607 if (!bus->root_hub) 615 608 continue; 616 609 usb_lock_device(bus->root_hub); 617 - ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos, bus->root_hub, bus, 0, 0, 0); 610 + ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos, 611 + bus->root_hub, bus, 0, 0, 0); 618 612 usb_unlock_device(bus->root_hub); 619 613 if (ret < 0) { 620 614 mutex_unlock(&usb_bus_list_lock); ··· 628 620 } 629 621 630 622 /* Kernel lock for "lastev" protection */ 631 - static unsigned int usb_device_poll(struct file *file, struct poll_table_struct *wait) 623 + static unsigned int usb_device_poll(struct file *file, 624 + struct poll_table_struct *wait) 632 625 { 633 626 struct usb_device_status *st = file->private_data; 634 627 unsigned int mask = 0; ··· 638 629 if (!st) { 639 630 st = kmalloc(sizeof(struct usb_device_status), GFP_KERNEL); 640 631 641 - /* we may have dropped BKL - need to check for having lost the race */ 632 + /* we may have dropped BKL - 633 + * need to check for having lost the race */ 642 634 if (file->private_data) { 643 635 kfree(st); 644 636 st = file->private_data; ··· 662 652 } 663 653 lost_race: 664 654 if (file->f_mode & FMODE_READ) 665 - poll_wait(file, &deviceconndiscwq, wait); 655 + poll_wait(file, &deviceconndiscwq, wait); 666 656 if (st->lastev != conndiscevcnt) 667 657 mask |= POLLIN; 668 658 st->lastev = conndiscevcnt; ··· 672 662 673 663 static int usb_device_open(struct inode *inode, struct file *file) 674 664 { 675 - file->private_data = NULL; 676 - return 0; 665 + file->private_data = NULL; 666 + return 0; 677 667 } 678 668 679 669 static int usb_device_release(struct inode *inode, struct file *file) 680 670 { 681 671 kfree(file->private_data); 682 672 file->private_data = NULL; 683 - return 0; 673 + return 0; 684 674 } 685 675 686 - static loff_t usb_device_lseek(struct file * file, loff_t offset, int orig) 676 + static loff_t usb_device_lseek(struct file *file, loff_t offset, int orig) 687 677 { 688 678 loff_t ret; 689 679