aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/metro-usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/metro-usb.c')
-rw-r--r--drivers/usb/serial/metro-usb.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c
index 3d258448c29a..bf3c7a23553e 100644
--- a/drivers/usb/serial/metro-usb.c
+++ b/drivers/usb/serial/metro-usb.c
@@ -95,7 +95,6 @@ static void metrousb_read_int_callback(struct urb *urb)
95{ 95{
96 struct usb_serial_port *port = urb->context; 96 struct usb_serial_port *port = urb->context;
97 struct metrousb_private *metro_priv = usb_get_serial_port_data(port); 97 struct metrousb_private *metro_priv = usb_get_serial_port_data(port);
98 struct tty_struct *tty;
99 unsigned char *data = urb->transfer_buffer; 98 unsigned char *data = urb->transfer_buffer;
100 int throttled = 0; 99 int throttled = 0;
101 int result = 0; 100 int result = 0;
@@ -124,15 +123,13 @@ static void metrousb_read_int_callback(struct urb *urb)
124 123
125 124
126 /* Set the data read from the usb port into the serial port buffer. */ 125 /* Set the data read from the usb port into the serial port buffer. */
127 tty = tty_port_tty_get(&port->port); 126 if (urb->actual_length) {
128 if (tty && urb->actual_length) {
129 /* Loop through the data copying each byte to the tty layer. */ 127 /* Loop through the data copying each byte to the tty layer. */
130 tty_insert_flip_string(tty, data, urb->actual_length); 128 tty_insert_flip_string(&port->port, data, urb->actual_length);
131 129
132 /* Force the data to the tty layer. */ 130 /* Force the data to the tty layer. */
133 tty_flip_buffer_push(tty); 131 tty_flip_buffer_push(&port->port);
134 } 132 }
135 tty_kref_put(tty);
136 133
137 /* Set any port variables. */ 134 /* Set any port variables. */
138 spin_lock_irqsave(&metro_priv->lock, flags); 135 spin_lock_irqsave(&metro_priv->lock, flags);