diff options
-rw-r--r-- | drivers/usb/gadget/function/u_serial.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c index 89179ab20c10..7ee057930ae7 100644 --- a/drivers/usb/gadget/function/u_serial.c +++ b/drivers/usb/gadget/function/u_serial.c | |||
@@ -113,6 +113,7 @@ struct gs_port { | |||
113 | int write_allocated; | 113 | int write_allocated; |
114 | struct gs_buf port_write_buf; | 114 | struct gs_buf port_write_buf; |
115 | wait_queue_head_t drain_wait; /* wait while writes drain */ | 115 | wait_queue_head_t drain_wait; /* wait while writes drain */ |
116 | bool write_busy; | ||
116 | 117 | ||
117 | /* REVISIT this state ... */ | 118 | /* REVISIT this state ... */ |
118 | struct usb_cdc_line_coding port_line_coding; /* 8-N-1 etc */ | 119 | struct usb_cdc_line_coding port_line_coding; /* 8-N-1 etc */ |
@@ -363,7 +364,7 @@ __acquires(&port->port_lock) | |||
363 | int status = 0; | 364 | int status = 0; |
364 | bool do_tty_wake = false; | 365 | bool do_tty_wake = false; |
365 | 366 | ||
366 | while (!list_empty(pool)) { | 367 | while (!port->write_busy && !list_empty(pool)) { |
367 | struct usb_request *req; | 368 | struct usb_request *req; |
368 | int len; | 369 | int len; |
369 | 370 | ||
@@ -393,9 +394,11 @@ __acquires(&port->port_lock) | |||
393 | * NOTE that we may keep sending data for a while after | 394 | * NOTE that we may keep sending data for a while after |
394 | * the TTY closed (dev->ioport->port_tty is NULL). | 395 | * the TTY closed (dev->ioport->port_tty is NULL). |
395 | */ | 396 | */ |
397 | port->write_busy = true; | ||
396 | spin_unlock(&port->port_lock); | 398 | spin_unlock(&port->port_lock); |
397 | status = usb_ep_queue(in, req, GFP_ATOMIC); | 399 | status = usb_ep_queue(in, req, GFP_ATOMIC); |
398 | spin_lock(&port->port_lock); | 400 | spin_lock(&port->port_lock); |
401 | port->write_busy = false; | ||
399 | 402 | ||
400 | if (status) { | 403 | if (status) { |
401 | pr_debug("%s: %s %s err %d\n", | 404 | pr_debug("%s: %s %s err %d\n", |