diff options
Diffstat (limited to 'drivers/usb/serial/mos7840.c')
-rw-r--r-- | drivers/usb/serial/mos7840.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 96a8c7713212..2c20e88a91b3 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -214,6 +214,7 @@ struct moschip_port { | |||
214 | spinlock_t pool_lock; | 214 | spinlock_t pool_lock; |
215 | struct urb *write_urb_pool[NUM_URBS]; | 215 | struct urb *write_urb_pool[NUM_URBS]; |
216 | char busy[NUM_URBS]; | 216 | char busy[NUM_URBS]; |
217 | bool read_urb_busy; | ||
217 | }; | 218 | }; |
218 | 219 | ||
219 | 220 | ||
@@ -679,26 +680,30 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
679 | struct tty_struct *tty; | 680 | struct tty_struct *tty; |
680 | int status = urb->status; | 681 | int status = urb->status; |
681 | 682 | ||
682 | if (status) { | ||
683 | dbg("nonzero read bulk status received: %d", status); | ||
684 | return; | ||
685 | } | ||
686 | |||
687 | mos7840_port = urb->context; | 683 | mos7840_port = urb->context; |
688 | if (!mos7840_port) { | 684 | if (!mos7840_port) { |
689 | dbg("%s", "NULL mos7840_port pointer \n"); | 685 | dbg("%s", "NULL mos7840_port pointer \n"); |
686 | mos7840_port->read_urb_busy = false; | ||
687 | return; | ||
688 | } | ||
689 | |||
690 | if (status) { | ||
691 | dbg("nonzero read bulk status received: %d", status); | ||
692 | mos7840_port->read_urb_busy = false; | ||
690 | return; | 693 | return; |
691 | } | 694 | } |
692 | 695 | ||
693 | port = (struct usb_serial_port *)mos7840_port->port; | 696 | port = (struct usb_serial_port *)mos7840_port->port; |
694 | if (mos7840_port_paranoia_check(port, __func__)) { | 697 | if (mos7840_port_paranoia_check(port, __func__)) { |
695 | dbg("%s", "Port Paranoia failed \n"); | 698 | dbg("%s", "Port Paranoia failed \n"); |
699 | mos7840_port->read_urb_busy = false; | ||
696 | return; | 700 | return; |
697 | } | 701 | } |
698 | 702 | ||
699 | serial = mos7840_get_usb_serial(port, __func__); | 703 | serial = mos7840_get_usb_serial(port, __func__); |
700 | if (!serial) { | 704 | if (!serial) { |
701 | dbg("%s\n", "Bad serial pointer "); | 705 | dbg("%s\n", "Bad serial pointer "); |
706 | mos7840_port->read_urb_busy = false; | ||
702 | return; | 707 | return; |
703 | } | 708 | } |
704 | 709 | ||
@@ -725,17 +730,19 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
725 | 730 | ||
726 | if (!mos7840_port->read_urb) { | 731 | if (!mos7840_port->read_urb) { |
727 | dbg("%s", "URB KILLED !!!\n"); | 732 | dbg("%s", "URB KILLED !!!\n"); |
733 | mos7840_port->read_urb_busy = false; | ||
728 | return; | 734 | return; |
729 | } | 735 | } |
730 | 736 | ||
731 | 737 | ||
732 | mos7840_port->read_urb->dev = serial->dev; | 738 | mos7840_port->read_urb->dev = serial->dev; |
733 | 739 | ||
740 | mos7840_port->read_urb_busy = true; | ||
734 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 741 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
735 | 742 | ||
736 | if (retval) { | 743 | if (retval) { |
737 | dbg(" usb_submit_urb(read bulk) failed, retval = %d", | 744 | dbg("usb_submit_urb(read bulk) failed, retval = %d", retval); |
738 | retval); | 745 | mos7840_port->read_urb_busy = false; |
739 | } | 746 | } |
740 | } | 747 | } |
741 | 748 | ||
@@ -1055,10 +1062,12 @@ static int mos7840_open(struct tty_struct *tty, | |||
1055 | 1062 | ||
1056 | dbg("mos7840_open: bulkin endpoint is %d\n", | 1063 | dbg("mos7840_open: bulkin endpoint is %d\n", |
1057 | port->bulk_in_endpointAddress); | 1064 | port->bulk_in_endpointAddress); |
1065 | mos7840_port->read_urb_busy = true; | ||
1058 | response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); | 1066 | response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); |
1059 | if (response) { | 1067 | if (response) { |
1060 | dev_err(&port->dev, "%s - Error %d submitting control urb\n", | 1068 | dev_err(&port->dev, "%s - Error %d submitting control urb\n", |
1061 | __func__, response); | 1069 | __func__, response); |
1070 | mos7840_port->read_urb_busy = false; | ||
1062 | } | 1071 | } |
1063 | 1072 | ||
1064 | /* initialize our wait queues */ | 1073 | /* initialize our wait queues */ |
@@ -1227,6 +1236,7 @@ static void mos7840_close(struct tty_struct *tty, | |||
1227 | if (mos7840_port->read_urb) { | 1236 | if (mos7840_port->read_urb) { |
1228 | dbg("%s", "Shutdown bulk read\n"); | 1237 | dbg("%s", "Shutdown bulk read\n"); |
1229 | usb_kill_urb(mos7840_port->read_urb); | 1238 | usb_kill_urb(mos7840_port->read_urb); |
1239 | mos7840_port->read_urb_busy = false; | ||
1230 | } | 1240 | } |
1231 | if ((&mos7840_port->control_urb)) { | 1241 | if ((&mos7840_port->control_urb)) { |
1232 | dbg("%s", "Shutdown control read\n"); | 1242 | dbg("%s", "Shutdown control read\n"); |
@@ -2043,14 +2053,14 @@ static void mos7840_change_port_settings(struct tty_struct *tty, | |||
2043 | Data = 0x0c; | 2053 | Data = 0x0c; |
2044 | mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); | 2054 | mos7840_set_uart_reg(port, INTERRUPT_ENABLE_REGISTER, Data); |
2045 | 2055 | ||
2046 | if (mos7840_port->read_urb->status != -EINPROGRESS) { | 2056 | if (mos7840_port->read_urb_busy == false) { |
2047 | mos7840_port->read_urb->dev = serial->dev; | 2057 | mos7840_port->read_urb->dev = serial->dev; |
2048 | 2058 | mos7840_port->read_urb_busy = true; | |
2049 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 2059 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
2050 | |||
2051 | if (status) { | 2060 | if (status) { |
2052 | dbg(" usb_submit_urb(read bulk) failed, status = %d", | 2061 | dbg("usb_submit_urb(read bulk) failed, status = %d", |
2053 | status); | 2062 | status); |
2063 | mos7840_port->read_urb_busy = false; | ||
2054 | } | 2064 | } |
2055 | } | 2065 | } |
2056 | wake_up(&mos7840_port->delta_msr_wait); | 2066 | wake_up(&mos7840_port->delta_msr_wait); |
@@ -2117,12 +2127,14 @@ static void mos7840_set_termios(struct tty_struct *tty, | |||
2117 | return; | 2127 | return; |
2118 | } | 2128 | } |
2119 | 2129 | ||
2120 | if (mos7840_port->read_urb->status != -EINPROGRESS) { | 2130 | if (mos7840_port->read_urb_busy == false) { |
2121 | mos7840_port->read_urb->dev = serial->dev; | 2131 | mos7840_port->read_urb->dev = serial->dev; |
2132 | mos7840_port->read_urb_busy = true; | ||
2122 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 2133 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
2123 | if (status) { | 2134 | if (status) { |
2124 | dbg(" usb_submit_urb(read bulk) failed, status = %d", | 2135 | dbg("usb_submit_urb(read bulk) failed, status = %d", |
2125 | status); | 2136 | status); |
2137 | mos7840_port->read_urb_busy = false; | ||
2126 | } | 2138 | } |
2127 | } | 2139 | } |
2128 | return; | 2140 | return; |