Commit 7186364e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: serial: hook up reset_resume callback

The callback is now hooked up for any USB to serial driver that wants
it.  We only register the callback if any of the usb-serial structures
want it, this keeps the USB core happy.

Thanks to Alan Stern for the ideas on how to do this.

Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 09c94e62
/* /*
* USB Serial Converter driver * USB Serial Converter driver
* *
* Copyright (C) 1999 - 2005 Greg Kroah-Hartman (greg@kroah.com) * Copyright (C) 1999 - 2012 Greg Kroah-Hartman (greg@kroah.com)
* Copyright (C) 2000 Peter Berger (pberger@brimson.com) * Copyright (C) 2000 Peter Berger (pberger@brimson.com)
* Copyright (C) 2000 Al Borchers (borchers@steinerpoint.com) * Copyright (C) 2000 Al Borchers (borchers@steinerpoint.com)
* *
...@@ -1166,6 +1166,20 @@ int usb_serial_resume(struct usb_interface *intf) ...@@ -1166,6 +1166,20 @@ int usb_serial_resume(struct usb_interface *intf)
} }
EXPORT_SYMBOL(usb_serial_resume); EXPORT_SYMBOL(usb_serial_resume);
static int usb_serial_reset_resume(struct usb_interface *intf)
{
struct usb_serial *serial = usb_get_intfdata(intf);
int rv;
serial->suspending = 0;
if (serial->type->reset_resume)
rv = serial->type->reset_resume(serial);
else
rv = usb_serial_generic_resume(serial);
return rv;
}
static const struct tty_operations serial_ops = { static const struct tty_operations serial_ops = {
.open = serial_open, .open = serial_open,
.close = serial_close, .close = serial_close,
...@@ -1403,6 +1417,14 @@ int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[] ...@@ -1403,6 +1417,14 @@ int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[]
udriver->resume = usb_serial_resume; udriver->resume = usb_serial_resume;
udriver->probe = usb_serial_probe; udriver->probe = usb_serial_probe;
udriver->disconnect = usb_serial_disconnect; udriver->disconnect = usb_serial_disconnect;
/* we only set the reset_resume field if the serial_driver has one */
for (sd = serial_drivers; *sd; ++sd) {
if ((*sd)->reset_resume)
udriver->reset_resume = usb_serial_reset_resume;
break;
}
rc = usb_register(udriver); rc = usb_register(udriver);
if (rc) if (rc)
return rc; return rc;
......
/* /*
* USB Serial Converter stuff * USB Serial Converter stuff
* *
* Copyright (C) 1999 - 2005 * Copyright (C) 1999 - 2012
* Greg Kroah-Hartman (greg@kroah.com) * Greg Kroah-Hartman (greg@kroah.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -249,6 +249,7 @@ struct usb_serial_driver { ...@@ -249,6 +249,7 @@ struct usb_serial_driver {
int (*suspend)(struct usb_serial *serial, pm_message_t message); int (*suspend)(struct usb_serial *serial, pm_message_t message);
int (*resume)(struct usb_serial *serial); int (*resume)(struct usb_serial *serial);
int (*reset_resume)(struct usb_serial *serial);
/* serial function calls */ /* serial function calls */
/* Called by console and by the tty layer */ /* Called by console and by the tty layer */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment