aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-03 11:48:58 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-03 11:48:58 -0500
commit7f5b09c15ab989ed5ce4adda0be42c1302df70b7 (patch)
tree9695b00983d1bd077ff91c463abcb136330cf344 /drivers/usb/class
parent94468080220162f74dc6ce5c3e95e5fec8022902 (diff)
parentcedf8a78421943441b9011ce7bcdab55f07d2ea6 (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: (220 commits) USB: backlight, appledisplay: fix incomplete registration failure handling USB: pl2303: remove unnecessary reset of usb_device in urbs USB: ftdi_sio: remove obsolete check in unthrottle USB: ftdi_sio: remove unused tx_bytes counter USB: qcaux: driver for auxiliary serial ports on Qualcomm devices USB: pl2303: initial TIOCGSERIAL support USB: option: add Longcheer/Longsung vendor ID USB: fix I2C API usage in ohci-pnx4008. USB: usbmon: mask seconds properly in text API USB: sisusbvga: no unnecessary GFP_ATOMIC USB: storage: onetouch: unnecessary GFP_ATOMIC USB: serial: ftdi: add CONTEC vendor and product id USB: remove references to port->port.count from the serial drivers USB: tty: Prune uses of tty_request_room in the USB layer USB: tty: Add a function to insert a string of characters with the same flag USB: don't read past config->interface[] if usb_control_msg() fails in usb_reset_configuration() USB: tty: kill request_room for USB ACM class USB: tty: sort out the request_room handling for whiteheat USB: storage: fix misplaced parenthesis USB: vstusb.c: removal of driver for Vernier Software & Technology, Inc., devices and spectrometers ...
Diffstat (limited to 'drivers/usb/class')
-rw-r--r--drivers/usb/class/cdc-acm.c82
-rw-r--r--drivers/usb/class/cdc-acm.h2
-rw-r--r--drivers/usb/class/cdc-wdm.c2
-rw-r--r--drivers/usb/class/usblp.c22
-rw-r--r--drivers/usb/class/usbtmc.c2
5 files changed, 60 insertions, 50 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 34d4eb98829e..975d556b4787 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -170,6 +170,7 @@ static void acm_write_done(struct acm *acm, struct acm_wb *wb)
170{ 170{
171 wb->use = 0; 171 wb->use = 0;
172 acm->transmitting--; 172 acm->transmitting--;
173 usb_autopm_put_interface_async(acm->control);
173} 174}
174 175
175/* 176/*
@@ -211,9 +212,12 @@ static int acm_write_start(struct acm *acm, int wbn)
211 } 212 }
212 213
213 dbg("%s susp_count: %d", __func__, acm->susp_count); 214 dbg("%s susp_count: %d", __func__, acm->susp_count);
215 usb_autopm_get_interface_async(acm->control);
214 if (acm->susp_count) { 216 if (acm->susp_count) {
215 acm->delayed_wb = wb; 217 if (!acm->delayed_wb)
216 schedule_work(&acm->waker); 218 acm->delayed_wb = wb;
219 else
220 usb_autopm_put_interface_async(acm->control);
217 spin_unlock_irqrestore(&acm->write_lock, flags); 221 spin_unlock_irqrestore(&acm->write_lock, flags);
218 return 0; /* A white lie */ 222 return 0; /* A white lie */
219 } 223 }
@@ -424,7 +428,6 @@ next_buffer:
424 throttled = acm->throttle; 428 throttled = acm->throttle;
425 spin_unlock_irqrestore(&acm->throttle_lock, flags); 429 spin_unlock_irqrestore(&acm->throttle_lock, flags);
426 if (!throttled) { 430 if (!throttled) {
427 tty_buffer_request_room(tty, buf->size);
428 tty_insert_flip_string(tty, buf->base, buf->size); 431 tty_insert_flip_string(tty, buf->base, buf->size);
429 tty_flip_buffer_push(tty); 432 tty_flip_buffer_push(tty);
430 } else { 433 } else {
@@ -534,23 +537,6 @@ static void acm_softint(struct work_struct *work)
534 tty_kref_put(tty); 537 tty_kref_put(tty);
535} 538}
536 539
537static void acm_waker(struct work_struct *waker)
538{
539 struct acm *acm = container_of(waker, struct acm, waker);
540 int rv;
541
542 rv = usb_autopm_get_interface(acm->control);
543 if (rv < 0) {
544 dev_err(&acm->dev->dev, "Autopm failure in %s\n", __func__);
545 return;
546 }
547 if (acm->delayed_wb) {
548 acm_start_wb(acm, acm->delayed_wb);
549 acm->delayed_wb = NULL;
550 }
551 usb_autopm_put_interface(acm->control);
552}
553
554/* 540/*
555 * TTY handlers 541 * TTY handlers
556 */ 542 */
@@ -566,7 +552,7 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
566 552
567 acm = acm_table[tty->index]; 553 acm = acm_table[tty->index];
568 if (!acm || !acm->dev) 554 if (!acm || !acm->dev)
569 goto err_out; 555 goto out;
570 else 556 else
571 rv = 0; 557 rv = 0;
572 558
@@ -582,8 +568,9 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
582 568
583 mutex_lock(&acm->mutex); 569 mutex_lock(&acm->mutex);
584 if (acm->port.count++) { 570 if (acm->port.count++) {
571 mutex_unlock(&acm->mutex);
585 usb_autopm_put_interface(acm->control); 572 usb_autopm_put_interface(acm->control);
586 goto done; 573 goto out;
587 } 574 }
588 575
589 acm->ctrlurb->dev = acm->dev; 576 acm->ctrlurb->dev = acm->dev;
@@ -612,18 +599,18 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
612 set_bit(ASYNCB_INITIALIZED, &acm->port.flags); 599 set_bit(ASYNCB_INITIALIZED, &acm->port.flags);
613 rv = tty_port_block_til_ready(&acm->port, tty, filp); 600 rv = tty_port_block_til_ready(&acm->port, tty, filp);
614 tasklet_schedule(&acm->urb_task); 601 tasklet_schedule(&acm->urb_task);
615done: 602
616 mutex_unlock(&acm->mutex); 603 mutex_unlock(&acm->mutex);
617err_out: 604out:
618 mutex_unlock(&open_mutex); 605 mutex_unlock(&open_mutex);
619 return rv; 606 return rv;
620 607
621full_bailout: 608full_bailout:
622 usb_kill_urb(acm->ctrlurb); 609 usb_kill_urb(acm->ctrlurb);
623bail_out: 610bail_out:
624 usb_autopm_put_interface(acm->control);
625 acm->port.count--; 611 acm->port.count--;
626 mutex_unlock(&acm->mutex); 612 mutex_unlock(&acm->mutex);
613 usb_autopm_put_interface(acm->control);
627early_bail: 614early_bail:
628 mutex_unlock(&open_mutex); 615 mutex_unlock(&open_mutex);
629 tty_port_tty_set(&acm->port, NULL); 616 tty_port_tty_set(&acm->port, NULL);
@@ -1023,7 +1010,7 @@ static int acm_probe(struct usb_interface *intf,
1023 case USB_CDC_CALL_MANAGEMENT_TYPE: 1010 case USB_CDC_CALL_MANAGEMENT_TYPE:
1024 call_management_function = buffer[3]; 1011 call_management_function = buffer[3];
1025 call_interface_num = buffer[4]; 1012 call_interface_num = buffer[4];
1026 if ((call_management_function & 3) != 3) 1013 if ( (quirks & NOT_A_MODEM) == 0 && (call_management_function & 3) != 3)
1027 dev_err(&intf->dev, "This device cannot do calls on its own. It is not a modem.\n"); 1014 dev_err(&intf->dev, "This device cannot do calls on its own. It is not a modem.\n");
1028 break; 1015 break;
1029 default: 1016 default:
@@ -1178,7 +1165,6 @@ made_compressed_probe:
1178 acm->urb_task.func = acm_rx_tasklet; 1165 acm->urb_task.func = acm_rx_tasklet;
1179 acm->urb_task.data = (unsigned long) acm; 1166 acm->urb_task.data = (unsigned long) acm;
1180 INIT_WORK(&acm->work, acm_softint); 1167 INIT_WORK(&acm->work, acm_softint);
1181 INIT_WORK(&acm->waker, acm_waker);
1182 init_waitqueue_head(&acm->drain_wait); 1168 init_waitqueue_head(&acm->drain_wait);
1183 spin_lock_init(&acm->throttle_lock); 1169 spin_lock_init(&acm->throttle_lock);
1184 spin_lock_init(&acm->write_lock); 1170 spin_lock_init(&acm->write_lock);
@@ -1343,7 +1329,6 @@ static void stop_data_traffic(struct acm *acm)
1343 tasklet_enable(&acm->urb_task); 1329 tasklet_enable(&acm->urb_task);
1344 1330
1345 cancel_work_sync(&acm->work); 1331 cancel_work_sync(&acm->work);
1346 cancel_work_sync(&acm->waker);
1347} 1332}
1348 1333
1349static void acm_disconnect(struct usb_interface *intf) 1334static void acm_disconnect(struct usb_interface *intf)
@@ -1435,6 +1420,7 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message)
1435static int acm_resume(struct usb_interface *intf) 1420static int acm_resume(struct usb_interface *intf)
1436{ 1421{
1437 struct acm *acm = usb_get_intfdata(intf); 1422 struct acm *acm = usb_get_intfdata(intf);
1423 struct acm_wb *wb;
1438 int rv = 0; 1424 int rv = 0;
1439 int cnt; 1425 int cnt;
1440 1426
@@ -1449,6 +1435,21 @@ static int acm_resume(struct usb_interface *intf)
1449 mutex_lock(&acm->mutex); 1435 mutex_lock(&acm->mutex);
1450 if (acm->port.count) { 1436 if (acm->port.count) {
1451 rv = usb_submit_urb(acm->ctrlurb, GFP_NOIO); 1437 rv = usb_submit_urb(acm->ctrlurb, GFP_NOIO);
1438
1439 spin_lock_irq(&acm->write_lock);
1440 if (acm->delayed_wb) {
1441 wb = acm->delayed_wb;
1442 acm->delayed_wb = NULL;
1443 spin_unlock_irq(&acm->write_lock);
1444 acm_start_wb(acm, acm->delayed_wb);
1445 } else {
1446 spin_unlock_irq(&acm->write_lock);
1447 }
1448
1449 /*
1450 * delayed error checking because we must
1451 * do the write path at all cost
1452 */
1452 if (rv < 0) 1453 if (rv < 0)
1453 goto err_out; 1454 goto err_out;
1454 1455
@@ -1460,6 +1461,23 @@ err_out:
1460 return rv; 1461 return rv;
1461} 1462}
1462 1463
1464static int acm_reset_resume(struct usb_interface *intf)
1465{
1466 struct acm *acm = usb_get_intfdata(intf);
1467 struct tty_struct *tty;
1468
1469 mutex_lock(&acm->mutex);
1470 if (acm->port.count) {
1471 tty = tty_port_tty_get(&acm->port);
1472 if (tty) {
1473 tty_hangup(tty);
1474 tty_kref_put(tty);
1475 }
1476 }
1477 mutex_unlock(&acm->mutex);
1478 return acm_resume(intf);
1479}
1480
1463#endif /* CONFIG_PM */ 1481#endif /* CONFIG_PM */
1464 1482
1465#define NOKIA_PCSUITE_ACM_INFO(x) \ 1483#define NOKIA_PCSUITE_ACM_INFO(x) \
@@ -1471,7 +1489,7 @@ err_out:
1471 * USB driver structure. 1489 * USB driver structure.
1472 */ 1490 */
1473 1491
1474static struct usb_device_id acm_ids[] = { 1492static const struct usb_device_id acm_ids[] = {
1475 /* quirky and broken devices */ 1493 /* quirky and broken devices */
1476 { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ 1494 { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */
1477 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ 1495 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
@@ -1576,6 +1594,11 @@ static struct usb_device_id acm_ids[] = {
1576 1594
1577 /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */ 1595 /* NOTE: non-Nokia COMM/ACM/0xff is likely MSFT RNDIS... NOT a modem! */
1578 1596
1597 /* Support Lego NXT using pbLua firmware */
1598 { USB_DEVICE(0x0694, 0xff00),
1599 .driver_info = NOT_A_MODEM,
1600 },
1601
1579 /* control interfaces with various AT-command sets */ 1602 /* control interfaces with various AT-command sets */
1580 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, 1603 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
1581 USB_CDC_ACM_PROTO_AT_V25TER) }, 1604 USB_CDC_ACM_PROTO_AT_V25TER) },
@@ -1602,6 +1625,7 @@ static struct usb_driver acm_driver = {
1602#ifdef CONFIG_PM 1625#ifdef CONFIG_PM
1603 .suspend = acm_suspend, 1626 .suspend = acm_suspend,
1604 .resume = acm_resume, 1627 .resume = acm_resume,
1628 .reset_resume = acm_reset_resume,
1605#endif 1629#endif
1606 .id_table = acm_ids, 1630 .id_table = acm_ids,
1607#ifdef CONFIG_PM 1631#ifdef CONFIG_PM
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
index c4a0ee8ffccf..4a8e87ec6ce9 100644
--- a/drivers/usb/class/cdc-acm.h
+++ b/drivers/usb/class/cdc-acm.h
@@ -112,7 +112,6 @@ struct acm {
112 struct mutex mutex; 112 struct mutex mutex;
113 struct usb_cdc_line_coding line; /* bits, stop, parity */ 113 struct usb_cdc_line_coding line; /* bits, stop, parity */
114 struct work_struct work; /* work queue entry for line discipline waking up */ 114 struct work_struct work; /* work queue entry for line discipline waking up */
115 struct work_struct waker;
116 wait_queue_head_t drain_wait; /* close processing */ 115 wait_queue_head_t drain_wait; /* close processing */
117 struct tasklet_struct urb_task; /* rx processing */ 116 struct tasklet_struct urb_task; /* rx processing */
118 spinlock_t throttle_lock; /* synchronize throtteling and read callback */ 117 spinlock_t throttle_lock; /* synchronize throtteling and read callback */
@@ -137,3 +136,4 @@ struct acm {
137#define NO_UNION_NORMAL 1 136#define NO_UNION_NORMAL 1
138#define SINGLE_RX_URB 2 137#define SINGLE_RX_URB 2
139#define NO_CAP_LINE 4 138#define NO_CAP_LINE 4
139#define NOT_A_MODEM 8
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 3e564bfe17d1..18aafcb08fc8 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -31,7 +31,7 @@
31#define DRIVER_AUTHOR "Oliver Neukum" 31#define DRIVER_AUTHOR "Oliver Neukum"
32#define DRIVER_DESC "USB Abstract Control Model driver for USB WCM Device Management" 32#define DRIVER_DESC "USB Abstract Control Model driver for USB WCM Device Management"
33 33
34static struct usb_device_id wdm_ids[] = { 34static const struct usb_device_id wdm_ids[] = {
35 { 35 {
36 .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS | 36 .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS |
37 USB_DEVICE_ID_MATCH_INT_SUBCLASS, 37 USB_DEVICE_ID_MATCH_INT_SUBCLASS,
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 9bc112ee7803..93b5f85d7ceb 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -163,7 +163,6 @@ struct usblp {
163 unsigned char used; /* True if open */ 163 unsigned char used; /* True if open */
164 unsigned char present; /* True if not disconnected */ 164 unsigned char present; /* True if not disconnected */
165 unsigned char bidir; /* interface is bidirectional */ 165 unsigned char bidir; /* interface is bidirectional */
166 unsigned char sleeping; /* interface is suspended */
167 unsigned char no_paper; /* Paper Out happened */ 166 unsigned char no_paper; /* Paper Out happened */
168 unsigned char *device_id_string; /* IEEE 1284 DEVICE ID string (ptr) */ 167 unsigned char *device_id_string; /* IEEE 1284 DEVICE ID string (ptr) */
169 /* first 2 bytes are (big-endian) length */ 168 /* first 2 bytes are (big-endian) length */
@@ -191,7 +190,6 @@ static void usblp_dump(struct usblp *usblp) {
191 dbg("quirks=%d", usblp->quirks); 190 dbg("quirks=%d", usblp->quirks);
192 dbg("used=%d", usblp->used); 191 dbg("used=%d", usblp->used);
193 dbg("bidir=%d", usblp->bidir); 192 dbg("bidir=%d", usblp->bidir);
194 dbg("sleeping=%d", usblp->sleeping);
195 dbg("device_id_string=\"%s\"", 193 dbg("device_id_string=\"%s\"",
196 usblp->device_id_string ? 194 usblp->device_id_string ?
197 usblp->device_id_string + 2 : 195 usblp->device_id_string + 2 :
@@ -376,7 +374,7 @@ static int usblp_check_status(struct usblp *usblp, int err)
376 374
377static int handle_bidir (struct usblp *usblp) 375static int handle_bidir (struct usblp *usblp)
378{ 376{
379 if (usblp->bidir && usblp->used && !usblp->sleeping) { 377 if (usblp->bidir && usblp->used) {
380 if (usblp_submit_read(usblp) < 0) 378 if (usblp_submit_read(usblp) < 0)
381 return -EIO; 379 return -EIO;
382 } 380 }
@@ -503,11 +501,6 @@ static long usblp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
503 goto done; 501 goto done;
504 } 502 }
505 503
506 if (usblp->sleeping) {
507 retval = -ENODEV;
508 goto done;
509 }
510
511 dbg("usblp_ioctl: cmd=0x%x (%c nr=%d len=%d dir=%d)", cmd, _IOC_TYPE(cmd), 504 dbg("usblp_ioctl: cmd=0x%x (%c nr=%d len=%d dir=%d)", cmd, _IOC_TYPE(cmd),
512 _IOC_NR(cmd), _IOC_SIZE(cmd), _IOC_DIR(cmd) ); 505 _IOC_NR(cmd), _IOC_SIZE(cmd), _IOC_DIR(cmd) );
513 506
@@ -914,8 +907,6 @@ static int usblp_wtest(struct usblp *usblp, int nonblock)
914 return 0; 907 return 0;
915 } 908 }
916 spin_unlock_irqrestore(&usblp->lock, flags); 909 spin_unlock_irqrestore(&usblp->lock, flags);
917 if (usblp->sleeping)
918 return -ENODEV;
919 if (nonblock) 910 if (nonblock)
920 return -EAGAIN; 911 return -EAGAIN;
921 return 1; 912 return 1;
@@ -968,8 +959,6 @@ static int usblp_rtest(struct usblp *usblp, int nonblock)
968 return 0; 959 return 0;
969 } 960 }
970 spin_unlock_irqrestore(&usblp->lock, flags); 961 spin_unlock_irqrestore(&usblp->lock, flags);
971 if (usblp->sleeping)
972 return -ENODEV;
973 if (nonblock) 962 if (nonblock)
974 return -EAGAIN; 963 return -EAGAIN;
975 return 1; 964 return 1;
@@ -1377,12 +1366,10 @@ static void usblp_disconnect(struct usb_interface *intf)
1377 mutex_unlock (&usblp_mutex); 1366 mutex_unlock (&usblp_mutex);
1378} 1367}
1379 1368
1380static int usblp_suspend (struct usb_interface *intf, pm_message_t message) 1369static int usblp_suspend(struct usb_interface *intf, pm_message_t message)
1381{ 1370{
1382 struct usblp *usblp = usb_get_intfdata (intf); 1371 struct usblp *usblp = usb_get_intfdata (intf);
1383 1372
1384 /* we take no more IO */
1385 usblp->sleeping = 1;
1386 usblp_unlink_urbs(usblp); 1373 usblp_unlink_urbs(usblp);
1387#if 0 /* XXX Do we want this? What if someone is reading, should we fail? */ 1374#if 0 /* XXX Do we want this? What if someone is reading, should we fail? */
1388 /* not strictly necessary, but just in case */ 1375 /* not strictly necessary, but just in case */
@@ -1393,18 +1380,17 @@ static int usblp_suspend (struct usb_interface *intf, pm_message_t message)
1393 return 0; 1380 return 0;
1394} 1381}
1395 1382
1396static int usblp_resume (struct usb_interface *intf) 1383static int usblp_resume(struct usb_interface *intf)
1397{ 1384{
1398 struct usblp *usblp = usb_get_intfdata (intf); 1385 struct usblp *usblp = usb_get_intfdata (intf);
1399 int r; 1386 int r;
1400 1387
1401 usblp->sleeping = 0;
1402 r = handle_bidir (usblp); 1388 r = handle_bidir (usblp);
1403 1389
1404 return r; 1390 return r;
1405} 1391}
1406 1392
1407static struct usb_device_id usblp_ids [] = { 1393static const struct usb_device_id usblp_ids[] = {
1408 { USB_DEVICE_INFO(7, 1, 1) }, 1394 { USB_DEVICE_INFO(7, 1, 1) },
1409 { USB_DEVICE_INFO(7, 1, 2) }, 1395 { USB_DEVICE_INFO(7, 1, 2) },
1410 { USB_DEVICE_INFO(7, 1, 3) }, 1396 { USB_DEVICE_INFO(7, 1, 3) },
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 7c5f4e32c920..8588c0937a89 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -48,7 +48,7 @@
48 */ 48 */
49#define USBTMC_MAX_READS_TO_CLEAR_BULK_IN 100 49#define USBTMC_MAX_READS_TO_CLEAR_BULK_IN 100
50 50
51static struct usb_device_id usbtmc_devices[] = { 51static const struct usb_device_id usbtmc_devices[] = {
52 { USB_INTERFACE_INFO(USB_CLASS_APP_SPEC, 3, 0), }, 52 { USB_INTERFACE_INFO(USB_CLASS_APP_SPEC, 3, 0), },
53 { USB_INTERFACE_INFO(USB_CLASS_APP_SPEC, 3, 1), }, 53 { USB_INTERFACE_INFO(USB_CLASS_APP_SPEC, 3, 1), },
54 { 0, } /* terminating entry */ 54 { 0, } /* terminating entry */