diff options
Diffstat (limited to 'drivers/usb/serial/keyspan.c')
-rw-r--r-- | drivers/usb/serial/keyspan.c | 80 |
1 files changed, 42 insertions, 38 deletions
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 704716f6f6d3..9878c0fb3859 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -217,7 +217,8 @@ static int __init keyspan_init(void) | |||
217 | if (retval) | 217 | if (retval) |
218 | goto failed_usb_register; | 218 | goto failed_usb_register; |
219 | 219 | ||
220 | info(DRIVER_VERSION ":" DRIVER_DESC); | 220 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |
221 | DRIVER_DESC "\n"); | ||
221 | 222 | ||
222 | return 0; | 223 | return 0; |
223 | failed_usb_register: | 224 | failed_usb_register: |
@@ -430,7 +431,7 @@ static void usa26_indat_callback(struct urb *urb) | |||
430 | } | 431 | } |
431 | 432 | ||
432 | port = urb->context; | 433 | port = urb->context; |
433 | tty = port->port.tty; | 434 | tty = tty_port_tty_get(&port->port); |
434 | if (tty && urb->actual_length) { | 435 | if (tty && urb->actual_length) { |
435 | /* 0x80 bit is error flag */ | 436 | /* 0x80 bit is error flag */ |
436 | if ((data[0] & 0x80) == 0) { | 437 | if ((data[0] & 0x80) == 0) { |
@@ -459,6 +460,7 @@ static void usa26_indat_callback(struct urb *urb) | |||
459 | } | 460 | } |
460 | tty_flip_buffer_push(tty); | 461 | tty_flip_buffer_push(tty); |
461 | } | 462 | } |
463 | tty_kref_put(tty); | ||
462 | 464 | ||
463 | /* Resubmit urb so we continue receiving */ | 465 | /* Resubmit urb so we continue receiving */ |
464 | urb->dev = port->serial->dev; | 466 | urb->dev = port->serial->dev; |
@@ -513,6 +515,7 @@ static void usa26_instat_callback(struct urb *urb) | |||
513 | struct usb_serial *serial; | 515 | struct usb_serial *serial; |
514 | struct usb_serial_port *port; | 516 | struct usb_serial_port *port; |
515 | struct keyspan_port_private *p_priv; | 517 | struct keyspan_port_private *p_priv; |
518 | struct tty_struct *tty; | ||
516 | int old_dcd_state, err; | 519 | int old_dcd_state, err; |
517 | int status = urb->status; | 520 | int status = urb->status; |
518 | 521 | ||
@@ -553,12 +556,11 @@ static void usa26_instat_callback(struct urb *urb) | |||
553 | p_priv->dcd_state = ((msg->gpia_dcd) ? 1 : 0); | 556 | p_priv->dcd_state = ((msg->gpia_dcd) ? 1 : 0); |
554 | p_priv->ri_state = ((msg->ri) ? 1 : 0); | 557 | p_priv->ri_state = ((msg->ri) ? 1 : 0); |
555 | 558 | ||
556 | if (port->port.tty && !C_CLOCAL(port->port.tty) | 559 | if (old_dcd_state != p_priv->dcd_state) { |
557 | && old_dcd_state != p_priv->dcd_state) { | 560 | tty = tty_port_tty_get(&port->port); |
558 | if (old_dcd_state) | 561 | if (tty && !C_CLOCAL(tty)) |
559 | tty_hangup(port->port.tty); | 562 | tty_hangup(tty); |
560 | /* else */ | 563 | tty_kref_put(tty); |
561 | /* wake_up_interruptible(&p_priv->open_wait); */ | ||
562 | } | 564 | } |
563 | 565 | ||
564 | /* Resubmit urb so we continue receiving */ | 566 | /* Resubmit urb so we continue receiving */ |
@@ -604,11 +606,12 @@ static void usa28_indat_callback(struct urb *urb) | |||
604 | p_priv = usb_get_serial_port_data(port); | 606 | p_priv = usb_get_serial_port_data(port); |
605 | data = urb->transfer_buffer; | 607 | data = urb->transfer_buffer; |
606 | 608 | ||
607 | tty = port->port.tty; | 609 | tty =tty_port_tty_get(&port->port); |
608 | if (urb->actual_length) { | 610 | if (tty && urb->actual_length) { |
609 | tty_insert_flip_string(tty, data, urb->actual_length); | 611 | tty_insert_flip_string(tty, data, urb->actual_length); |
610 | tty_flip_buffer_push(tty); | 612 | tty_flip_buffer_push(tty); |
611 | } | 613 | } |
614 | tty_kref_put(tty); | ||
612 | 615 | ||
613 | /* Resubmit urb so we continue receiving */ | 616 | /* Resubmit urb so we continue receiving */ |
614 | urb->dev = port->serial->dev; | 617 | urb->dev = port->serial->dev; |
@@ -652,6 +655,7 @@ static void usa28_instat_callback(struct urb *urb) | |||
652 | struct usb_serial *serial; | 655 | struct usb_serial *serial; |
653 | struct usb_serial_port *port; | 656 | struct usb_serial_port *port; |
654 | struct keyspan_port_private *p_priv; | 657 | struct keyspan_port_private *p_priv; |
658 | struct tty_struct *tty; | ||
655 | int old_dcd_state; | 659 | int old_dcd_state; |
656 | int status = urb->status; | 660 | int status = urb->status; |
657 | 661 | ||
@@ -689,12 +693,11 @@ static void usa28_instat_callback(struct urb *urb) | |||
689 | p_priv->dcd_state = ((msg->dcd) ? 1 : 0); | 693 | p_priv->dcd_state = ((msg->dcd) ? 1 : 0); |
690 | p_priv->ri_state = ((msg->ri) ? 1 : 0); | 694 | p_priv->ri_state = ((msg->ri) ? 1 : 0); |
691 | 695 | ||
692 | if (port->port.tty && !C_CLOCAL(port->port.tty) | 696 | if( old_dcd_state != p_priv->dcd_state && old_dcd_state) { |
693 | && old_dcd_state != p_priv->dcd_state) { | 697 | tty = tty_port_tty_get(&port->port); |
694 | if (old_dcd_state) | 698 | if (tty && !C_CLOCAL(tty)) |
695 | tty_hangup(port->port.tty); | 699 | tty_hangup(tty); |
696 | /* else */ | 700 | tty_kref_put(tty); |
697 | /* wake_up_interruptible(&p_priv->open_wait); */ | ||
698 | } | 701 | } |
699 | 702 | ||
700 | /* Resubmit urb so we continue receiving */ | 703 | /* Resubmit urb so we continue receiving */ |
@@ -785,12 +788,11 @@ static void usa49_instat_callback(struct urb *urb) | |||
785 | p_priv->dcd_state = ((msg->dcd) ? 1 : 0); | 788 | p_priv->dcd_state = ((msg->dcd) ? 1 : 0); |
786 | p_priv->ri_state = ((msg->ri) ? 1 : 0); | 789 | p_priv->ri_state = ((msg->ri) ? 1 : 0); |
787 | 790 | ||
788 | if (port->port.tty && !C_CLOCAL(port->port.tty) | 791 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) { |
789 | && old_dcd_state != p_priv->dcd_state) { | 792 | struct tty_struct *tty = tty_port_tty_get(&port->port); |
790 | if (old_dcd_state) | 793 | if (tty && !C_CLOCAL(tty)) |
791 | tty_hangup(port->port.tty); | 794 | tty_hangup(tty); |
792 | /* else */ | 795 | tty_kref_put(tty); |
793 | /* wake_up_interruptible(&p_priv->open_wait); */ | ||
794 | } | 796 | } |
795 | 797 | ||
796 | /* Resubmit urb so we continue receiving */ | 798 | /* Resubmit urb so we continue receiving */ |
@@ -827,7 +829,7 @@ static void usa49_indat_callback(struct urb *urb) | |||
827 | } | 829 | } |
828 | 830 | ||
829 | port = urb->context; | 831 | port = urb->context; |
830 | tty = port->port.tty; | 832 | tty = tty_port_tty_get(&port->port); |
831 | if (tty && urb->actual_length) { | 833 | if (tty && urb->actual_length) { |
832 | /* 0x80 bit is error flag */ | 834 | /* 0x80 bit is error flag */ |
833 | if ((data[0] & 0x80) == 0) { | 835 | if ((data[0] & 0x80) == 0) { |
@@ -850,6 +852,7 @@ static void usa49_indat_callback(struct urb *urb) | |||
850 | } | 852 | } |
851 | tty_flip_buffer_push(tty); | 853 | tty_flip_buffer_push(tty); |
852 | } | 854 | } |
855 | tty_kref_put(tty); | ||
853 | 856 | ||
854 | /* Resubmit urb so we continue receiving */ | 857 | /* Resubmit urb so we continue receiving */ |
855 | urb->dev = port->serial->dev; | 858 | urb->dev = port->serial->dev; |
@@ -893,7 +896,7 @@ static void usa49wg_indat_callback(struct urb *urb) | |||
893 | return; | 896 | return; |
894 | } | 897 | } |
895 | port = serial->port[data[i++]]; | 898 | port = serial->port[data[i++]]; |
896 | tty = port->port.tty; | 899 | tty = tty_port_tty_get(&port->port); |
897 | len = data[i++]; | 900 | len = data[i++]; |
898 | 901 | ||
899 | /* 0x80 bit is error flag */ | 902 | /* 0x80 bit is error flag */ |
@@ -927,6 +930,7 @@ static void usa49wg_indat_callback(struct urb *urb) | |||
927 | } | 930 | } |
928 | if (port->port.count) | 931 | if (port->port.count) |
929 | tty_flip_buffer_push(tty); | 932 | tty_flip_buffer_push(tty); |
933 | tty_kref_put(tty); | ||
930 | } | 934 | } |
931 | } | 935 | } |
932 | 936 | ||
@@ -967,8 +971,8 @@ static void usa90_indat_callback(struct urb *urb) | |||
967 | port = urb->context; | 971 | port = urb->context; |
968 | p_priv = usb_get_serial_port_data(port); | 972 | p_priv = usb_get_serial_port_data(port); |
969 | 973 | ||
970 | tty = port->port.tty; | ||
971 | if (urb->actual_length) { | 974 | if (urb->actual_length) { |
975 | tty = tty_port_tty_get(&port->port); | ||
972 | /* if current mode is DMA, looks like usa28 format | 976 | /* if current mode is DMA, looks like usa28 format |
973 | otherwise looks like usa26 data format */ | 977 | otherwise looks like usa26 data format */ |
974 | 978 | ||
@@ -1004,6 +1008,7 @@ static void usa90_indat_callback(struct urb *urb) | |||
1004 | } | 1008 | } |
1005 | } | 1009 | } |
1006 | tty_flip_buffer_push(tty); | 1010 | tty_flip_buffer_push(tty); |
1011 | tty_kref_put(tty); | ||
1007 | } | 1012 | } |
1008 | 1013 | ||
1009 | /* Resubmit urb so we continue receiving */ | 1014 | /* Resubmit urb so we continue receiving */ |
@@ -1025,6 +1030,7 @@ static void usa90_instat_callback(struct urb *urb) | |||
1025 | struct usb_serial *serial; | 1030 | struct usb_serial *serial; |
1026 | struct usb_serial_port *port; | 1031 | struct usb_serial_port *port; |
1027 | struct keyspan_port_private *p_priv; | 1032 | struct keyspan_port_private *p_priv; |
1033 | struct tty_struct *tty; | ||
1028 | int old_dcd_state, err; | 1034 | int old_dcd_state, err; |
1029 | int status = urb->status; | 1035 | int status = urb->status; |
1030 | 1036 | ||
@@ -1053,12 +1059,11 @@ static void usa90_instat_callback(struct urb *urb) | |||
1053 | p_priv->dcd_state = ((msg->dcd) ? 1 : 0); | 1059 | p_priv->dcd_state = ((msg->dcd) ? 1 : 0); |
1054 | p_priv->ri_state = ((msg->ri) ? 1 : 0); | 1060 | p_priv->ri_state = ((msg->ri) ? 1 : 0); |
1055 | 1061 | ||
1056 | if (port->port.tty && !C_CLOCAL(port->port.tty) | 1062 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) { |
1057 | && old_dcd_state != p_priv->dcd_state) { | 1063 | tty = tty_port_tty_get(&port->port); |
1058 | if (old_dcd_state) | 1064 | if (tty && !C_CLOCAL(tty)) |
1059 | tty_hangup(port->port.tty); | 1065 | tty_hangup(tty); |
1060 | /* else */ | 1066 | tty_kref_put(tty); |
1061 | /* wake_up_interruptible(&p_priv->open_wait); */ | ||
1062 | } | 1067 | } |
1063 | 1068 | ||
1064 | /* Resubmit urb so we continue receiving */ | 1069 | /* Resubmit urb so we continue receiving */ |
@@ -1130,12 +1135,11 @@ static void usa67_instat_callback(struct urb *urb) | |||
1130 | p_priv->cts_state = ((msg->hskia_cts) ? 1 : 0); | 1135 | p_priv->cts_state = ((msg->hskia_cts) ? 1 : 0); |
1131 | p_priv->dcd_state = ((msg->gpia_dcd) ? 1 : 0); | 1136 | p_priv->dcd_state = ((msg->gpia_dcd) ? 1 : 0); |
1132 | 1137 | ||
1133 | if (port->port.tty && !C_CLOCAL(port->port.tty) | 1138 | if (old_dcd_state != p_priv->dcd_state && old_dcd_state) { |
1134 | && old_dcd_state != p_priv->dcd_state) { | 1139 | struct tty_struct *tty = tty_port_tty_get(&port->port); |
1135 | if (old_dcd_state) | 1140 | if (tty && !C_CLOCAL(tty)) |
1136 | tty_hangup(port->port.tty); | 1141 | tty_hangup(tty); |
1137 | /* else */ | 1142 | tty_kref_put(tty); |
1138 | /* wake_up_interruptible(&p_priv->open_wait); */ | ||
1139 | } | 1143 | } |
1140 | 1144 | ||
1141 | /* Resubmit urb so we continue receiving */ | 1145 | /* Resubmit urb so we continue receiving */ |
@@ -1332,7 +1336,7 @@ static void keyspan_close(struct tty_struct *tty, | |||
1332 | stop_urb(p_priv->out_urbs[i]); | 1336 | stop_urb(p_priv->out_urbs[i]); |
1333 | } | 1337 | } |
1334 | } | 1338 | } |
1335 | port->port.tty = NULL; | 1339 | tty_port_tty_set(&port->port, NULL); |
1336 | } | 1340 | } |
1337 | 1341 | ||
1338 | /* download the firmware to a pre-renumeration device */ | 1342 | /* download the firmware to a pre-renumeration device */ |