diff options
Diffstat (limited to 'drivers/usb/serial/keyspan.c')
-rw-r--r-- | drivers/usb/serial/keyspan.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 14a219ba4ee6..f6d7f68fa43c 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -291,7 +291,6 @@ static void usa26_indat_callback(struct urb *urb) | |||
291 | int i, err; | 291 | int i, err; |
292 | int endpoint; | 292 | int endpoint; |
293 | struct usb_serial_port *port; | 293 | struct usb_serial_port *port; |
294 | struct tty_struct *tty; | ||
295 | unsigned char *data = urb->transfer_buffer; | 294 | unsigned char *data = urb->transfer_buffer; |
296 | int status = urb->status; | 295 | int status = urb->status; |
297 | 296 | ||
@@ -304,8 +303,7 @@ static void usa26_indat_callback(struct urb *urb) | |||
304 | } | 303 | } |
305 | 304 | ||
306 | port = urb->context; | 305 | port = urb->context; |
307 | tty = tty_port_tty_get(&port->port); | 306 | if (urb->actual_length) { |
308 | if (tty && urb->actual_length) { | ||
309 | /* 0x80 bit is error flag */ | 307 | /* 0x80 bit is error flag */ |
310 | if ((data[0] & 0x80) == 0) { | 308 | if ((data[0] & 0x80) == 0) { |
311 | /* no errors on individual bytes, only | 309 | /* no errors on individual bytes, only |
@@ -332,9 +330,8 @@ static void usa26_indat_callback(struct urb *urb) | |||
332 | flag); | 330 | flag); |
333 | } | 331 | } |
334 | } | 332 | } |
335 | tty_flip_buffer_push(tty); | 333 | tty_flip_buffer_push(&port->port); |
336 | } | 334 | } |
337 | tty_kref_put(tty); | ||
338 | 335 | ||
339 | /* Resubmit urb so we continue receiving */ | 336 | /* Resubmit urb so we continue receiving */ |
340 | err = usb_submit_urb(urb, GFP_ATOMIC); | 337 | err = usb_submit_urb(urb, GFP_ATOMIC); |
@@ -447,7 +444,6 @@ static void usa28_indat_callback(struct urb *urb) | |||
447 | { | 444 | { |
448 | int err; | 445 | int err; |
449 | struct usb_serial_port *port; | 446 | struct usb_serial_port *port; |
450 | struct tty_struct *tty; | ||
451 | unsigned char *data; | 447 | unsigned char *data; |
452 | struct keyspan_port_private *p_priv; | 448 | struct keyspan_port_private *p_priv; |
453 | int status = urb->status; | 449 | int status = urb->status; |
@@ -470,13 +466,11 @@ static void usa28_indat_callback(struct urb *urb) | |||
470 | p_priv = usb_get_serial_port_data(port); | 466 | p_priv = usb_get_serial_port_data(port); |
471 | data = urb->transfer_buffer; | 467 | data = urb->transfer_buffer; |
472 | 468 | ||
473 | tty = tty_port_tty_get(&port->port); | 469 | if (urb->actual_length) { |
474 | if (tty && urb->actual_length) { | ||
475 | tty_insert_flip_string(&port->port, data, | 470 | tty_insert_flip_string(&port->port, data, |
476 | urb->actual_length); | 471 | urb->actual_length); |
477 | tty_flip_buffer_push(tty); | 472 | tty_flip_buffer_push(&port->port); |
478 | } | 473 | } |
479 | tty_kref_put(tty); | ||
480 | 474 | ||
481 | /* Resubmit urb so we continue receiving */ | 475 | /* Resubmit urb so we continue receiving */ |
482 | err = usb_submit_urb(urb, GFP_ATOMIC); | 476 | err = usb_submit_urb(urb, GFP_ATOMIC); |
@@ -671,7 +665,6 @@ static void usa49_indat_callback(struct urb *urb) | |||
671 | int i, err; | 665 | int i, err; |
672 | int endpoint; | 666 | int endpoint; |
673 | struct usb_serial_port *port; | 667 | struct usb_serial_port *port; |
674 | struct tty_struct *tty; | ||
675 | unsigned char *data = urb->transfer_buffer; | 668 | unsigned char *data = urb->transfer_buffer; |
676 | int status = urb->status; | 669 | int status = urb->status; |
677 | 670 | ||
@@ -684,8 +677,7 @@ static void usa49_indat_callback(struct urb *urb) | |||
684 | } | 677 | } |
685 | 678 | ||
686 | port = urb->context; | 679 | port = urb->context; |
687 | tty = tty_port_tty_get(&port->port); | 680 | if (urb->actual_length) { |
688 | if (tty && urb->actual_length) { | ||
689 | /* 0x80 bit is error flag */ | 681 | /* 0x80 bit is error flag */ |
690 | if ((data[0] & 0x80) == 0) { | 682 | if ((data[0] & 0x80) == 0) { |
691 | /* no error on any byte */ | 683 | /* no error on any byte */ |
@@ -706,9 +698,8 @@ static void usa49_indat_callback(struct urb *urb) | |||
706 | flag); | 698 | flag); |
707 | } | 699 | } |
708 | } | 700 | } |
709 | tty_flip_buffer_push(tty); | 701 | tty_flip_buffer_push(&port->port); |
710 | } | 702 | } |
711 | tty_kref_put(tty); | ||
712 | 703 | ||
713 | /* Resubmit urb so we continue receiving */ | 704 | /* Resubmit urb so we continue receiving */ |
714 | err = usb_submit_urb(urb, GFP_ATOMIC); | 705 | err = usb_submit_urb(urb, GFP_ATOMIC); |
@@ -721,7 +712,6 @@ static void usa49wg_indat_callback(struct urb *urb) | |||
721 | int i, len, x, err; | 712 | int i, len, x, err; |
722 | struct usb_serial *serial; | 713 | struct usb_serial *serial; |
723 | struct usb_serial_port *port; | 714 | struct usb_serial_port *port; |
724 | struct tty_struct *tty; | ||
725 | unsigned char *data = urb->transfer_buffer; | 715 | unsigned char *data = urb->transfer_buffer; |
726 | int status = urb->status; | 716 | int status = urb->status; |
727 | 717 | ||
@@ -746,7 +736,6 @@ static void usa49wg_indat_callback(struct urb *urb) | |||
746 | return; | 736 | return; |
747 | } | 737 | } |
748 | port = serial->port[data[i++]]; | 738 | port = serial->port[data[i++]]; |
749 | tty = tty_port_tty_get(&port->port); | ||
750 | len = data[i++]; | 739 | len = data[i++]; |
751 | 740 | ||
752 | /* 0x80 bit is error flag */ | 741 | /* 0x80 bit is error flag */ |
@@ -774,8 +763,7 @@ static void usa49wg_indat_callback(struct urb *urb) | |||
774 | i += 2; | 763 | i += 2; |
775 | } | 764 | } |
776 | } | 765 | } |
777 | tty_flip_buffer_push(tty); | 766 | tty_flip_buffer_push(&port->port); |
778 | tty_kref_put(tty); | ||
779 | } | 767 | } |
780 | } | 768 | } |
781 | 769 | ||
@@ -796,7 +784,6 @@ static void usa90_indat_callback(struct urb *urb) | |||
796 | int endpoint; | 784 | int endpoint; |
797 | struct usb_serial_port *port; | 785 | struct usb_serial_port *port; |
798 | struct keyspan_port_private *p_priv; | 786 | struct keyspan_port_private *p_priv; |
799 | struct tty_struct *tty; | ||
800 | unsigned char *data = urb->transfer_buffer; | 787 | unsigned char *data = urb->transfer_buffer; |
801 | int status = urb->status; | 788 | int status = urb->status; |
802 | 789 | ||
@@ -812,7 +799,6 @@ static void usa90_indat_callback(struct urb *urb) | |||
812 | p_priv = usb_get_serial_port_data(port); | 799 | p_priv = usb_get_serial_port_data(port); |
813 | 800 | ||
814 | if (urb->actual_length) { | 801 | if (urb->actual_length) { |
815 | tty = tty_port_tty_get(&port->port); | ||
816 | /* if current mode is DMA, looks like usa28 format | 802 | /* if current mode is DMA, looks like usa28 format |
817 | otherwise looks like usa26 data format */ | 803 | otherwise looks like usa26 data format */ |
818 | 804 | ||
@@ -848,8 +834,7 @@ static void usa90_indat_callback(struct urb *urb) | |||
848 | } | 834 | } |
849 | } | 835 | } |
850 | } | 836 | } |
851 | tty_flip_buffer_push(tty); | 837 | tty_flip_buffer_push(&port->port); |
852 | tty_kref_put(tty); | ||
853 | } | 838 | } |
854 | 839 | ||
855 | /* Resubmit urb so we continue receiving */ | 840 | /* Resubmit urb so we continue receiving */ |