USB: serial: sierra driver send_setup() autopm fix
This patch presents a fix for the autosuspend feature implementation in sierra usb serial driver for function sierra_send_setup(). Because it is possible to call sierra_send_setup() before sierra_open() or after sierra_close() we added a get/put interface activity to assure that the usb control can happen even when the device is autosuspended. Signed-off-by: Elina Pasheva <epasheva@sierrawireless.com> Tested-by: Matthew Safar <msafar@sierrawireless.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
40ac7b62d8
commit
3c77d5137d
@@ -296,7 +296,6 @@ struct sierra_port_private {
|
|||||||
int dsr_state;
|
int dsr_state;
|
||||||
int dcd_state;
|
int dcd_state;
|
||||||
int ri_state;
|
int ri_state;
|
||||||
|
|
||||||
unsigned int opened:1;
|
unsigned int opened:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -306,6 +305,8 @@ static int sierra_send_setup(struct usb_serial_port *port)
|
|||||||
struct sierra_port_private *portdata;
|
struct sierra_port_private *portdata;
|
||||||
__u16 interface = 0;
|
__u16 interface = 0;
|
||||||
int val = 0;
|
int val = 0;
|
||||||
|
int do_send = 0;
|
||||||
|
int retval;
|
||||||
|
|
||||||
dev_dbg(&port->dev, "%s\n", __func__);
|
dev_dbg(&port->dev, "%s\n", __func__);
|
||||||
|
|
||||||
@@ -324,10 +325,7 @@ static int sierra_send_setup(struct usb_serial_port *port)
|
|||||||
*/
|
*/
|
||||||
if (port->interrupt_in_urb) {
|
if (port->interrupt_in_urb) {
|
||||||
/* send control message */
|
/* send control message */
|
||||||
return usb_control_msg(serial->dev,
|
do_send = 1;
|
||||||
usb_rcvctrlpipe(serial->dev, 0),
|
|
||||||
0x22, 0x21, val, interface,
|
|
||||||
NULL, 0, USB_CTRL_SET_TIMEOUT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,12 +337,18 @@ static int sierra_send_setup(struct usb_serial_port *port)
|
|||||||
interface = 1;
|
interface = 1;
|
||||||
else if (port->bulk_out_endpointAddress == 5)
|
else if (port->bulk_out_endpointAddress == 5)
|
||||||
interface = 2;
|
interface = 2;
|
||||||
return usb_control_msg(serial->dev,
|
|
||||||
usb_rcvctrlpipe(serial->dev, 0),
|
do_send = 1;
|
||||||
0x22, 0x21, val, interface,
|
|
||||||
NULL, 0, USB_CTRL_SET_TIMEOUT);
|
|
||||||
}
|
}
|
||||||
return 0;
|
if (!do_send)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
usb_autopm_get_interface(serial->interface);
|
||||||
|
retval = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
|
||||||
|
0x22, 0x21, val, interface, NULL, 0, USB_CTRL_SET_TIMEOUT);
|
||||||
|
usb_autopm_put_interface(serial->interface);
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sierra_set_termios(struct tty_struct *tty,
|
static void sierra_set_termios(struct tty_struct *tty,
|
||||||
|
Reference in New Issue
Block a user