diff options
Diffstat (limited to 'drivers/usb/serial/generic.c')
| -rw-r--r-- | drivers/usb/serial/generic.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index a817ced82835..ca92f67747cc 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
| @@ -208,18 +208,23 @@ retry: | |||
| 208 | urb->transfer_buffer_length = count; | 208 | urb->transfer_buffer_length = count; |
| 209 | usb_serial_debug_data(debug, &port->dev, __func__, count, | 209 | usb_serial_debug_data(debug, &port->dev, __func__, count, |
| 210 | urb->transfer_buffer); | 210 | urb->transfer_buffer); |
| 211 | spin_lock_irqsave(&port->lock, flags); | ||
| 212 | port->tx_bytes += count; | ||
| 213 | spin_unlock_irqrestore(&port->lock, flags); | ||
| 214 | |||
| 215 | clear_bit(i, &port->write_urbs_free); | ||
| 211 | result = usb_submit_urb(urb, GFP_ATOMIC); | 216 | result = usb_submit_urb(urb, GFP_ATOMIC); |
| 212 | if (result) { | 217 | if (result) { |
| 213 | dev_err(&port->dev, "%s - error submitting urb: %d\n", | 218 | dev_err(&port->dev, "%s - error submitting urb: %d\n", |
| 214 | __func__, result); | 219 | __func__, result); |
| 220 | set_bit(i, &port->write_urbs_free); | ||
| 221 | spin_lock_irqsave(&port->lock, flags); | ||
| 222 | port->tx_bytes -= count; | ||
| 223 | spin_unlock_irqrestore(&port->lock, flags); | ||
| 224 | |||
| 215 | clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags); | 225 | clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags); |
| 216 | return result; | 226 | return result; |
| 217 | } | 227 | } |
| 218 | clear_bit(i, &port->write_urbs_free); | ||
| 219 | |||
| 220 | spin_lock_irqsave(&port->lock, flags); | ||
| 221 | port->tx_bytes += count; | ||
| 222 | spin_unlock_irqrestore(&port->lock, flags); | ||
| 223 | 228 | ||
| 224 | /* Try sending off another urb, unless in irq context (in which case | 229 | /* Try sending off another urb, unless in irq context (in which case |
| 225 | * there will be no free urb). */ | 230 | * there will be no free urb). */ |
