diff options
Diffstat (limited to 'drivers/usb/serial/sierra.c')
-rw-r--r-- | drivers/usb/serial/sierra.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 8c075b2416bb..5019325ba25d 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -17,7 +17,7 @@ | |||
17 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> | 17 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #define DRIVER_VERSION "v.1.3.7" | 20 | #define DRIVER_VERSION "v.1.3.8" |
21 | #define DRIVER_AUTHOR "Kevin Lloyd, Elina Pasheva, Matthew Safar, Rory Filer" | 21 | #define DRIVER_AUTHOR "Kevin Lloyd, Elina Pasheva, Matthew Safar, Rory Filer" |
22 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" | 22 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" |
23 | 23 | ||
@@ -296,7 +296,6 @@ struct sierra_port_private { | |||
296 | int dsr_state; | 296 | int dsr_state; |
297 | int dcd_state; | 297 | int dcd_state; |
298 | int ri_state; | 298 | int ri_state; |
299 | |||
300 | unsigned int opened:1; | 299 | unsigned int opened:1; |
301 | }; | 300 | }; |
302 | 301 | ||
@@ -306,6 +305,8 @@ static int sierra_send_setup(struct usb_serial_port *port) | |||
306 | struct sierra_port_private *portdata; | 305 | struct sierra_port_private *portdata; |
307 | __u16 interface = 0; | 306 | __u16 interface = 0; |
308 | int val = 0; | 307 | int val = 0; |
308 | int do_send = 0; | ||
309 | int retval; | ||
309 | 310 | ||
310 | dev_dbg(&port->dev, "%s\n", __func__); | 311 | dev_dbg(&port->dev, "%s\n", __func__); |
311 | 312 | ||
@@ -324,10 +325,7 @@ static int sierra_send_setup(struct usb_serial_port *port) | |||
324 | */ | 325 | */ |
325 | if (port->interrupt_in_urb) { | 326 | if (port->interrupt_in_urb) { |
326 | /* send control message */ | 327 | /* send control message */ |
327 | return usb_control_msg(serial->dev, | 328 | do_send = 1; |
328 | usb_rcvctrlpipe(serial->dev, 0), | ||
329 | 0x22, 0x21, val, interface, | ||
330 | NULL, 0, USB_CTRL_SET_TIMEOUT); | ||
331 | } | 329 | } |
332 | } | 330 | } |
333 | 331 | ||
@@ -339,12 +337,18 @@ static int sierra_send_setup(struct usb_serial_port *port) | |||
339 | interface = 1; | 337 | interface = 1; |
340 | else if (port->bulk_out_endpointAddress == 5) | 338 | else if (port->bulk_out_endpointAddress == 5) |
341 | interface = 2; | 339 | interface = 2; |
342 | return usb_control_msg(serial->dev, | 340 | |
343 | usb_rcvctrlpipe(serial->dev, 0), | 341 | do_send = 1; |
344 | 0x22, 0x21, val, interface, | ||
345 | NULL, 0, USB_CTRL_SET_TIMEOUT); | ||
346 | } | 342 | } |
347 | return 0; | 343 | if (!do_send) |
344 | return 0; | ||
345 | |||
346 | usb_autopm_get_interface(serial->interface); | ||
347 | retval = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | ||
348 | 0x22, 0x21, val, interface, NULL, 0, USB_CTRL_SET_TIMEOUT); | ||
349 | usb_autopm_put_interface(serial->interface); | ||
350 | |||
351 | return retval; | ||
348 | } | 352 | } |
349 | 353 | ||
350 | static void sierra_set_termios(struct tty_struct *tty, | 354 | static void sierra_set_termios(struct tty_struct *tty, |
@@ -773,8 +777,11 @@ static void sierra_close(struct usb_serial_port *port) | |||
773 | 777 | ||
774 | if (serial->dev) { | 778 | if (serial->dev) { |
775 | mutex_lock(&serial->disc_mutex); | 779 | mutex_lock(&serial->disc_mutex); |
776 | if (!serial->disconnected) | 780 | if (!serial->disconnected) { |
781 | serial->interface->needs_remote_wakeup = 0; | ||
782 | usb_autopm_get_interface(serial->interface); | ||
777 | sierra_send_setup(port); | 783 | sierra_send_setup(port); |
784 | } | ||
778 | mutex_unlock(&serial->disc_mutex); | 785 | mutex_unlock(&serial->disc_mutex); |
779 | spin_lock_irq(&intfdata->susp_lock); | 786 | spin_lock_irq(&intfdata->susp_lock); |
780 | portdata->opened = 0; | 787 | portdata->opened = 0; |
@@ -788,8 +795,6 @@ static void sierra_close(struct usb_serial_port *port) | |||
788 | sierra_release_urb(portdata->in_urbs[i]); | 795 | sierra_release_urb(portdata->in_urbs[i]); |
789 | portdata->in_urbs[i] = NULL; | 796 | portdata->in_urbs[i] = NULL; |
790 | } | 797 | } |
791 | usb_autopm_get_interface(serial->interface); | ||
792 | serial->interface->needs_remote_wakeup = 0; | ||
793 | } | 798 | } |
794 | } | 799 | } |
795 | 800 | ||
@@ -827,6 +832,8 @@ static int sierra_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
827 | if (err) { | 832 | if (err) { |
828 | /* get rid of everything as in close */ | 833 | /* get rid of everything as in close */ |
829 | sierra_close(port); | 834 | sierra_close(port); |
835 | /* restore balance for autopm */ | ||
836 | usb_autopm_put_interface(serial->interface); | ||
830 | return err; | 837 | return err; |
831 | } | 838 | } |
832 | sierra_send_setup(port); | 839 | sierra_send_setup(port); |
@@ -915,7 +922,7 @@ static void sierra_release(struct usb_serial *serial) | |||
915 | #ifdef CONFIG_PM | 922 | #ifdef CONFIG_PM |
916 | static void stop_read_write_urbs(struct usb_serial *serial) | 923 | static void stop_read_write_urbs(struct usb_serial *serial) |
917 | { | 924 | { |
918 | int i, j; | 925 | int i; |
919 | struct usb_serial_port *port; | 926 | struct usb_serial_port *port; |
920 | struct sierra_port_private *portdata; | 927 | struct sierra_port_private *portdata; |
921 | 928 | ||
@@ -923,8 +930,7 @@ static void stop_read_write_urbs(struct usb_serial *serial) | |||
923 | for (i = 0; i < serial->num_ports; ++i) { | 930 | for (i = 0; i < serial->num_ports; ++i) { |
924 | port = serial->port[i]; | 931 | port = serial->port[i]; |
925 | portdata = usb_get_serial_port_data(port); | 932 | portdata = usb_get_serial_port_data(port); |
926 | for (j = 0; j < N_IN_URB; j++) | 933 | sierra_stop_rx_urbs(port); |
927 | usb_kill_urb(portdata->in_urbs[j]); | ||
928 | usb_kill_anchored_urbs(&portdata->active); | 934 | usb_kill_anchored_urbs(&portdata->active); |
929 | } | 935 | } |
930 | } | 936 | } |