aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-10 18:05:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-10 18:05:02 -0400
commit9895850b23886e030cd1e7241d5529a57e969c3d (patch)
tree1061626db450aeb72dcfcd247c24b33e5238c8c4 /drivers/usb/class
parentfc385c313275b114bc6ad36e60c5177d63250548 (diff)
parentb58af4066d240b18b43f202e07b9ec7461d90b17 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (148 commits) USB: serial: fix stalled writes USB: remove fake "address-of" expressions USB: fix thread-unsafe anchor utiliy routines USB: usbtest: support test device with only one iso-in or iso-out endpoint USB: usbtest: avoid to free coherent buffer in atomic context USB: xhci: Set DMA mask for host. USB: xhci: Don't flush doorbell writes. USB: xhci: Reduce reads and writes of interrupter registers. USB: xhci: Make xhci_set_hc_event_deq() static. USB: xhci: Minimize HW event ring dequeue pointer writes. USB: xhci: Make xhci_handle_event() static. USB: xhci: Remove unnecessary reads of IRQ_PENDING register. USB: xhci: Performance - move xhci_work() into xhci_irq() USB: xhci: Performance - move interrupt handlers into xhci-ring.c USB: xhci: Performance - move functions that find ep ring. USB:: fix linux/usb.h kernel-doc warnings USB: add USB serial ssu100 driver USB: usb-storage: implement autosuspend USB: ehci: fix remove of ehci debugfs dir USB: Add USB 2.0 to ssb ohci driver ...
Diffstat (limited to 'drivers/usb/class')
-rw-r--r--drivers/usb/class/usblp.c371
1 files changed, 185 insertions, 186 deletions
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 84f9e52327f2..e325162859b0 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -135,7 +135,7 @@ MFG:HEWLETT-PACKARD;MDL:DESKJET 970C;CMD:MLC,PCL,PML;CLASS:PRINTER;DESCRIPTION:H
135 * ->lock locks what interrupt accesses. 135 * ->lock locks what interrupt accesses.
136 */ 136 */
137struct usblp { 137struct usblp {
138 struct usb_device *dev; /* USB device */ 138 struct usb_device *dev; /* USB device */
139 struct mutex wmut; 139 struct mutex wmut;
140 struct mutex mut; 140 struct mutex mut;
141 spinlock_t lock; /* locks rcomplete, wcomplete */ 141 spinlock_t lock; /* locks rcomplete, wcomplete */
@@ -169,7 +169,8 @@ struct usblp {
169}; 169};
170 170
171#ifdef DEBUG 171#ifdef DEBUG
172static void usblp_dump(struct usblp *usblp) { 172static void usblp_dump(struct usblp *usblp)
173{
173 int p; 174 int p;
174 175
175 dbg("usblp=0x%p", usblp); 176 dbg("usblp=0x%p", usblp);
@@ -216,8 +217,8 @@ static const struct quirk_printer_struct quirk_printers[] = {
216 { 0x03f0, 0x0304, USBLP_QUIRK_BIDIR }, /* HP DeskJet 810C/812C */ 217 { 0x03f0, 0x0304, USBLP_QUIRK_BIDIR }, /* HP DeskJet 810C/812C */
217 { 0x03f0, 0x0404, USBLP_QUIRK_BIDIR }, /* HP DeskJet 830C */ 218 { 0x03f0, 0x0404, USBLP_QUIRK_BIDIR }, /* HP DeskJet 830C */
218 { 0x03f0, 0x0504, USBLP_QUIRK_BIDIR }, /* HP DeskJet 885C */ 219 { 0x03f0, 0x0504, USBLP_QUIRK_BIDIR }, /* HP DeskJet 885C */
219 { 0x03f0, 0x0604, USBLP_QUIRK_BIDIR }, /* HP DeskJet 840C */ 220 { 0x03f0, 0x0604, USBLP_QUIRK_BIDIR }, /* HP DeskJet 840C */
220 { 0x03f0, 0x0804, USBLP_QUIRK_BIDIR }, /* HP DeskJet 816C */ 221 { 0x03f0, 0x0804, USBLP_QUIRK_BIDIR }, /* HP DeskJet 816C */
221 { 0x03f0, 0x1104, USBLP_QUIRK_BIDIR }, /* HP Deskjet 959C */ 222 { 0x03f0, 0x1104, USBLP_QUIRK_BIDIR }, /* HP Deskjet 959C */
222 { 0x0409, 0xefbe, USBLP_QUIRK_BIDIR }, /* NEC Picty900 (HP OEM) */ 223 { 0x0409, 0xefbe, USBLP_QUIRK_BIDIR }, /* NEC Picty900 (HP OEM) */
223 { 0x0409, 0xbef4, USBLP_QUIRK_BIDIR }, /* NEC Picty760 (HP OEM) */ 224 { 0x0409, 0xbef4, USBLP_QUIRK_BIDIR }, /* NEC Picty760 (HP OEM) */
@@ -254,9 +255,8 @@ static int usblp_ctrl_msg(struct usblp *usblp, int request, int type, int dir, i
254 /* High byte has the interface index. 255 /* High byte has the interface index.
255 Low byte has the alternate setting. 256 Low byte has the alternate setting.
256 */ 257 */
257 if ((request == USBLP_REQ_GET_ID) && (type == USB_TYPE_CLASS)) { 258 if ((request == USBLP_REQ_GET_ID) && (type == USB_TYPE_CLASS))
258 index = (usblp->ifnum<<8)|usblp->protocol[usblp->current_protocol].alt_setting; 259 index = (usblp->ifnum<<8)|usblp->protocol[usblp->current_protocol].alt_setting;
259 }
260 260
261 retval = usb_control_msg(usblp->dev, 261 retval = usb_control_msg(usblp->dev,
262 dir ? usb_rcvctrlpipe(usblp->dev, 0) : usb_sndctrlpipe(usblp->dev, 0), 262 dir ? usb_rcvctrlpipe(usblp->dev, 0) : usb_sndctrlpipe(usblp->dev, 0),
@@ -372,7 +372,7 @@ static int usblp_check_status(struct usblp *usblp, int err)
372 return newerr; 372 return newerr;
373} 373}
374 374
375static int handle_bidir (struct usblp *usblp) 375static int handle_bidir(struct usblp *usblp)
376{ 376{
377 if (usblp->bidir && usblp->used) { 377 if (usblp->bidir && usblp->used) {
378 if (usblp_submit_read(usblp) < 0) 378 if (usblp_submit_read(usblp) < 0)
@@ -395,14 +395,13 @@ static int usblp_open(struct inode *inode, struct file *file)
395 if (minor < 0) 395 if (minor < 0)
396 return -ENODEV; 396 return -ENODEV;
397 397
398 mutex_lock (&usblp_mutex); 398 mutex_lock(&usblp_mutex);
399 399
400 retval = -ENODEV; 400 retval = -ENODEV;
401 intf = usb_find_interface(&usblp_driver, minor); 401 intf = usb_find_interface(&usblp_driver, minor);
402 if (!intf) { 402 if (!intf)
403 goto out; 403 goto out;
404 } 404 usblp = usb_get_intfdata(intf);
405 usblp = usb_get_intfdata (intf);
406 if (!usblp || !usblp->dev || !usblp->present) 405 if (!usblp || !usblp->dev || !usblp->present)
407 goto out; 406 goto out;
408 407
@@ -433,18 +432,18 @@ static int usblp_open(struct inode *inode, struct file *file)
433 retval = -EIO; 432 retval = -EIO;
434 } 433 }
435out: 434out:
436 mutex_unlock (&usblp_mutex); 435 mutex_unlock(&usblp_mutex);
437 return retval; 436 return retval;
438} 437}
439 438
440static void usblp_cleanup (struct usblp *usblp) 439static void usblp_cleanup(struct usblp *usblp)
441{ 440{
442 printk(KERN_INFO "usblp%d: removed\n", usblp->minor); 441 printk(KERN_INFO "usblp%d: removed\n", usblp->minor);
443 442
444 kfree(usblp->readbuf); 443 kfree(usblp->readbuf);
445 kfree (usblp->device_id_string); 444 kfree(usblp->device_id_string);
446 kfree (usblp->statusbuf); 445 kfree(usblp->statusbuf);
447 kfree (usblp); 446 kfree(usblp);
448} 447}
449 448
450static void usblp_unlink_urbs(struct usblp *usblp) 449static void usblp_unlink_urbs(struct usblp *usblp)
@@ -458,14 +457,14 @@ static int usblp_release(struct inode *inode, struct file *file)
458 457
459 usblp->flags &= ~LP_ABORT; 458 usblp->flags &= ~LP_ABORT;
460 459
461 mutex_lock (&usblp_mutex); 460 mutex_lock(&usblp_mutex);
462 usblp->used = 0; 461 usblp->used = 0;
463 if (usblp->present) { 462 if (usblp->present) {
464 usblp_unlink_urbs(usblp); 463 usblp_unlink_urbs(usblp);
465 usb_autopm_put_interface(usblp->intf); 464 usb_autopm_put_interface(usblp->intf);
466 } else /* finish cleanup from disconnect */ 465 } else /* finish cleanup from disconnect */
467 usblp_cleanup (usblp); 466 usblp_cleanup(usblp);
468 mutex_unlock (&usblp_mutex); 467 mutex_unlock(&usblp_mutex);
469 return 0; 468 return 0;
470} 469}
471 470
@@ -495,190 +494,190 @@ static long usblp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
495 int twoints[2]; 494 int twoints[2];
496 int retval = 0; 495 int retval = 0;
497 496
498 mutex_lock (&usblp->mut); 497 mutex_lock(&usblp->mut);
499 if (!usblp->present) { 498 if (!usblp->present) {
500 retval = -ENODEV; 499 retval = -ENODEV;
501 goto done; 500 goto done;
502 } 501 }
503 502
504 dbg("usblp_ioctl: cmd=0x%x (%c nr=%d len=%d dir=%d)", cmd, _IOC_TYPE(cmd), 503 dbg("usblp_ioctl: cmd=0x%x (%c nr=%d len=%d dir=%d)", cmd, _IOC_TYPE(cmd),
505 _IOC_NR(cmd), _IOC_SIZE(cmd), _IOC_DIR(cmd) ); 504 _IOC_NR(cmd), _IOC_SIZE(cmd), _IOC_DIR(cmd));
506 505
507 if (_IOC_TYPE(cmd) == 'P') /* new-style ioctl number */ 506 if (_IOC_TYPE(cmd) == 'P') /* new-style ioctl number */
508 507
509 switch (_IOC_NR(cmd)) { 508 switch (_IOC_NR(cmd)) {
510 509
511 case IOCNR_GET_DEVICE_ID: /* get the DEVICE_ID string */ 510 case IOCNR_GET_DEVICE_ID: /* get the DEVICE_ID string */
512 if (_IOC_DIR(cmd) != _IOC_READ) { 511 if (_IOC_DIR(cmd) != _IOC_READ) {
513 retval = -EINVAL; 512 retval = -EINVAL;
514 goto done; 513 goto done;
515 } 514 }
516 515
517 length = usblp_cache_device_id_string(usblp); 516 length = usblp_cache_device_id_string(usblp);
518 if (length < 0) { 517 if (length < 0) {
519 retval = length; 518 retval = length;
520 goto done; 519 goto done;
521 } 520 }
522 if (length > _IOC_SIZE(cmd)) 521 if (length > _IOC_SIZE(cmd))
523 length = _IOC_SIZE(cmd); /* truncate */ 522 length = _IOC_SIZE(cmd); /* truncate */
524 523
525 if (copy_to_user((void __user *) arg, 524 if (copy_to_user((void __user *) arg,
526 usblp->device_id_string, 525 usblp->device_id_string,
527 (unsigned long) length)) { 526 (unsigned long) length)) {
528 retval = -EFAULT; 527 retval = -EFAULT;
529 goto done; 528 goto done;
530 } 529 }
531 530
532 break; 531 break;
533 532
534 case IOCNR_GET_PROTOCOLS: 533 case IOCNR_GET_PROTOCOLS:
535 if (_IOC_DIR(cmd) != _IOC_READ || 534 if (_IOC_DIR(cmd) != _IOC_READ ||
536 _IOC_SIZE(cmd) < sizeof(twoints)) { 535 _IOC_SIZE(cmd) < sizeof(twoints)) {
537 retval = -EINVAL; 536 retval = -EINVAL;
538 goto done; 537 goto done;
539 } 538 }
540 539
541 twoints[0] = usblp->current_protocol; 540 twoints[0] = usblp->current_protocol;
542 twoints[1] = 0; 541 twoints[1] = 0;
543 for (i = USBLP_FIRST_PROTOCOL; 542 for (i = USBLP_FIRST_PROTOCOL;
544 i <= USBLP_LAST_PROTOCOL; i++) { 543 i <= USBLP_LAST_PROTOCOL; i++) {
545 if (usblp->protocol[i].alt_setting >= 0) 544 if (usblp->protocol[i].alt_setting >= 0)
546 twoints[1] |= (1<<i); 545 twoints[1] |= (1<<i);
547 } 546 }
548 547
549 if (copy_to_user((void __user *)arg, 548 if (copy_to_user((void __user *)arg,
550 (unsigned char *)twoints, 549 (unsigned char *)twoints,
551 sizeof(twoints))) { 550 sizeof(twoints))) {
552 retval = -EFAULT; 551 retval = -EFAULT;
553 goto done; 552 goto done;
554 } 553 }
555 554
556 break; 555 break;
557 556
558 case IOCNR_SET_PROTOCOL: 557 case IOCNR_SET_PROTOCOL:
559 if (_IOC_DIR(cmd) != _IOC_WRITE) { 558 if (_IOC_DIR(cmd) != _IOC_WRITE) {
560 retval = -EINVAL; 559 retval = -EINVAL;
561 goto done; 560 goto done;
562 } 561 }
563 562
564#ifdef DEBUG 563#ifdef DEBUG
565 if (arg == -10) { 564 if (arg == -10) {
566 usblp_dump(usblp); 565 usblp_dump(usblp);
567 break; 566 break;
568 } 567 }
569#endif 568#endif
570 569
571 usblp_unlink_urbs(usblp); 570 usblp_unlink_urbs(usblp);
572 retval = usblp_set_protocol(usblp, arg); 571 retval = usblp_set_protocol(usblp, arg);
573 if (retval < 0) { 572 if (retval < 0) {
574 usblp_set_protocol(usblp, 573 usblp_set_protocol(usblp,
575 usblp->current_protocol); 574 usblp->current_protocol);
576 } 575 }
577 break; 576 break;
578 577
579 case IOCNR_HP_SET_CHANNEL: 578 case IOCNR_HP_SET_CHANNEL:
580 if (_IOC_DIR(cmd) != _IOC_WRITE || 579 if (_IOC_DIR(cmd) != _IOC_WRITE ||
581 le16_to_cpu(usblp->dev->descriptor.idVendor) != 0x03F0 || 580 le16_to_cpu(usblp->dev->descriptor.idVendor) != 0x03F0 ||
582 usblp->quirks & USBLP_QUIRK_BIDIR) { 581 usblp->quirks & USBLP_QUIRK_BIDIR) {
583 retval = -EINVAL; 582 retval = -EINVAL;
584 goto done; 583 goto done;
585 } 584 }
586 585
587 err = usblp_hp_channel_change_request(usblp, 586 err = usblp_hp_channel_change_request(usblp,
588 arg, &newChannel); 587 arg, &newChannel);
589 if (err < 0) { 588 if (err < 0) {
590 dev_err(&usblp->dev->dev, 589 dev_err(&usblp->dev->dev,
591 "usblp%d: error = %d setting " 590 "usblp%d: error = %d setting "
592 "HP channel\n", 591 "HP channel\n",
593 usblp->minor, err); 592 usblp->minor, err);
594 retval = -EIO; 593 retval = -EIO;
595 goto done; 594 goto done;
596 } 595 }
597 596
598 dbg("usblp%d requested/got HP channel %ld/%d", 597 dbg("usblp%d requested/got HP channel %ld/%d",
599 usblp->minor, arg, newChannel); 598 usblp->minor, arg, newChannel);
600 break; 599 break;
601 600
602 case IOCNR_GET_BUS_ADDRESS: 601 case IOCNR_GET_BUS_ADDRESS:
603 if (_IOC_DIR(cmd) != _IOC_READ || 602 if (_IOC_DIR(cmd) != _IOC_READ ||
604 _IOC_SIZE(cmd) < sizeof(twoints)) { 603 _IOC_SIZE(cmd) < sizeof(twoints)) {
605 retval = -EINVAL; 604 retval = -EINVAL;
606 goto done; 605 goto done;
607 } 606 }
608 607
609 twoints[0] = usblp->dev->bus->busnum; 608 twoints[0] = usblp->dev->bus->busnum;
610 twoints[1] = usblp->dev->devnum; 609 twoints[1] = usblp->dev->devnum;
611 if (copy_to_user((void __user *)arg, 610 if (copy_to_user((void __user *)arg,
612 (unsigned char *)twoints, 611 (unsigned char *)twoints,
613 sizeof(twoints))) { 612 sizeof(twoints))) {
614 retval = -EFAULT; 613 retval = -EFAULT;
615 goto done; 614 goto done;
616 } 615 }
617 616
618 dbg("usblp%d is bus=%d, device=%d", 617 dbg("usblp%d is bus=%d, device=%d",
619 usblp->minor, twoints[0], twoints[1]); 618 usblp->minor, twoints[0], twoints[1]);
620 break; 619 break;
621 620
622 case IOCNR_GET_VID_PID: 621 case IOCNR_GET_VID_PID:
623 if (_IOC_DIR(cmd) != _IOC_READ || 622 if (_IOC_DIR(cmd) != _IOC_READ ||
624 _IOC_SIZE(cmd) < sizeof(twoints)) { 623 _IOC_SIZE(cmd) < sizeof(twoints)) {
625 retval = -EINVAL; 624 retval = -EINVAL;
626 goto done; 625 goto done;
627 } 626 }
628 627
629 twoints[0] = le16_to_cpu(usblp->dev->descriptor.idVendor); 628 twoints[0] = le16_to_cpu(usblp->dev->descriptor.idVendor);
630 twoints[1] = le16_to_cpu(usblp->dev->descriptor.idProduct); 629 twoints[1] = le16_to_cpu(usblp->dev->descriptor.idProduct);
631 if (copy_to_user((void __user *)arg, 630 if (copy_to_user((void __user *)arg,
632 (unsigned char *)twoints, 631 (unsigned char *)twoints,
633 sizeof(twoints))) { 632 sizeof(twoints))) {
634 retval = -EFAULT; 633 retval = -EFAULT;
635 goto done; 634 goto done;
636 } 635 }
637 636
638 dbg("usblp%d is VID=0x%4.4X, PID=0x%4.4X", 637 dbg("usblp%d is VID=0x%4.4X, PID=0x%4.4X",
639 usblp->minor, twoints[0], twoints[1]); 638 usblp->minor, twoints[0], twoints[1]);
640 break; 639 break;
641 640
642 case IOCNR_SOFT_RESET: 641 case IOCNR_SOFT_RESET:
643 if (_IOC_DIR(cmd) != _IOC_NONE) { 642 if (_IOC_DIR(cmd) != _IOC_NONE) {
644 retval = -EINVAL; 643 retval = -EINVAL;
645 goto done; 644 goto done;
646 } 645 }
647 retval = usblp_reset(usblp); 646 retval = usblp_reset(usblp);
648 break; 647 break;
649 default: 648 default:
650 retval = -ENOTTY; 649 retval = -ENOTTY;
651 } 650 }
652 else /* old-style ioctl value */ 651 else /* old-style ioctl value */
653 switch (cmd) { 652 switch (cmd) {
654 653
655 case LPGETSTATUS: 654 case LPGETSTATUS:
656 if ((retval = usblp_read_status(usblp, usblp->statusbuf))) { 655 if ((retval = usblp_read_status(usblp, usblp->statusbuf))) {
657 if (printk_ratelimit()) 656 if (printk_ratelimit())
658 printk(KERN_ERR "usblp%d:" 657 printk(KERN_ERR "usblp%d:"
659 "failed reading printer status (%d)\n", 658 "failed reading printer status (%d)\n",
660 usblp->minor, retval); 659 usblp->minor, retval);
661 retval = -EIO; 660 retval = -EIO;
662 goto done; 661 goto done;
663 } 662 }
664 status = *usblp->statusbuf; 663 status = *usblp->statusbuf;
665 if (copy_to_user ((void __user *)arg, &status, sizeof(int))) 664 if (copy_to_user((void __user *)arg, &status, sizeof(int)))
666 retval = -EFAULT; 665 retval = -EFAULT;
667 break; 666 break;
668 667
669 case LPABORT: 668 case LPABORT:
670 if (arg) 669 if (arg)
671 usblp->flags |= LP_ABORT; 670 usblp->flags |= LP_ABORT;
672 else 671 else
673 usblp->flags &= ~LP_ABORT; 672 usblp->flags &= ~LP_ABORT;
674 break; 673 break;
675 674
676 default: 675 default:
677 retval = -ENOTTY; 676 retval = -ENOTTY;
678 } 677 }
679 678
680done: 679done:
681 mutex_unlock (&usblp->mut); 680 mutex_unlock(&usblp->mut);
682 return retval; 681 return retval;
683} 682}
684 683
@@ -840,7 +839,7 @@ static ssize_t usblp_read(struct file *file, char __user *buffer, size_t len, lo
840 } 839 }
841 840
842done: 841done:
843 mutex_unlock (&usblp->mut); 842 mutex_unlock(&usblp->mut);
844 return count; 843 return count;
845} 844}
846 845
@@ -1023,7 +1022,7 @@ raise_urb:
1023 * while you are sending print data, and you don't try to query the 1022 * while you are sending print data, and you don't try to query the
1024 * printer status every couple of milliseconds, you will probably be OK. 1023 * printer status every couple of milliseconds, you will probably be OK.
1025 */ 1024 */
1026static unsigned int usblp_quirks (__u16 vendor, __u16 product) 1025static unsigned int usblp_quirks(__u16 vendor, __u16 product)
1027{ 1026{
1028 int i; 1027 int i;
1029 1028
@@ -1031,7 +1030,7 @@ static unsigned int usblp_quirks (__u16 vendor, __u16 product)
1031 if (vendor == quirk_printers[i].vendorId && 1030 if (vendor == quirk_printers[i].vendorId &&
1032 product == quirk_printers[i].productId) 1031 product == quirk_printers[i].productId)
1033 return quirk_printers[i].quirks; 1032 return quirk_printers[i].quirks;
1034 } 1033 }
1035 return 0; 1034 return 0;
1036} 1035}
1037 1036
@@ -1061,7 +1060,7 @@ static struct usb_class_driver usblp_class = {
1061static ssize_t usblp_show_ieee1284_id(struct device *dev, struct device_attribute *attr, char *buf) 1060static ssize_t usblp_show_ieee1284_id(struct device *dev, struct device_attribute *attr, char *buf)
1062{ 1061{
1063 struct usb_interface *intf = to_usb_interface(dev); 1062 struct usb_interface *intf = to_usb_interface(dev);
1064 struct usblp *usblp = usb_get_intfdata (intf); 1063 struct usblp *usblp = usb_get_intfdata(intf);
1065 1064
1066 if (usblp->device_id_string[0] == 0 && 1065 if (usblp->device_id_string[0] == 0 &&
1067 usblp->device_id_string[1] == 0) 1066 usblp->device_id_string[1] == 0)
@@ -1075,7 +1074,7 @@ static DEVICE_ATTR(ieee1284_id, S_IRUGO, usblp_show_ieee1284_id, NULL);
1075static int usblp_probe(struct usb_interface *intf, 1074static int usblp_probe(struct usb_interface *intf,
1076 const struct usb_device_id *id) 1075 const struct usb_device_id *id)
1077{ 1076{
1078 struct usb_device *dev = interface_to_usbdev (intf); 1077 struct usb_device *dev = interface_to_usbdev(intf);
1079 struct usblp *usblp; 1078 struct usblp *usblp;
1080 int protocol; 1079 int protocol;
1081 int retval; 1080 int retval;
@@ -1089,7 +1088,7 @@ static int usblp_probe(struct usb_interface *intf,
1089 } 1088 }
1090 usblp->dev = dev; 1089 usblp->dev = dev;
1091 mutex_init(&usblp->wmut); 1090 mutex_init(&usblp->wmut);
1092 mutex_init (&usblp->mut); 1091 mutex_init(&usblp->mut);
1093 spin_lock_init(&usblp->lock); 1092 spin_lock_init(&usblp->lock);
1094 init_waitqueue_head(&usblp->rwait); 1093 init_waitqueue_head(&usblp->rwait);
1095 init_waitqueue_head(&usblp->wwait); 1094 init_waitqueue_head(&usblp->wwait);
@@ -1153,7 +1152,7 @@ static int usblp_probe(struct usb_interface *intf,
1153 usblp_check_status(usblp, 0); 1152 usblp_check_status(usblp, 0);
1154#endif 1153#endif
1155 1154
1156 usb_set_intfdata (intf, usblp); 1155 usb_set_intfdata(intf, usblp);
1157 1156
1158 usblp->present = 1; 1157 usblp->present = 1;
1159 1158
@@ -1177,7 +1176,7 @@ static int usblp_probe(struct usb_interface *intf,
1177 return 0; 1176 return 0;
1178 1177
1179abort_intfdata: 1178abort_intfdata:
1180 usb_set_intfdata (intf, NULL); 1179 usb_set_intfdata(intf, NULL);
1181 device_remove_file(&intf->dev, &dev_attr_ieee1284_id); 1180 device_remove_file(&intf->dev, &dev_attr_ieee1284_id);
1182abort: 1181abort:
1183 kfree(usblp->readbuf); 1182 kfree(usblp->readbuf);
@@ -1340,35 +1339,35 @@ static int usblp_cache_device_id_string(struct usblp *usblp)
1340 1339
1341static void usblp_disconnect(struct usb_interface *intf) 1340static void usblp_disconnect(struct usb_interface *intf)
1342{ 1341{
1343 struct usblp *usblp = usb_get_intfdata (intf); 1342 struct usblp *usblp = usb_get_intfdata(intf);
1344 1343
1345 usb_deregister_dev(intf, &usblp_class); 1344 usb_deregister_dev(intf, &usblp_class);
1346 1345
1347 if (!usblp || !usblp->dev) { 1346 if (!usblp || !usblp->dev) {
1348 dev_err(&intf->dev, "bogus disconnect\n"); 1347 dev_err(&intf->dev, "bogus disconnect\n");
1349 BUG (); 1348 BUG();
1350 } 1349 }
1351 1350
1352 device_remove_file(&intf->dev, &dev_attr_ieee1284_id); 1351 device_remove_file(&intf->dev, &dev_attr_ieee1284_id);
1353 1352
1354 mutex_lock (&usblp_mutex); 1353 mutex_lock(&usblp_mutex);
1355 mutex_lock (&usblp->mut); 1354 mutex_lock(&usblp->mut);
1356 usblp->present = 0; 1355 usblp->present = 0;
1357 wake_up(&usblp->wwait); 1356 wake_up(&usblp->wwait);
1358 wake_up(&usblp->rwait); 1357 wake_up(&usblp->rwait);
1359 usb_set_intfdata (intf, NULL); 1358 usb_set_intfdata(intf, NULL);
1360 1359
1361 usblp_unlink_urbs(usblp); 1360 usblp_unlink_urbs(usblp);
1362 mutex_unlock (&usblp->mut); 1361 mutex_unlock(&usblp->mut);
1363 1362
1364 if (!usblp->used) 1363 if (!usblp->used)
1365 usblp_cleanup (usblp); 1364 usblp_cleanup(usblp);
1366 mutex_unlock (&usblp_mutex); 1365 mutex_unlock(&usblp_mutex);
1367} 1366}
1368 1367
1369static int usblp_suspend(struct usb_interface *intf, pm_message_t message) 1368static int usblp_suspend(struct usb_interface *intf, pm_message_t message)
1370{ 1369{
1371 struct usblp *usblp = usb_get_intfdata (intf); 1370 struct usblp *usblp = usb_get_intfdata(intf);
1372 1371
1373 usblp_unlink_urbs(usblp); 1372 usblp_unlink_urbs(usblp);
1374#if 0 /* XXX Do we want this? What if someone is reading, should we fail? */ 1373#if 0 /* XXX Do we want this? What if someone is reading, should we fail? */
@@ -1382,10 +1381,10 @@ static int usblp_suspend(struct usb_interface *intf, pm_message_t message)
1382 1381
1383static int usblp_resume(struct usb_interface *intf) 1382static int usblp_resume(struct usb_interface *intf)
1384{ 1383{
1385 struct usblp *usblp = usb_get_intfdata (intf); 1384 struct usblp *usblp = usb_get_intfdata(intf);
1386 int r; 1385 int r;
1387 1386
1388 r = handle_bidir (usblp); 1387 r = handle_bidir(usblp);
1389 1388
1390 return r; 1389 return r;
1391} 1390}
@@ -1401,7 +1400,7 @@ static const struct usb_device_id usblp_ids[] = {
1401 { } /* Terminating entry */ 1400 { } /* Terminating entry */
1402}; 1401};
1403 1402
1404MODULE_DEVICE_TABLE (usb, usblp_ids); 1403MODULE_DEVICE_TABLE(usb, usblp_ids);
1405 1404
1406static struct usb_driver usblp_driver = { 1405static struct usb_driver usblp_driver = {
1407 .name = "usblp", 1406 .name = "usblp",
@@ -1426,8 +1425,8 @@ static void __exit usblp_exit(void)
1426module_init(usblp_init); 1425module_init(usblp_init);
1427module_exit(usblp_exit); 1426module_exit(usblp_exit);
1428 1427
1429MODULE_AUTHOR( DRIVER_AUTHOR ); 1428MODULE_AUTHOR(DRIVER_AUTHOR);
1430MODULE_DESCRIPTION( DRIVER_DESC ); 1429MODULE_DESCRIPTION(DRIVER_DESC);
1431module_param(proto_bias, int, S_IRUGO | S_IWUSR); 1430module_param(proto_bias, int, S_IRUGO | S_IWUSR);
1432MODULE_PARM_DESC(proto_bias, "Favourite protocol number"); 1431MODULE_PARM_DESC(proto_bias, "Favourite protocol number");
1433MODULE_LICENSE("GPL"); 1432MODULE_LICENSE("GPL");