summaryrefslogtreecommitdiff
path: root/drivers/usb/serial/keyspan_pda.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/keyspan_pda.c')
-rw-r--r--drivers/usb/serial/keyspan_pda.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 6ce292ef1c47..b650fb4754b4 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -636,14 +636,19 @@ static int keyspan_pda_write_room (struct usb_serial_port *port)
static int keyspan_pda_chars_in_buffer (struct usb_serial_port *port)
{
struct keyspan_pda_private *priv;
+ unsigned long flags;
+ int ret = 0;
priv = usb_get_serial_port_data(port);
/* when throttled, return at least WAKEUP_CHARS to tell select() (via
n_tty.c:normal_poll() ) that we're not writeable. */
+
+ spin_lock_irqsave(&port->lock, flags);
if (port->write_urb_busy || priv->tx_throttled)
- return 256;
- return 0;
+ ret = 256;
+ spin_unlock_irqrestore(&port->lock, flags);
+ return ret;
}