aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/serial/sierra.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 37480348e39b..ed43b18ace78 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -675,6 +675,23 @@ static int sierra_write_room(struct tty_struct *tty)
675 return 2048; 675 return 2048;
676} 676}
677 677
678static int sierra_chars_in_buffer(struct tty_struct *tty)
679{
680 struct usb_serial_port *port = tty->driver_data;
681 struct sierra_port_private *portdata = usb_get_serial_port_data(port);
682 unsigned long flags;
683 int chars;
684
685 /* NOTE: This overcounts somewhat. */
686 spin_lock_irqsave(&portdata->lock, flags);
687 chars = portdata->outstanding_urbs * MAX_TRANSFER;
688 spin_unlock_irqrestore(&portdata->lock, flags);
689
690 dev_dbg(&port->dev, "%s - %d\n", __func__, chars);
691
692 return chars;
693}
694
678static void sierra_stop_rx_urbs(struct usb_serial_port *port) 695static void sierra_stop_rx_urbs(struct usb_serial_port *port)
679{ 696{
680 int i; 697 int i;
@@ -1060,6 +1077,7 @@ static struct usb_serial_driver sierra_device = {
1060 .dtr_rts = sierra_dtr_rts, 1077 .dtr_rts = sierra_dtr_rts,
1061 .write = sierra_write, 1078 .write = sierra_write,
1062 .write_room = sierra_write_room, 1079 .write_room = sierra_write_room,
1080 .chars_in_buffer = sierra_chars_in_buffer,
1063 .set_termios = sierra_set_termios, 1081 .set_termios = sierra_set_termios,
1064 .tiocmget = sierra_tiocmget, 1082 .tiocmget = sierra_tiocmget,
1065 .tiocmset = sierra_tiocmset, 1083 .tiocmset = sierra_tiocmset,