aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-02-17 10:05:47 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 17:55:12 -0500
commit1f87158e44e79e62c8250f278c225ce4ab695f4b (patch)
treeeff328f63a75993a3e1ffbba9c9f0ba1fecf0edb /drivers/usb/serial
parenta108bfcb372d8c4452701039308fb95747911c59 (diff)
USB: remove references to port->port.count from the serial drivers
This patch (as1344) removes references to port->port.count from the USB serial drivers. Now that serial ports are properly reference counted, port.count checking is unnecessary and incorrect. Drivers should assume that the port is in use from the time the open method runs until the close method is called. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/aircable.c34
-rw-r--r--drivers/usb/serial/cypress_m8.c6
-rw-r--r--drivers/usb/serial/digi_acceleport.c19
-rw-r--r--drivers/usb/serial/generic.c3
-rw-r--r--drivers/usb/serial/ir-usb.c5
-rw-r--r--drivers/usb/serial/keyspan.c57
-rw-r--r--drivers/usb/serial/option.c4
-rw-r--r--drivers/usb/serial/oti6858.c21
-rw-r--r--drivers/usb/serial/pl2303.c18
-rw-r--r--drivers/usb/serial/sierra.c8
-rw-r--r--drivers/usb/serial/spcp8x5.c17
11 files changed, 66 insertions, 126 deletions
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
index 2cbdc8f230b8..365db1097bfd 100644
--- a/drivers/usb/serial/aircable.c
+++ b/drivers/usb/serial/aircable.c
@@ -468,10 +468,6 @@ static void aircable_read_bulk_callback(struct urb *urb)
468 468
469 if (status) { 469 if (status) {
470 dbg("%s - urb status = %d", __func__, status); 470 dbg("%s - urb status = %d", __func__, status);
471 if (!port->port.count) {
472 dbg("%s - port is closed, exiting.", __func__);
473 return;
474 }
475 if (status == -EPROTO) { 471 if (status == -EPROTO) {
476 dbg("%s - caught -EPROTO, resubmitting the urb", 472 dbg("%s - caught -EPROTO, resubmitting the urb",
477 __func__); 473 __func__);
@@ -530,23 +526,19 @@ static void aircable_read_bulk_callback(struct urb *urb)
530 } 526 }
531 tty_kref_put(tty); 527 tty_kref_put(tty);
532 528
533 /* Schedule the next read _if_ we are still open */ 529 /* Schedule the next read */
534 if (port->port.count) { 530 usb_fill_bulk_urb(port->read_urb, port->serial->dev,
535 usb_fill_bulk_urb(port->read_urb, port->serial->dev, 531 usb_rcvbulkpipe(port->serial->dev,
536 usb_rcvbulkpipe(port->serial->dev, 532 port->bulk_in_endpointAddress),
537 port->bulk_in_endpointAddress), 533 port->read_urb->transfer_buffer,
538 port->read_urb->transfer_buffer, 534 port->read_urb->transfer_buffer_length,
539 port->read_urb->transfer_buffer_length, 535 aircable_read_bulk_callback, port);
540 aircable_read_bulk_callback, port); 536
541 537 result = usb_submit_urb(urb, GFP_ATOMIC);
542 result = usb_submit_urb(urb, GFP_ATOMIC); 538 if (result && result != -EPERM)
543 if (result) 539 dev_err(&urb->dev->dev,
544 dev_err(&urb->dev->dev, 540 "%s - failed resubmitting read urb, error %d\n",
545 "%s - failed resubmitting read urb, error %d\n", 541 __func__, result);
546 __func__, result);
547 }
548
549 return;
550} 542}
551 543
552/* Based on ftdi_sio.c throttle */ 544/* Based on ftdi_sio.c throttle */
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 3a5d57f89dee..baf74b44e6ed 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -1321,9 +1321,9 @@ static void cypress_read_int_callback(struct urb *urb)
1321continue_read: 1321continue_read:
1322 tty_kref_put(tty); 1322 tty_kref_put(tty);
1323 1323
1324 /* Continue trying to always read... unless the port has closed. */ 1324 /* Continue trying to always read */
1325 1325
1326 if (port->port.count > 0 && priv->comm_is_ok) { 1326 if (priv->comm_is_ok) {
1327 usb_fill_int_urb(port->interrupt_in_urb, port->serial->dev, 1327 usb_fill_int_urb(port->interrupt_in_urb, port->serial->dev,
1328 usb_rcvintpipe(port->serial->dev, 1328 usb_rcvintpipe(port->serial->dev,
1329 port->interrupt_in_endpointAddress), 1329 port->interrupt_in_endpointAddress),
@@ -1332,7 +1332,7 @@ continue_read:
1332 cypress_read_int_callback, port, 1332 cypress_read_int_callback, port,
1333 priv->read_urb_interval); 1333 priv->read_urb_interval);
1334 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 1334 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
1335 if (result) { 1335 if (result && result != -EPERM) {
1336 dev_err(&urb->dev->dev, "%s - failed resubmitting " 1336 dev_err(&urb->dev->dev, "%s - failed resubmitting "
1337 "read urb, error %d\n", __func__, 1337 "read urb, error %d\n", __func__,
1338 result); 1338 result);
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index 381722858424..68b0aa5e516c 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -1262,10 +1262,10 @@ static void digi_write_bulk_callback(struct urb *urb)
1262 return; 1262 return;
1263 } 1263 }
1264 1264
1265 /* try to send any buffered data on this port, if it is open */ 1265 /* try to send any buffered data on this port */
1266 spin_lock(&priv->dp_port_lock); 1266 spin_lock(&priv->dp_port_lock);
1267 priv->dp_write_urb_in_use = 0; 1267 priv->dp_write_urb_in_use = 0;
1268 if (port->port.count && priv->dp_out_buf_len > 0) { 1268 if (priv->dp_out_buf_len > 0) {
1269 *((unsigned char *)(port->write_urb->transfer_buffer)) 1269 *((unsigned char *)(port->write_urb->transfer_buffer))
1270 = (unsigned char)DIGI_CMD_SEND_DATA; 1270 = (unsigned char)DIGI_CMD_SEND_DATA;
1271 *((unsigned char *)(port->write_urb->transfer_buffer) + 1) 1271 *((unsigned char *)(port->write_urb->transfer_buffer) + 1)
@@ -1288,7 +1288,7 @@ static void digi_write_bulk_callback(struct urb *urb)
1288 schedule_work(&priv->dp_wakeup_work); 1288 schedule_work(&priv->dp_wakeup_work);
1289 1289
1290 spin_unlock(&priv->dp_port_lock); 1290 spin_unlock(&priv->dp_port_lock);
1291 if (ret) 1291 if (ret && ret != -EPERM)
1292 dev_err(&port->dev, 1292 dev_err(&port->dev,
1293 "%s: usb_submit_urb failed, ret=%d, port=%d\n", 1293 "%s: usb_submit_urb failed, ret=%d, port=%d\n",
1294 __func__, ret, priv->dp_port_num); 1294 __func__, ret, priv->dp_port_num);
@@ -1353,8 +1353,7 @@ static int digi_open(struct tty_struct *tty, struct usb_serial_port *port)
1353 struct digi_port *priv = usb_get_serial_port_data(port); 1353 struct digi_port *priv = usb_get_serial_port_data(port);
1354 struct ktermios not_termios; 1354 struct ktermios not_termios;
1355 1355
1356 dbg("digi_open: TOP: port=%d, open_count=%d", 1356 dbg("digi_open: TOP: port=%d", priv->dp_port_num);
1357 priv->dp_port_num, port->port.count);
1358 1357
1359 /* be sure the device is started up */ 1358 /* be sure the device is started up */
1360 if (digi_startup_device(port->serial) != 0) 1359 if (digi_startup_device(port->serial) != 0)
@@ -1393,8 +1392,7 @@ static void digi_close(struct usb_serial_port *port)
1393 unsigned char buf[32]; 1392 unsigned char buf[32];
1394 struct digi_port *priv = usb_get_serial_port_data(port); 1393 struct digi_port *priv = usb_get_serial_port_data(port);
1395 1394
1396 dbg("digi_close: TOP: port=%d, open_count=%d", 1395 dbg("digi_close: TOP: port=%d", priv->dp_port_num);
1397 priv->dp_port_num, port->port.count);
1398 1396
1399 mutex_lock(&port->serial->disc_mutex); 1397 mutex_lock(&port->serial->disc_mutex);
1400 /* if disconnected, just clear flags */ 1398 /* if disconnected, just clear flags */
@@ -1629,7 +1627,7 @@ static void digi_read_bulk_callback(struct urb *urb)
1629 /* continue read */ 1627 /* continue read */
1630 urb->dev = port->serial->dev; 1628 urb->dev = port->serial->dev;
1631 ret = usb_submit_urb(urb, GFP_ATOMIC); 1629 ret = usb_submit_urb(urb, GFP_ATOMIC);
1632 if (ret != 0) { 1630 if (ret != 0 && ret != -EPERM) {
1633 dev_err(&port->dev, 1631 dev_err(&port->dev,
1634 "%s: failed resubmitting urb, ret=%d, port=%d\n", 1632 "%s: failed resubmitting urb, ret=%d, port=%d\n",
1635 __func__, ret, priv->dp_port_num); 1633 __func__, ret, priv->dp_port_num);
@@ -1662,7 +1660,7 @@ static int digi_read_inb_callback(struct urb *urb)
1662 1660
1663 /* do not process callbacks on closed ports */ 1661 /* do not process callbacks on closed ports */
1664 /* but do continue the read chain */ 1662 /* but do continue the read chain */
1665 if (port->port.count == 0) 1663 if (urb->status == -ENOENT)
1666 return 0; 1664 return 0;
1667 1665
1668 /* short/multiple packet check */ 1666 /* short/multiple packet check */
@@ -1767,8 +1765,7 @@ static int digi_read_oob_callback(struct urb *urb)
1767 1765
1768 tty = tty_port_tty_get(&port->port); 1766 tty = tty_port_tty_get(&port->port);
1769 rts = 0; 1767 rts = 0;
1770 if (port->port.count) 1768 rts = tty->termios->c_cflag & CRTSCTS;
1771 rts = tty->termios->c_cflag & CRTSCTS;
1772 1769
1773 if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) { 1770 if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) {
1774 spin_lock(&priv->dp_port_lock); 1771 spin_lock(&priv->dp_port_lock);
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 5288203d883f..89fac36684c5 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -20,6 +20,7 @@
20#include <linux/usb/serial.h> 20#include <linux/usb/serial.h>
21#include <linux/uaccess.h> 21#include <linux/uaccess.h>
22#include <linux/kfifo.h> 22#include <linux/kfifo.h>
23#include <linux/serial.h>
23 24
24static int debug; 25static int debug;
25 26
@@ -585,7 +586,7 @@ int usb_serial_generic_resume(struct usb_serial *serial)
585 586
586 for (i = 0; i < serial->num_ports; i++) { 587 for (i = 0; i < serial->num_ports; i++) {
587 port = serial->port[i]; 588 port = serial->port[i];
588 if (!port->port.count) 589 if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags))
589 continue; 590 continue;
590 591
591 if (port->read_urb) { 592 if (port->read_urb) {
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index c3e5d506aead..4a0f51974232 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -445,11 +445,6 @@ static void ir_read_bulk_callback(struct urb *urb)
445 445
446 dbg("%s - port %d", __func__, port->number); 446 dbg("%s - port %d", __func__, port->number);
447 447
448 if (!port->port.count) {
449 dbg("%s - port closed.", __func__);
450 return;
451 }
452
453 switch (status) { 448 switch (status) {
454 case 0: /* Successful */ 449 case 0: /* Successful */
455 /* 450 /*
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index f8c4b07033ff..297163c3c610 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -464,13 +464,9 @@ static void usa26_indat_callback(struct urb *urb)
464 464
465 /* Resubmit urb so we continue receiving */ 465 /* Resubmit urb so we continue receiving */
466 urb->dev = port->serial->dev; 466 urb->dev = port->serial->dev;
467 if (port->port.count) { 467 err = usb_submit_urb(urb, GFP_ATOMIC);
468 err = usb_submit_urb(urb, GFP_ATOMIC); 468 if (err != 0)
469 if (err != 0) 469 dbg("%s - resubmit read urb failed. (%d)", __func__, err);
470 dbg("%s - resubmit read urb failed. (%d)",
471 __func__, err);
472 }
473 return;
474} 470}
475 471
476/* Outdat handling is common for all devices */ 472/* Outdat handling is common for all devices */
@@ -483,8 +479,7 @@ static void usa2x_outdat_callback(struct urb *urb)
483 p_priv = usb_get_serial_port_data(port); 479 p_priv = usb_get_serial_port_data(port);
484 dbg("%s - urb %d", __func__, urb == p_priv->out_urbs[1]); 480 dbg("%s - urb %d", __func__, urb == p_priv->out_urbs[1]);
485 481
486 if (port->port.count) 482 usb_serial_port_softint(port);
487 usb_serial_port_softint(port);
488} 483}
489 484
490static void usa26_inack_callback(struct urb *urb) 485static void usa26_inack_callback(struct urb *urb)
@@ -615,12 +610,10 @@ static void usa28_indat_callback(struct urb *urb)
615 610
616 /* Resubmit urb so we continue receiving */ 611 /* Resubmit urb so we continue receiving */
617 urb->dev = port->serial->dev; 612 urb->dev = port->serial->dev;
618 if (port->port.count) { 613 err = usb_submit_urb(urb, GFP_ATOMIC);
619 err = usb_submit_urb(urb, GFP_ATOMIC); 614 if (err != 0)
620 if (err != 0) 615 dbg("%s - resubmit read urb failed. (%d)",
621 dbg("%s - resubmit read urb failed. (%d)", 616 __func__, err);
622 __func__, err);
623 }
624 p_priv->in_flip ^= 1; 617 p_priv->in_flip ^= 1;
625 618
626 urb = p_priv->in_urbs[p_priv->in_flip]; 619 urb = p_priv->in_urbs[p_priv->in_flip];
@@ -856,12 +849,9 @@ static void usa49_indat_callback(struct urb *urb)
856 849
857 /* Resubmit urb so we continue receiving */ 850 /* Resubmit urb so we continue receiving */
858 urb->dev = port->serial->dev; 851 urb->dev = port->serial->dev;
859 if (port->port.count) { 852 err = usb_submit_urb(urb, GFP_ATOMIC);
860 err = usb_submit_urb(urb, GFP_ATOMIC); 853 if (err != 0)
861 if (err != 0) 854 dbg("%s - resubmit read urb failed. (%d)", __func__, err);
862 dbg("%s - resubmit read urb failed. (%d)",
863 __func__, err);
864 }
865} 855}
866 856
867static void usa49wg_indat_callback(struct urb *urb) 857static void usa49wg_indat_callback(struct urb *urb)
@@ -904,11 +894,7 @@ static void usa49wg_indat_callback(struct urb *urb)
904 /* no error on any byte */ 894 /* no error on any byte */
905 i++; 895 i++;
906 for (x = 1; x < len ; ++x) 896 for (x = 1; x < len ; ++x)
907 if (port->port.count) 897 tty_insert_flip_char(tty, data[i++], 0);
908 tty_insert_flip_char(tty,
909 data[i++], 0);
910 else
911 i++;
912 } else { 898 } else {
913 /* 899 /*
914 * some bytes had errors, every byte has status 900 * some bytes had errors, every byte has status
@@ -922,14 +908,12 @@ static void usa49wg_indat_callback(struct urb *urb)
922 if (stat & RXERROR_PARITY) 908 if (stat & RXERROR_PARITY)
923 flag |= TTY_PARITY; 909 flag |= TTY_PARITY;
924 /* XXX should handle break (0x10) */ 910 /* XXX should handle break (0x10) */
925 if (port->port.count) 911 tty_insert_flip_char(tty,
926 tty_insert_flip_char(tty,
927 data[i+1], flag); 912 data[i+1], flag);
928 i += 2; 913 i += 2;
929 } 914 }
930 } 915 }
931 if (port->port.count) 916 tty_flip_buffer_push(tty);
932 tty_flip_buffer_push(tty);
933 tty_kref_put(tty); 917 tty_kref_put(tty);
934 } 918 }
935 } 919 }
@@ -1013,13 +997,9 @@ static void usa90_indat_callback(struct urb *urb)
1013 997
1014 /* Resubmit urb so we continue receiving */ 998 /* Resubmit urb so we continue receiving */
1015 urb->dev = port->serial->dev; 999 urb->dev = port->serial->dev;
1016 if (port->port.count) { 1000 err = usb_submit_urb(urb, GFP_ATOMIC);
1017 err = usb_submit_urb(urb, GFP_ATOMIC); 1001 if (err != 0)
1018 if (err != 0) 1002 dbg("%s - resubmit read urb failed. (%d)", __func__, err);
1019 dbg("%s - resubmit read urb failed. (%d)",
1020 __func__, err);
1021 }
1022 return;
1023} 1003}
1024 1004
1025 1005
@@ -2418,8 +2398,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
2418 msg.portEnabled = 0; 2398 msg.portEnabled = 0;
2419 /* Sending intermediate configs */ 2399 /* Sending intermediate configs */
2420 else { 2400 else {
2421 if (port->port.count) 2401 msg.portEnabled = 1;
2422 msg.portEnabled = 1;
2423 msg.txBreak = (p_priv->break_on); 2402 msg.txBreak = (p_priv->break_on);
2424 } 2403 }
2425 2404
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 68c7457a98ae..db0541c5df79 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -971,9 +971,9 @@ static void option_indat_callback(struct urb *urb)
971 tty_kref_put(tty); 971 tty_kref_put(tty);
972 972
973 /* Resubmit urb so we continue receiving */ 973 /* Resubmit urb so we continue receiving */
974 if (port->port.count && status != -ESHUTDOWN) { 974 if (status != -ESHUTDOWN) {
975 err = usb_submit_urb(urb, GFP_ATOMIC); 975 err = usb_submit_urb(urb, GFP_ATOMIC);
976 if (err) 976 if (err && err != -EPERM)
977 printk(KERN_ERR "%s: resubmit read urb failed. " 977 printk(KERN_ERR "%s: resubmit read urb failed. "
978 "(%d)", __func__, err); 978 "(%d)", __func__, err);
979 else 979 else
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index 839733431832..deeacdea05db 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -585,9 +585,6 @@ static int oti6858_open(struct tty_struct *tty, struct usb_serial_port *port)
585 usb_clear_halt(serial->dev, port->write_urb->pipe); 585 usb_clear_halt(serial->dev, port->write_urb->pipe);
586 usb_clear_halt(serial->dev, port->read_urb->pipe); 586 usb_clear_halt(serial->dev, port->read_urb->pipe);
587 587
588 if (port->port.count != 1)
589 return 0;
590
591 buf = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL); 588 buf = kmalloc(OTI6858_CTRL_PKT_SIZE, GFP_KERNEL);
592 if (buf == NULL) { 589 if (buf == NULL) {
593 dev_err(&port->dev, "%s(): out of memory!\n", __func__); 590 dev_err(&port->dev, "%s(): out of memory!\n", __func__);
@@ -934,10 +931,6 @@ static void oti6858_read_bulk_callback(struct urb *urb)
934 spin_unlock_irqrestore(&priv->lock, flags); 931 spin_unlock_irqrestore(&priv->lock, flags);
935 932
936 if (status != 0) { 933 if (status != 0) {
937 if (!port->port.count) {
938 dbg("%s(): port is closed, exiting", __func__);
939 return;
940 }
941 /* 934 /*
942 if (status == -EPROTO) { 935 if (status == -EPROTO) {
943 * PL2303 mysteriously fails with -EPROTO reschedule 936 * PL2303 mysteriously fails with -EPROTO reschedule
@@ -961,14 +954,12 @@ static void oti6858_read_bulk_callback(struct urb *urb)
961 } 954 }
962 tty_kref_put(tty); 955 tty_kref_put(tty);
963 956
964 /* schedule the interrupt urb if we are still open */ 957 /* schedule the interrupt urb */
965 if (port->port.count != 0) { 958 port->interrupt_in_urb->dev = port->serial->dev;
966 port->interrupt_in_urb->dev = port->serial->dev; 959 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
967 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 960 if (result != 0 && result != -EPERM) {
968 if (result != 0) { 961 dev_err(&port->dev, "%s(): usb_submit_urb() failed,"
969 dev_err(&port->dev, "%s(): usb_submit_urb() failed," 962 " error %d\n", __func__, result);
970 " error %d\n", __func__, result);
971 }
972 } 963 }
973} 964}
974 965
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index a3e5a56dc066..571dcf182866 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -1071,10 +1071,6 @@ static void pl2303_read_bulk_callback(struct urb *urb)
1071 1071
1072 if (status) { 1072 if (status) {
1073 dbg("%s - urb status = %d", __func__, status); 1073 dbg("%s - urb status = %d", __func__, status);
1074 if (!port->port.count) {
1075 dbg("%s - port is closed, exiting.", __func__);
1076 return;
1077 }
1078 if (status == -EPROTO) { 1074 if (status == -EPROTO) {
1079 /* PL2303 mysteriously fails with -EPROTO reschedule 1075 /* PL2303 mysteriously fails with -EPROTO reschedule
1080 * the read */ 1076 * the read */
@@ -1107,15 +1103,11 @@ static void pl2303_read_bulk_callback(struct urb *urb)
1107 } 1103 }
1108 tty_kref_put(tty); 1104 tty_kref_put(tty);
1109 /* Schedule the next read _if_ we are still open */ 1105 /* Schedule the next read _if_ we are still open */
1110 if (port->port.count) { 1106 urb->dev = port->serial->dev;
1111 urb->dev = port->serial->dev; 1107 result = usb_submit_urb(urb, GFP_ATOMIC);
1112 result = usb_submit_urb(urb, GFP_ATOMIC); 1108 if (result && result != -EPERM)
1113 if (result) 1109 dev_err(&urb->dev->dev, "%s - failed resubmitting"
1114 dev_err(&urb->dev->dev, "%s - failed resubmitting" 1110 " read urb, error %d\n", __func__, result);
1115 " read urb, error %d\n", __func__, result);
1116 }
1117
1118 return;
1119} 1111}
1120 1112
1121static void pl2303_write_bulk_callback(struct urb *urb) 1113static void pl2303_write_bulk_callback(struct urb *urb)
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index c012e51665bd..34e6f894cba9 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -610,10 +610,10 @@ static void sierra_indat_callback(struct urb *urb)
610 } 610 }
611 611
612 /* Resubmit urb so we continue receiving */ 612 /* Resubmit urb so we continue receiving */
613 if (port->port.count && status != -ESHUTDOWN && status != -EPERM) { 613 if (status != -ESHUTDOWN && status != -EPERM) {
614 usb_mark_last_busy(port->serial->dev); 614 usb_mark_last_busy(port->serial->dev);
615 err = usb_submit_urb(urb, GFP_ATOMIC); 615 err = usb_submit_urb(urb, GFP_ATOMIC);
616 if (err) 616 if (err && err != -EPERM)
617 dev_err(&port->dev, "resubmit read urb failed." 617 dev_err(&port->dev, "resubmit read urb failed."
618 "(%d)\n", err); 618 "(%d)\n", err);
619 } 619 }
@@ -672,11 +672,11 @@ static void sierra_instat_callback(struct urb *urb)
672 dev_dbg(&port->dev, "%s: error %d\n", __func__, status); 672 dev_dbg(&port->dev, "%s: error %d\n", __func__, status);
673 673
674 /* Resubmit urb so we continue receiving IRQ data */ 674 /* Resubmit urb so we continue receiving IRQ data */
675 if (port->port.count && status != -ESHUTDOWN && status != -ENOENT) { 675 if (status != -ESHUTDOWN && status != -ENOENT) {
676 usb_mark_last_busy(serial->dev); 676 usb_mark_last_busy(serial->dev);
677 urb->dev = serial->dev; 677 urb->dev = serial->dev;
678 err = usb_submit_urb(urb, GFP_ATOMIC); 678 err = usb_submit_urb(urb, GFP_ATOMIC);
679 if (err) 679 if (err && err != -EPERM)
680 dev_err(&port->dev, "%s: resubmit intr urb " 680 dev_err(&port->dev, "%s: resubmit intr urb "
681 "failed. (%d)\n", __func__, err); 681 "failed. (%d)\n", __func__, err);
682 } 682 }
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index cf508e26f1c6..5d39191e7244 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -686,8 +686,6 @@ static void spcp8x5_read_bulk_callback(struct urb *urb)
686 686
687 /* check the urb status */ 687 /* check the urb status */
688 if (result) { 688 if (result) {
689 if (!port->port.count)
690 return;
691 if (result == -EPROTO) { 689 if (result == -EPROTO) {
692 /* spcp8x5 mysteriously fails with -EPROTO */ 690 /* spcp8x5 mysteriously fails with -EPROTO */
693 /* reschedule the read */ 691 /* reschedule the read */
@@ -734,16 +732,11 @@ static void spcp8x5_read_bulk_callback(struct urb *urb)
734 } 732 }
735 tty_kref_put(tty); 733 tty_kref_put(tty);
736 734
737 /* Schedule the next read _if_ we are still open */ 735 /* Schedule the next read */
738 if (port->port.count) { 736 urb->dev = port->serial->dev;
739 urb->dev = port->serial->dev; 737 result = usb_submit_urb(urb , GFP_ATOMIC);
740 result = usb_submit_urb(urb , GFP_ATOMIC); 738 if (result)
741 if (result) 739 dev_dbg(&port->dev, "failed submitting read urb %d\n", result);
742 dev_dbg(&port->dev, "failed submitting read urb %d\n",
743 result);
744 }
745
746 return;
747} 740}
748 741
749/* get data from ring buffer and then write to usb bus */ 742/* get data from ring buffer and then write to usb bus */