diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-12-10 19:00:30 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-01-07 13:00:06 -0500 |
commit | 50de36f7af3b1d791c402478210790c582126fe5 (patch) | |
tree | 78d3353450be45315bb2ffa1cd7c664c26458c73 /drivers | |
parent | 6013bbbab0dcbc43bcf9dd70beeab2a0b1ec5ea7 (diff) |
USB: serial: fix up urb->status usage
Some of the usb-serial drivers are starting to use urb->status in ways
they should not be doing. This fixes up some of them to prevent that.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/serial/digi_acceleport.c | 28 | ||||
-rw-r--r-- | drivers/usb/serial/garmin_gps.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/iuu_phoenix.c | 38 | ||||
-rw-r--r-- | drivers/usb/serial/mos7840.c | 38 | ||||
-rw-r--r-- | drivers/usb/serial/option.c | 7 | ||||
-rw-r--r-- | drivers/usb/serial/spcp8x5.c | 20 |
6 files changed, 68 insertions, 65 deletions
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 69f84f0ea6fe..38ba4ea8b6bf 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -635,8 +635,7 @@ static int digi_write_oob_command(struct usb_serial_port *port, | |||
635 | 635 | ||
636 | spin_lock_irqsave(&oob_priv->dp_port_lock, flags); | 636 | spin_lock_irqsave(&oob_priv->dp_port_lock, flags); |
637 | while (count > 0) { | 637 | while (count > 0) { |
638 | while (oob_port->write_urb->status == -EINPROGRESS | 638 | while (oob_priv->dp_write_urb_in_use) { |
639 | || oob_priv->dp_write_urb_in_use) { | ||
640 | cond_wait_interruptible_timeout_irqrestore( | 639 | cond_wait_interruptible_timeout_irqrestore( |
641 | &oob_port->write_wait, DIGI_RETRY_TIMEOUT, | 640 | &oob_port->write_wait, DIGI_RETRY_TIMEOUT, |
642 | &oob_priv->dp_port_lock, flags); | 641 | &oob_priv->dp_port_lock, flags); |
@@ -699,9 +698,8 @@ static int digi_write_inb_command(struct usb_serial_port *port, | |||
699 | 698 | ||
700 | spin_lock_irqsave(&priv->dp_port_lock, flags); | 699 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
701 | while (count > 0 && ret == 0) { | 700 | while (count > 0 && ret == 0) { |
702 | while ((port->write_urb->status == -EINPROGRESS | 701 | while (priv->dp_write_urb_in_use && |
703 | || priv->dp_write_urb_in_use) | 702 | time_before(jiffies, timeout)) { |
704 | && time_before(jiffies, timeout)) { | ||
705 | cond_wait_interruptible_timeout_irqrestore( | 703 | cond_wait_interruptible_timeout_irqrestore( |
706 | &port->write_wait, DIGI_RETRY_TIMEOUT, | 704 | &port->write_wait, DIGI_RETRY_TIMEOUT, |
707 | &priv->dp_port_lock, flags); | 705 | &priv->dp_port_lock, flags); |
@@ -779,8 +777,7 @@ static int digi_set_modem_signals(struct usb_serial_port *port, | |||
779 | spin_lock_irqsave(&oob_priv->dp_port_lock, flags); | 777 | spin_lock_irqsave(&oob_priv->dp_port_lock, flags); |
780 | spin_lock(&port_priv->dp_port_lock); | 778 | spin_lock(&port_priv->dp_port_lock); |
781 | 779 | ||
782 | while (oob_port->write_urb->status == -EINPROGRESS || | 780 | while (oob_priv->dp_write_urb_in_use) { |
783 | oob_priv->dp_write_urb_in_use) { | ||
784 | spin_unlock(&port_priv->dp_port_lock); | 781 | spin_unlock(&port_priv->dp_port_lock); |
785 | cond_wait_interruptible_timeout_irqrestore( | 782 | cond_wait_interruptible_timeout_irqrestore( |
786 | &oob_port->write_wait, DIGI_RETRY_TIMEOUT, | 783 | &oob_port->write_wait, DIGI_RETRY_TIMEOUT, |
@@ -1168,12 +1165,10 @@ static int digi_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1168 | 1165 | ||
1169 | /* be sure only one write proceeds at a time */ | 1166 | /* be sure only one write proceeds at a time */ |
1170 | /* there are races on the port private buffer */ | 1167 | /* there are races on the port private buffer */ |
1171 | /* and races to check write_urb->status */ | ||
1172 | spin_lock_irqsave(&priv->dp_port_lock, flags); | 1168 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
1173 | 1169 | ||
1174 | /* wait for urb status clear to submit another urb */ | 1170 | /* wait for urb status clear to submit another urb */ |
1175 | if (port->write_urb->status == -EINPROGRESS || | 1171 | if (priv->dp_write_urb_in_use) { |
1176 | priv->dp_write_urb_in_use) { | ||
1177 | /* buffer data if count is 1 (probably put_char) if possible */ | 1172 | /* buffer data if count is 1 (probably put_char) if possible */ |
1178 | if (count == 1 && priv->dp_out_buf_len < DIGI_OUT_BUF_SIZE) { | 1173 | if (count == 1 && priv->dp_out_buf_len < DIGI_OUT_BUF_SIZE) { |
1179 | priv->dp_out_buf[priv->dp_out_buf_len++] = *buf; | 1174 | priv->dp_out_buf[priv->dp_out_buf_len++] = *buf; |
@@ -1236,7 +1231,7 @@ static void digi_write_bulk_callback(struct urb *urb) | |||
1236 | int ret = 0; | 1231 | int ret = 0; |
1237 | int status = urb->status; | 1232 | int status = urb->status; |
1238 | 1233 | ||
1239 | dbg("digi_write_bulk_callback: TOP, urb->status=%d", status); | 1234 | dbg("digi_write_bulk_callback: TOP, status=%d", status); |
1240 | 1235 | ||
1241 | /* port and serial sanity check */ | 1236 | /* port and serial sanity check */ |
1242 | if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { | 1237 | if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { |
@@ -1266,8 +1261,7 @@ static void digi_write_bulk_callback(struct urb *urb) | |||
1266 | /* try to send any buffered data on this port, if it is open */ | 1261 | /* try to send any buffered data on this port, if it is open */ |
1267 | spin_lock(&priv->dp_port_lock); | 1262 | spin_lock(&priv->dp_port_lock); |
1268 | priv->dp_write_urb_in_use = 0; | 1263 | priv->dp_write_urb_in_use = 0; |
1269 | if (port->port.count && port->write_urb->status != -EINPROGRESS | 1264 | if (port->port.count && priv->dp_out_buf_len > 0) { |
1270 | && priv->dp_out_buf_len > 0) { | ||
1271 | *((unsigned char *)(port->write_urb->transfer_buffer)) | 1265 | *((unsigned char *)(port->write_urb->transfer_buffer)) |
1272 | = (unsigned char)DIGI_CMD_SEND_DATA; | 1266 | = (unsigned char)DIGI_CMD_SEND_DATA; |
1273 | *((unsigned char *)(port->write_urb->transfer_buffer) + 1) | 1267 | *((unsigned char *)(port->write_urb->transfer_buffer) + 1) |
@@ -1305,8 +1299,7 @@ static int digi_write_room(struct tty_struct *tty) | |||
1305 | 1299 | ||
1306 | spin_lock_irqsave(&priv->dp_port_lock, flags); | 1300 | spin_lock_irqsave(&priv->dp_port_lock, flags); |
1307 | 1301 | ||
1308 | if (port->write_urb->status == -EINPROGRESS || | 1302 | if (priv->dp_write_urb_in_use) |
1309 | priv->dp_write_urb_in_use) | ||
1310 | room = 0; | 1303 | room = 0; |
1311 | else | 1304 | else |
1312 | room = port->bulk_out_size - 2 - priv->dp_out_buf_len; | 1305 | room = port->bulk_out_size - 2 - priv->dp_out_buf_len; |
@@ -1322,8 +1315,7 @@ static int digi_chars_in_buffer(struct tty_struct *tty) | |||
1322 | struct usb_serial_port *port = tty->driver_data; | 1315 | struct usb_serial_port *port = tty->driver_data; |
1323 | struct digi_port *priv = usb_get_serial_port_data(port); | 1316 | struct digi_port *priv = usb_get_serial_port_data(port); |
1324 | 1317 | ||
1325 | if (port->write_urb->status == -EINPROGRESS | 1318 | if (priv->dp_write_urb_in_use) { |
1326 | || priv->dp_write_urb_in_use) { | ||
1327 | dbg("digi_chars_in_buffer: port=%d, chars=%d", | 1319 | dbg("digi_chars_in_buffer: port=%d, chars=%d", |
1328 | priv->dp_port_num, port->bulk_out_size - 2); | 1320 | priv->dp_port_num, port->bulk_out_size - 2); |
1329 | /* return(port->bulk_out_size - 2); */ | 1321 | /* return(port->bulk_out_size - 2); */ |
@@ -1702,7 +1694,7 @@ static int digi_read_inb_callback(struct urb *urb) | |||
1702 | /* short/multiple packet check */ | 1694 | /* short/multiple packet check */ |
1703 | if (urb->actual_length != len + 2) { | 1695 | if (urb->actual_length != len + 2) { |
1704 | dev_err(&port->dev, "%s: INCOMPLETE OR MULTIPLE PACKET, " | 1696 | dev_err(&port->dev, "%s: INCOMPLETE OR MULTIPLE PACKET, " |
1705 | "urb->status=%d, port=%d, opcode=%d, len=%d, " | 1697 | "status=%d, port=%d, opcode=%d, len=%d, " |
1706 | "actual_length=%d, status=%d\n", __func__, status, | 1698 | "actual_length=%d, status=%d\n", __func__, status, |
1707 | priv->dp_port_num, opcode, len, urb->actual_length, | 1699 | priv->dp_port_num, opcode, len, urb->actual_length, |
1708 | port_status); | 1700 | port_status); |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 8e6a66e38db2..a26a0e2cdb4a 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -1056,7 +1056,7 @@ static void garmin_write_bulk_callback(struct urb *urb) | |||
1056 | 1056 | ||
1057 | if (status) { | 1057 | if (status) { |
1058 | dbg("%s - nonzero write bulk status received: %d", | 1058 | dbg("%s - nonzero write bulk status received: %d", |
1059 | __func__, urb->status); | 1059 | __func__, status); |
1060 | spin_lock_irqsave(&garmin_data_p->lock, flags); | 1060 | spin_lock_irqsave(&garmin_data_p->lock, flags); |
1061 | garmin_data_p->flags |= CLEAR_HALT_REQUIRED; | 1061 | garmin_data_p->flags |= CLEAR_HALT_REQUIRED; |
1062 | spin_unlock_irqrestore(&garmin_data_p->lock, flags); | 1062 | spin_unlock_irqrestore(&garmin_data_p->lock, flags); |
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index e320972cb227..2314c6ae4fc2 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
@@ -190,10 +190,12 @@ static void iuu_rxcmd(struct urb *urb) | |||
190 | { | 190 | { |
191 | struct usb_serial_port *port = urb->context; | 191 | struct usb_serial_port *port = urb->context; |
192 | int result; | 192 | int result; |
193 | int status = urb->status; | ||
194 | |||
193 | dbg("%s - enter", __func__); | 195 | dbg("%s - enter", __func__); |
194 | 196 | ||
195 | if (urb->status) { | 197 | if (status) { |
196 | dbg("%s - urb->status = %d", __func__, urb->status); | 198 | dbg("%s - status = %d", __func__, status); |
197 | /* error stop all */ | 199 | /* error stop all */ |
198 | return; | 200 | return; |
199 | } | 201 | } |
@@ -245,10 +247,12 @@ static void iuu_update_status_callback(struct urb *urb) | |||
245 | struct usb_serial_port *port = urb->context; | 247 | struct usb_serial_port *port = urb->context; |
246 | struct iuu_private *priv = usb_get_serial_port_data(port); | 248 | struct iuu_private *priv = usb_get_serial_port_data(port); |
247 | u8 *st; | 249 | u8 *st; |
250 | int status = urb->status; | ||
251 | |||
248 | dbg("%s - enter", __func__); | 252 | dbg("%s - enter", __func__); |
249 | 253 | ||
250 | if (urb->status) { | 254 | if (status) { |
251 | dbg("%s - urb->status = %d", __func__, urb->status); | 255 | dbg("%s - status = %d", __func__, status); |
252 | /* error stop all */ | 256 | /* error stop all */ |
253 | return; | 257 | return; |
254 | } | 258 | } |
@@ -274,9 +278,9 @@ static void iuu_status_callback(struct urb *urb) | |||
274 | { | 278 | { |
275 | struct usb_serial_port *port = urb->context; | 279 | struct usb_serial_port *port = urb->context; |
276 | int result; | 280 | int result; |
277 | dbg("%s - enter", __func__); | 281 | int status = urb->status; |
278 | 282 | ||
279 | dbg("%s - urb->status = %d", __func__, urb->status); | 283 | dbg("%s - status = %d", __func__, status); |
280 | usb_fill_bulk_urb(port->read_urb, port->serial->dev, | 284 | usb_fill_bulk_urb(port->read_urb, port->serial->dev, |
281 | usb_rcvbulkpipe(port->serial->dev, | 285 | usb_rcvbulkpipe(port->serial->dev, |
282 | port->bulk_in_endpointAddress), | 286 | port->bulk_in_endpointAddress), |
@@ -618,11 +622,12 @@ static void read_buf_callback(struct urb *urb) | |||
618 | struct usb_serial_port *port = urb->context; | 622 | struct usb_serial_port *port = urb->context; |
619 | unsigned char *data = urb->transfer_buffer; | 623 | unsigned char *data = urb->transfer_buffer; |
620 | struct tty_struct *tty; | 624 | struct tty_struct *tty; |
621 | dbg("%s - urb->status = %d", __func__, urb->status); | 625 | int status = urb->status; |
622 | 626 | ||
623 | if (urb->status) { | 627 | dbg("%s - status = %d", __func__, status); |
624 | dbg("%s - urb->status = %d", __func__, urb->status); | 628 | |
625 | if (urb->status == -EPROTO) { | 629 | if (status) { |
630 | if (status == -EPROTO) { | ||
626 | /* reschedule needed */ | 631 | /* reschedule needed */ |
627 | } | 632 | } |
628 | return; | 633 | return; |
@@ -695,7 +700,7 @@ static void iuu_uart_read_callback(struct urb *urb) | |||
695 | struct usb_serial_port *port = urb->context; | 700 | struct usb_serial_port *port = urb->context; |
696 | struct iuu_private *priv = usb_get_serial_port_data(port); | 701 | struct iuu_private *priv = usb_get_serial_port_data(port); |
697 | unsigned long flags; | 702 | unsigned long flags; |
698 | int status; | 703 | int status = urb->status; |
699 | int error = 0; | 704 | int error = 0; |
700 | int len = 0; | 705 | int len = 0; |
701 | unsigned char *data = urb->transfer_buffer; | 706 | unsigned char *data = urb->transfer_buffer; |
@@ -703,8 +708,8 @@ static void iuu_uart_read_callback(struct urb *urb) | |||
703 | 708 | ||
704 | dbg("%s - enter", __func__); | 709 | dbg("%s - enter", __func__); |
705 | 710 | ||
706 | if (urb->status) { | 711 | if (status) { |
707 | dbg("%s - urb->status = %d", __func__, urb->status); | 712 | dbg("%s - status = %d", __func__, status); |
708 | /* error stop all */ | 713 | /* error stop all */ |
709 | return; | 714 | return; |
710 | } | 715 | } |
@@ -782,12 +787,11 @@ static void read_rxcmd_callback(struct urb *urb) | |||
782 | { | 787 | { |
783 | struct usb_serial_port *port = urb->context; | 788 | struct usb_serial_port *port = urb->context; |
784 | int result; | 789 | int result; |
785 | dbg("%s - enter", __func__); | 790 | int status = urb->status; |
786 | 791 | ||
787 | dbg("%s - urb->status = %d", __func__, urb->status); | 792 | dbg("%s - status = %d", __func__, status); |
788 | 793 | ||
789 | if (urb->status) { | 794 | if (status) { |
790 | dbg("%s - urb->status = %d", __func__, urb->status); | ||
791 | /* error stop all */ | 795 | /* error stop all */ |
792 | return; | 796 | return; |
793 | } | 797 | } |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 96a8c7713212..2c20e88a91b3 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -214,6 +214,7 @@ struct moschip_port { | |||
214 | spinlock_t pool_lock; | 214 | spinlock_t pool_lock; |
215 | struct urb *write_urb_pool[NUM_URBS]; | 215 | struct urb *write_urb_pool[NUM_URBS]; |
216 | char busy[NUM_URBS]; | 216 | char busy[NUM_URBS]; |
217 | bool read_urb_busy; | ||
217 | }; | 218 | }; |
218 | 219 | ||
219 | 220 | ||
@@ -679,26 +680,30 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
679 | struct tty_struct *tty; | 680 | struct tty_struct *tty; |
680 | int status = urb->status; | 681 | int status = urb->status; |
681 | 682 | ||
682 | if (status) { | ||
683 | dbg("nonzero read bulk status received: %d", status); | ||
684 | return; | ||
685 | } | ||
686 | |||
687 | mos7840_port = urb->context; | 683 | mos7840_port = urb->context; |
688 | if (!mos7840_port) { | 684 | if (!mos7840_port) { |
689 | dbg("%s", "NULL mos7840_port pointer \n"); | 685 | dbg("%s", "NULL mos7840_port pointer \n"); |
686 | mos7840_port->read_urb_busy = false; | ||
687 | return; | ||
688 | } | ||
689 | |||
690 | if (status) { | ||
691 | dbg("nonzero read bulk status received: %d", status); | ||
692 | mos7840_port->read_urb_busy = false; | ||
690 | return; | 693 | return; |
691 | } | 694 | } |
692 | 695 | ||
693 | port = (struct usb_serial_port *)mos7840_port->port; | 696 | port = (struct usb_serial_port *)mos7840_port->port; |
694 | if (mos7840_port_paranoia_check(port, __func__)) { | 697 | if (mos7840_port_paranoia_check(port, __func__)) { |
695 | dbg("%s", "Port Paranoia failed \n"); | 698 | dbg("%s", "Port Paranoia failed \n"); |
699 | mos7840_port->read_urb_busy = false; | ||
696 | return; | 700 | return; |
697 | } | 701 | } |
698 | 702 | ||
699 | serial = mos7840_get_usb_serial(port, __func__); | 703 | serial = mos7840_get_usb_serial(port, __func__); |
700 | if (!serial) { | 704 | if (!serial) { |
701 | dbg("%s\n", "Bad serial pointer "); | 705 | dbg("%s\n", "Bad serial pointer "); |
706 | mos7840_port->read_urb_busy = false; | ||
702 | return; | 707 | return; |
703 | } | 708 | } |
704 | 709 | ||
@@ -725,17 +730,19 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
725 | 730 | ||
726 | if (!mos7840_port->read_urb) { | 731 | if (!mos7840_port->read_urb) { |
727 | dbg("%s", "URB KILLED !!!\n"); | 732 | dbg("%s", "URB KILLED !!!\n"); |
733 | mos7840_port->read_urb_busy = false; | ||
728 | return; | 734 | return; |
729 | } | 735 | } |
730 | 736 | ||
731 | 737 | ||
732 | mos7840_port->read_urb->dev = serial->dev; | 738 | mos7840_port->read_urb->dev = serial->dev; |
733 | 739 | ||
740 | mos7840_port->read_urb_busy = true; | ||
734 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 741 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
735 | 742 | ||
736 | if (retval) { | 743 | if (retval) { |
737 | dbg(" usb_submit_urb(read bulk) failed, retval = %d", | 744 | dbg("usb_submit_urb(read bulk) failed, retval = %d", retval); |
738 | retval); | 745 | mos7840_port->read_urb_busy = false; |
739 | } | 746 | } |
740 | } | 747 | } |
741 | 748 | ||
@@ -1055,10 +1062,12 @@ static int mos7840_open(struct tty_struct *tty, | |||
1055 | 1062 | ||
1056 | dbg("mos7840_open: bulkin endpoint is %d\n", | 1063 | dbg("mos7840_open: bulkin endpoint is %d\n", |
1057 | port->bulk_in_endpointAddress); | 1064 | port->bulk_in_endpointAddress); |
1065 | mos7840_port->read_urb_busy = true; | ||
1058 | response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); | 1066 | response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); |
1059 | if (response) { | 1067 | if (response) { |
1060 | dev_err(&port->dev, "%s - Error %d submitting control urb\n", | 1068 | dev_err(&port->dev, "%s - Error %d submitting control urb\n", |
1061 | __func__, response); | 1069 | __func__, response); |
1070 | mos7840_port->read_urb_busy = false; | ||
1062 | } | 1071 | } |
1063 | 1072 | ||
1064 | /* initialize our wait queues */ | 1073 | /* initialize our wait queues */ |
@@ -1227,6 +1236,7 @@ static void mos7840_close(struct tty_struct *tty, | |||
1227 | if (mos7840_port->read_urb) { | 1236 | if (mos7840_port->read_urb) { |
1228 | dbg("%s", "Shutdown bulk read\n"); | 1237 | dbg("%s", "Shutdown bulk read\n"); |
1229 | usb_kill_urb(mos7840_port->read_urb); | 1238 | usb_kill_urb(mos7840_port->read_urb); |
1239 | mos7840_port->read_urb_busy = false; | ||
1230 | } | 1240 | } |
1231 | if ((&mos7840_port->control_urb)) { | 1241 | if ((&mos7840_port->control_urb)) { |
1232 | dbg("%s", "Shutdown control read\n"); | 1242 | dbg("%s", "Shutdown control read\n"); |
@@ -2043,14 +2053,14 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2043 | Data = 0x0c; | 2053 | Data = 0x0c; |
2044 | mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); | 2054 | mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); |
2045 | 2055 | ||
2046 | if (mos7840_port->read_urb->status != -EINPROGRESS) { | 2056 | if (mos7840_port->read_urb_busy == false) { |
2047 | mos7840_port->read_urb->dev = serial->dev; | 2057 | mos7840_port->read_urb->dev = serial->dev; |
2048 | 2058 | mos7840_port->read_urb_busy = true; | |
2049 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 2059 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
2050 | |||
2051 | if (status) { | 2060 | if (status) { |
2052 | dbg(" usb_submit_urb(read bulk) failed, status = %d", | 2061 | dbg("usb_submit_urb(read bulk) failed, status = %d", |
2053 | status); | 2062 | status); |
2063 | mos7840_port->read_urb_busy = false; | ||
2054 | } | 2064 | } |
2055 | } | 2065 | } |
2056 | wake_up(&mos7840_port->delta_msr_wait); | 2066 | wake_up(&mos7840_port->delta_msr_wait); |
@@ -2117,12 +2127,14 @@ static void mos7840_set_termios(struct tty_struct *tty, | |||
2117 | return; | 2127 | return; |
2118 | } | 2128 | } |
2119 | 2129 | ||
2120 | if (mos7840_port->read_urb->status != -EINPROGRESS) { | 2130 | if (mos7840_port->read_urb_busy == false) { |
2121 | mos7840_port->read_urb->dev = serial->dev; | 2131 | mos7840_port->read_urb->dev = serial->dev; |
2132 | mos7840_port->read_urb_busy = true; | ||
2122 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 2133 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
2123 | if (status) { | 2134 | if (status) { |
2124 | dbg(" usb_submit_urb(read bulk) failed, status = %d", | 2135 | dbg("usb_submit_urb(read bulk) failed, status = %d", |
2125 | status); | 2136 | status); |
2137 | mos7840_port->read_urb_busy = false; | ||
2126 | } | 2138 | } |
2127 | } | 2139 | } |
2128 | return; | 2140 | return; |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 809697b3c7fc..4c9497d05d13 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -654,10 +654,6 @@ static int option_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
654 | usb_unlink_urb(this_urb); | 654 | usb_unlink_urb(this_urb); |
655 | continue; | 655 | continue; |
656 | } | 656 | } |
657 | if (this_urb->status != 0) | ||
658 | dbg("usb_write %p failed (err=%d)", | ||
659 | this_urb, this_urb->status); | ||
660 | |||
661 | dbg("%s: endpoint %d buf %d", __func__, | 657 | dbg("%s: endpoint %d buf %d", __func__, |
662 | usb_pipeendpoint(this_urb->pipe), i); | 658 | usb_pipeendpoint(this_urb->pipe), i); |
663 | 659 | ||
@@ -669,8 +665,7 @@ static int option_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
669 | err = usb_submit_urb(this_urb, GFP_ATOMIC); | 665 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
670 | if (err) { | 666 | if (err) { |
671 | dbg("usb_submit_urb %p (write bulk) failed " | 667 | dbg("usb_submit_urb %p (write bulk) failed " |
672 | "(%d, has %d)", this_urb, | 668 | "(%d)", this_urb, err); |
673 | err, this_urb->status); | ||
674 | clear_bit(i, &portdata->out_busy); | 669 | clear_bit(i, &portdata->out_busy); |
675 | continue; | 670 | continue; |
676 | } | 671 | } |
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index a65bc2bd8e71..5e7528cc81a8 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -709,21 +709,20 @@ static void spcp8x5_read_bulk_callback(struct urb *urb) | |||
709 | unsigned char *data = urb->transfer_buffer; | 709 | unsigned char *data = urb->transfer_buffer; |
710 | unsigned long flags; | 710 | unsigned long flags; |
711 | int i; | 711 | int i; |
712 | int result; | 712 | int result = urb->status; |
713 | u8 status = 0; | 713 | u8 status; |
714 | char tty_flag; | 714 | char tty_flag; |
715 | 715 | ||
716 | dev_dbg(&port->dev, "start, urb->status = %d, " | 716 | dev_dbg(&port->dev, "start, result = %d, urb->actual_length = %d\n,", |
717 | "urb->actual_length = %d\n,", urb->status, urb->actual_length); | 717 | result, urb->actual_length); |
718 | 718 | ||
719 | /* check the urb status */ | 719 | /* check the urb status */ |
720 | if (urb->status) { | 720 | if (result) { |
721 | if (!port->port.count) | 721 | if (!port->port.count) |
722 | return; | 722 | return; |
723 | if (urb->status == -EPROTO) { | 723 | if (result == -EPROTO) { |
724 | /* spcp8x5 mysteriously fails with -EPROTO */ | 724 | /* spcp8x5 mysteriously fails with -EPROTO */ |
725 | /* reschedule the read */ | 725 | /* reschedule the read */ |
726 | urb->status = 0; | ||
727 | urb->dev = port->serial->dev; | 726 | urb->dev = port->serial->dev; |
728 | result = usb_submit_urb(urb , GFP_ATOMIC); | 727 | result = usb_submit_urb(urb , GFP_ATOMIC); |
729 | if (result) | 728 | if (result) |
@@ -833,8 +832,9 @@ static void spcp8x5_write_bulk_callback(struct urb *urb) | |||
833 | struct usb_serial_port *port = urb->context; | 832 | struct usb_serial_port *port = urb->context; |
834 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); | 833 | struct spcp8x5_private *priv = usb_get_serial_port_data(port); |
835 | int result; | 834 | int result; |
835 | int status = urb->status; | ||
836 | 836 | ||
837 | switch (urb->status) { | 837 | switch (status) { |
838 | case 0: | 838 | case 0: |
839 | /* success */ | 839 | /* success */ |
840 | break; | 840 | break; |
@@ -843,14 +843,14 @@ static void spcp8x5_write_bulk_callback(struct urb *urb) | |||
843 | case -ESHUTDOWN: | 843 | case -ESHUTDOWN: |
844 | /* this urb is terminated, clean up */ | 844 | /* this urb is terminated, clean up */ |
845 | dev_dbg(&port->dev, "urb shutting down with status: %d\n", | 845 | dev_dbg(&port->dev, "urb shutting down with status: %d\n", |
846 | urb->status); | 846 | status); |
847 | priv->write_urb_in_use = 0; | 847 | priv->write_urb_in_use = 0; |
848 | return; | 848 | return; |
849 | default: | 849 | default: |
850 | /* error in the urb, so we have to resubmit it */ | 850 | /* error in the urb, so we have to resubmit it */ |
851 | dbg("%s - Overflow in write", __func__); | 851 | dbg("%s - Overflow in write", __func__); |
852 | dbg("%s - nonzero write bulk status received: %d", | 852 | dbg("%s - nonzero write bulk status received: %d", |
853 | __func__, urb->status); | 853 | __func__, status); |
854 | port->write_urb->transfer_buffer_length = 1; | 854 | port->write_urb->transfer_buffer_length = 1; |
855 | port->write_urb->dev = port->serial->dev; | 855 | port->write_urb->dev = port->serial->dev; |
856 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 856 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); |