Skip to content

Commit

Permalink
USB: serial: ch341: fix resume after reset
Browse files Browse the repository at this point in the history
Fix reset-resume handling which failed to resubmit the read and
interrupt URBs, thereby leaving a port that was open before suspend in a
broken state until closed and reopened.

Fixes: 1ded7ea ("USB: ch341 serial: fix port number changed after
resume")
Fixes: 2bfd1c9 ("USB: serial: ch341: remove reset_resume callback")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
  • Loading branch information
Johan Hovold committed Jan 9, 2017
1 parent f2950b7 commit ce5e292
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions drivers/usb/serial/ch341.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,14 +582,23 @@ static int ch341_tiocmget(struct tty_struct *tty)

static int ch341_reset_resume(struct usb_serial *serial)
{
struct ch341_private *priv;

priv = usb_get_serial_port_data(serial->port[0]);
struct usb_serial_port *port = serial->port[0];
struct ch341_private *priv = usb_get_serial_port_data(port);
int ret;

/* reconfigure ch341 serial port after bus-reset */
ch341_configure(serial->dev, priv);

return 0;
if (tty_port_initialized(&port->port)) {
ret = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO);
if (ret) {
dev_err(&port->dev, "failed to submit interrupt urb: %d\n",
ret);
return ret;
}
}

return usb_serial_generic_resume(serial);
}

static struct usb_serial_driver ch341_device = {
Expand Down

0 comments on commit ce5e292

Please sign in to comment.