aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/generic.c
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@intel.com>2007-11-13 20:10:09 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-01 17:34:51 -0500
commitf0fbd5b9ba893b965b2892c1971e3433092b98c7 (patch)
tree8f2684012950c354d1fcb0dd08e78c0ce5fb6ff6 /drivers/usb/serial/generic.c
parent00274921a052d3232d9f00856387fb269ac0af11 (diff)
USB: Prepare serial core for autosuspend.
Claim the interface for a USB to serial converter when the tty is open, and release the interface when the tty is closed. If a driver doesn't provide a resume function, use the generic resume instead. Make sure the generic resume function does not submit the URBs if we're coming back from autosuspend. On autoresume, we know that the open function will be called next, which will attempt to submit the URBs. If we submit them in the resume function, the open will fail. This works for: - autosuspend - suspending with the tty open or closed - hibernate with the tty closed A hibernate (or a suspend that causes the USB subsystem to lose power) has issues. If you have the tty open when you hibernate, a new tty will be created when the device re-enumerates during resume. Signed-off-by: Sarah Sharp <sarah.a.sharp@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/generic.c')
-rw-r--r--drivers/usb/serial/generic.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index d41531139c55..97fa3c428435 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -175,6 +175,14 @@ int usb_serial_generic_resume(struct usb_serial *serial)
175 struct usb_serial_port *port; 175 struct usb_serial_port *port;
176 int i, c = 0, r; 176 int i, c = 0, r;
177 177
178#ifdef CONFIG_PM
179 /*
180 * If this is an autoresume, don't submit URBs.
181 * They will be submitted in the open function instead.
182 */
183 if (serial->dev->auto_pm)
184 return 0;
185#endif
178 for (i = 0; i < serial->num_ports; i++) { 186 for (i = 0; i < serial->num_ports; i++) {
179 port = serial->port[i]; 187 port = serial->port[i];
180 if (port->open_count && port->read_urb) { 188 if (port->open_count && port->read_urb) {