diff options
Diffstat (limited to 'drivers/usb/class')
| -rw-r--r-- | drivers/usb/class/cdc-acm.c | 19 | ||||
| -rw-r--r-- | drivers/usb/class/cdc-wdm.c | 8 | ||||
| -rw-r--r-- | drivers/usb/class/usblp.c | 7 | ||||
| -rw-r--r-- | drivers/usb/class/usbtmc.c | 7 |
4 files changed, 22 insertions, 19 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index dac7676ce21b..e8c564a53346 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -539,7 +539,6 @@ static void acm_port_down(struct acm *acm) | |||
| 539 | { | 539 | { |
| 540 | int i; | 540 | int i; |
| 541 | 541 | ||
| 542 | mutex_lock(&open_mutex); | ||
| 543 | if (acm->dev) { | 542 | if (acm->dev) { |
| 544 | usb_autopm_get_interface(acm->control); | 543 | usb_autopm_get_interface(acm->control); |
| 545 | acm_set_control(acm, acm->ctrlout = 0); | 544 | acm_set_control(acm, acm->ctrlout = 0); |
| @@ -551,14 +550,15 @@ static void acm_port_down(struct acm *acm) | |||
| 551 | acm->control->needs_remote_wakeup = 0; | 550 | acm->control->needs_remote_wakeup = 0; |
| 552 | usb_autopm_put_interface(acm->control); | 551 | usb_autopm_put_interface(acm->control); |
| 553 | } | 552 | } |
| 554 | mutex_unlock(&open_mutex); | ||
| 555 | } | 553 | } |
| 556 | 554 | ||
| 557 | static void acm_tty_hangup(struct tty_struct *tty) | 555 | static void acm_tty_hangup(struct tty_struct *tty) |
| 558 | { | 556 | { |
| 559 | struct acm *acm = tty->driver_data; | 557 | struct acm *acm = tty->driver_data; |
| 560 | tty_port_hangup(&acm->port); | 558 | tty_port_hangup(&acm->port); |
| 559 | mutex_lock(&open_mutex); | ||
| 561 | acm_port_down(acm); | 560 | acm_port_down(acm); |
| 561 | mutex_unlock(&open_mutex); | ||
| 562 | } | 562 | } |
| 563 | 563 | ||
| 564 | static void acm_tty_close(struct tty_struct *tty, struct file *filp) | 564 | static void acm_tty_close(struct tty_struct *tty, struct file *filp) |
| @@ -569,8 +569,9 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) | |||
| 569 | shutdown */ | 569 | shutdown */ |
| 570 | if (!acm) | 570 | if (!acm) |
| 571 | return; | 571 | return; |
| 572 | |||
| 573 | mutex_lock(&open_mutex); | ||
| 572 | if (tty_port_close_start(&acm->port, tty, filp) == 0) { | 574 | if (tty_port_close_start(&acm->port, tty, filp) == 0) { |
| 573 | mutex_lock(&open_mutex); | ||
| 574 | if (!acm->dev) { | 575 | if (!acm->dev) { |
| 575 | tty_port_tty_set(&acm->port, NULL); | 576 | tty_port_tty_set(&acm->port, NULL); |
| 576 | acm_tty_unregister(acm); | 577 | acm_tty_unregister(acm); |
| @@ -582,6 +583,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp) | |||
| 582 | acm_port_down(acm); | 583 | acm_port_down(acm); |
| 583 | tty_port_close_end(&acm->port, tty); | 584 | tty_port_close_end(&acm->port, tty); |
| 584 | tty_port_tty_set(&acm->port, NULL); | 585 | tty_port_tty_set(&acm->port, NULL); |
| 586 | mutex_unlock(&open_mutex); | ||
| 585 | } | 587 | } |
| 586 | 588 | ||
| 587 | static int acm_tty_write(struct tty_struct *tty, | 589 | static int acm_tty_write(struct tty_struct *tty, |
| @@ -1058,11 +1060,11 @@ made_compressed_probe: | |||
| 1058 | goto alloc_fail; | 1060 | goto alloc_fail; |
| 1059 | } | 1061 | } |
| 1060 | 1062 | ||
| 1061 | ctrlsize = le16_to_cpu(epctrl->wMaxPacketSize); | 1063 | ctrlsize = usb_endpoint_maxp(epctrl); |
| 1062 | readsize = le16_to_cpu(epread->wMaxPacketSize) * | 1064 | readsize = usb_endpoint_maxp(epread) * |
| 1063 | (quirks == SINGLE_RX_URB ? 1 : 2); | 1065 | (quirks == SINGLE_RX_URB ? 1 : 2); |
| 1064 | acm->combined_interfaces = combined_interfaces; | 1066 | acm->combined_interfaces = combined_interfaces; |
| 1065 | acm->writesize = le16_to_cpu(epwrite->wMaxPacketSize) * 20; | 1067 | acm->writesize = usb_endpoint_maxp(epwrite) * 20; |
| 1066 | acm->control = control_interface; | 1068 | acm->control = control_interface; |
| 1067 | acm->data = data_interface; | 1069 | acm->data = data_interface; |
| 1068 | acm->minor = minor; | 1070 | acm->minor = minor; |
| @@ -1305,7 +1307,7 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message) | |||
| 1305 | struct acm *acm = usb_get_intfdata(intf); | 1307 | struct acm *acm = usb_get_intfdata(intf); |
| 1306 | int cnt; | 1308 | int cnt; |
| 1307 | 1309 | ||
| 1308 | if (message.event & PM_EVENT_AUTO) { | 1310 | if (PMSG_IS_AUTO(message)) { |
| 1309 | int b; | 1311 | int b; |
| 1310 | 1312 | ||
| 1311 | spin_lock_irq(&acm->write_lock); | 1313 | spin_lock_irq(&acm->write_lock); |
| @@ -1534,6 +1536,9 @@ static const struct usb_device_id acm_ids[] = { | |||
| 1534 | { NOKIA_PCSUITE_ACM_INFO(0x03cd), }, /* Nokia C7 */ | 1536 | { NOKIA_PCSUITE_ACM_INFO(0x03cd), }, /* Nokia C7 */ |
| 1535 | { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */ | 1537 | { SAMSUNG_PCSUITE_ACM_INFO(0x6651), }, /* Samsung GTi8510 (INNOV8) */ |
| 1536 | 1538 | ||
| 1539 | /* Support for Owen devices */ | ||
| 1540 | { USB_DEVICE(0x03eb, 0x0030), }, /* Owen SI30 */ | ||
| 1541 | |||
| 1537 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ | 1542 | /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ |
| 1538 | 1543 | ||
| 1539 | /* Support Lego NXT using pbLua firmware */ | 1544 | /* Support Lego NXT using pbLua firmware */ |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 2b9ff518b509..efe684908c1f 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
| @@ -682,7 +682,7 @@ next_desc: | |||
| 682 | if (!ep || !usb_endpoint_is_int_in(ep)) | 682 | if (!ep || !usb_endpoint_is_int_in(ep)) |
| 683 | goto err; | 683 | goto err; |
| 684 | 684 | ||
| 685 | desc->wMaxPacketSize = le16_to_cpu(ep->wMaxPacketSize); | 685 | desc->wMaxPacketSize = usb_endpoint_maxp(ep); |
| 686 | desc->bMaxPacketSize0 = udev->descriptor.bMaxPacketSize0; | 686 | desc->bMaxPacketSize0 = udev->descriptor.bMaxPacketSize0; |
| 687 | 687 | ||
| 688 | desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); | 688 | desc->orq = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL); |
| @@ -798,11 +798,11 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message) | |||
| 798 | dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor); | 798 | dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor); |
| 799 | 799 | ||
| 800 | /* if this is an autosuspend the caller does the locking */ | 800 | /* if this is an autosuspend the caller does the locking */ |
| 801 | if (!(message.event & PM_EVENT_AUTO)) | 801 | if (!PMSG_IS_AUTO(message)) |
| 802 | mutex_lock(&desc->lock); | 802 | mutex_lock(&desc->lock); |
| 803 | spin_lock_irq(&desc->iuspin); | 803 | spin_lock_irq(&desc->iuspin); |
| 804 | 804 | ||
| 805 | if ((message.event & PM_EVENT_AUTO) && | 805 | if (PMSG_IS_AUTO(message) && |
| 806 | (test_bit(WDM_IN_USE, &desc->flags) | 806 | (test_bit(WDM_IN_USE, &desc->flags) |
| 807 | || test_bit(WDM_RESPONDING, &desc->flags))) { | 807 | || test_bit(WDM_RESPONDING, &desc->flags))) { |
| 808 | spin_unlock_irq(&desc->iuspin); | 808 | spin_unlock_irq(&desc->iuspin); |
| @@ -815,7 +815,7 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message) | |||
| 815 | kill_urbs(desc); | 815 | kill_urbs(desc); |
| 816 | cancel_work_sync(&desc->rxwork); | 816 | cancel_work_sync(&desc->rxwork); |
| 817 | } | 817 | } |
| 818 | if (!(message.event & PM_EVENT_AUTO)) | 818 | if (!PMSG_IS_AUTO(message)) |
| 819 | mutex_unlock(&desc->lock); | 819 | mutex_unlock(&desc->lock); |
| 820 | 820 | ||
| 821 | return rv; | 821 | return rv; |
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index 9eca4053312e..cb3a93243a05 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c | |||
| @@ -58,6 +58,7 @@ | |||
| 58 | #include <linux/mutex.h> | 58 | #include <linux/mutex.h> |
| 59 | #undef DEBUG | 59 | #undef DEBUG |
| 60 | #include <linux/usb.h> | 60 | #include <linux/usb.h> |
| 61 | #include <linux/ratelimit.h> | ||
| 61 | 62 | ||
| 62 | /* | 63 | /* |
| 63 | * Version Information | 64 | * Version Information |
| @@ -348,8 +349,7 @@ static int usblp_check_status(struct usblp *usblp, int err) | |||
| 348 | mutex_lock(&usblp->mut); | 349 | mutex_lock(&usblp->mut); |
| 349 | if ((error = usblp_read_status(usblp, usblp->statusbuf)) < 0) { | 350 | if ((error = usblp_read_status(usblp, usblp->statusbuf)) < 0) { |
| 350 | mutex_unlock(&usblp->mut); | 351 | mutex_unlock(&usblp->mut); |
| 351 | if (printk_ratelimit()) | 352 | printk_ratelimited(KERN_ERR |
| 352 | printk(KERN_ERR | ||
| 353 | "usblp%d: error %d reading printer status\n", | 353 | "usblp%d: error %d reading printer status\n", |
| 354 | usblp->minor, error); | 354 | usblp->minor, error); |
| 355 | return 0; | 355 | return 0; |
| @@ -653,8 +653,7 @@ static long usblp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 653 | 653 | ||
| 654 | case LPGETSTATUS: | 654 | case LPGETSTATUS: |
| 655 | if ((retval = usblp_read_status(usblp, usblp->statusbuf))) { | 655 | if ((retval = usblp_read_status(usblp, usblp->statusbuf))) { |
| 656 | if (printk_ratelimit()) | 656 | printk_ratelimited(KERN_ERR "usblp%d:" |
| 657 | printk(KERN_ERR "usblp%d:" | ||
| 658 | "failed reading printer status (%d)\n", | 657 | "failed reading printer status (%d)\n", |
| 659 | usblp->minor, retval); | 658 | usblp->minor, retval); |
| 660 | retval = -EIO; | 659 | retval = -EIO; |
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 385acb895ab3..12cf5e7395a8 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c | |||
| @@ -186,8 +186,7 @@ static int usbtmc_ioctl_abort_bulk_in(struct usbtmc_device_data *data) | |||
| 186 | for (n = 0; n < current_setting->desc.bNumEndpoints; n++) | 186 | for (n = 0; n < current_setting->desc.bNumEndpoints; n++) |
| 187 | if (current_setting->endpoint[n].desc.bEndpointAddress == | 187 | if (current_setting->endpoint[n].desc.bEndpointAddress == |
| 188 | data->bulk_in) | 188 | data->bulk_in) |
| 189 | max_size = le16_to_cpu(current_setting->endpoint[n]. | 189 | max_size = usb_endpoint_maxp(¤t_setting->endpoint[n].desc); |
| 190 | desc.wMaxPacketSize); | ||
| 191 | 190 | ||
| 192 | if (max_size == 0) { | 191 | if (max_size == 0) { |
| 193 | dev_err(dev, "Couldn't get wMaxPacketSize\n"); | 192 | dev_err(dev, "Couldn't get wMaxPacketSize\n"); |
| @@ -268,7 +267,7 @@ usbtmc_abort_bulk_in_status: | |||
| 268 | dev_err(dev, "usb_bulk_msg returned %d\n", rv); | 267 | dev_err(dev, "usb_bulk_msg returned %d\n", rv); |
| 269 | goto exit; | 268 | goto exit; |
| 270 | } | 269 | } |
| 271 | } while ((actual = max_size) && | 270 | } while ((actual == max_size) && |
| 272 | (n < USBTMC_MAX_READS_TO_CLEAR_BULK_IN)); | 271 | (n < USBTMC_MAX_READS_TO_CLEAR_BULK_IN)); |
| 273 | 272 | ||
| 274 | if (actual == max_size) { | 273 | if (actual == max_size) { |
| @@ -636,7 +635,7 @@ static int usbtmc_ioctl_clear(struct usbtmc_device_data *data) | |||
| 636 | for (n = 0; n < current_setting->desc.bNumEndpoints; n++) { | 635 | for (n = 0; n < current_setting->desc.bNumEndpoints; n++) { |
| 637 | desc = ¤t_setting->endpoint[n].desc; | 636 | desc = ¤t_setting->endpoint[n].desc; |
| 638 | if (desc->bEndpointAddress == data->bulk_in) | 637 | if (desc->bEndpointAddress == data->bulk_in) |
| 639 | max_size = le16_to_cpu(desc->wMaxPacketSize); | 638 | max_size = usb_endpoint_maxp(desc); |
| 640 | } | 639 | } |
| 641 | 640 | ||
| 642 | if (max_size == 0) { | 641 | if (max_size == 0) { |
