diff options
author | Oliver Neukum <oneukum@suse.de> | 2007-04-27 14:54:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 19:29:44 -0400 |
commit | ec22559e0b7a05283a3413bda5d177e42c950e23 (patch) | |
tree | 5f7a9ae8907cdf910532381111ce4b8aae877e05 /drivers/usb/serial/generic.c | |
parent | dd172d72addefd89795e819cc2cc3eb1b9d12a7f (diff) |
USB: suspend support for usb serial
this implements generic support for suspend/resume for usb serial.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/generic.c')
-rw-r--r-- | drivers/usb/serial/generic.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 4f8282ad7720..b90ef3f70f4c 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -69,6 +69,7 @@ struct usb_serial_driver usb_serial_generic_device = { | |||
69 | .shutdown = usb_serial_generic_shutdown, | 69 | .shutdown = usb_serial_generic_shutdown, |
70 | .throttle = usb_serial_generic_throttle, | 70 | .throttle = usb_serial_generic_throttle, |
71 | .unthrottle = usb_serial_generic_unthrottle, | 71 | .unthrottle = usb_serial_generic_unthrottle, |
72 | .resume = usb_serial_generic_resume, | ||
72 | }; | 73 | }; |
73 | 74 | ||
74 | static int generic_probe(struct usb_interface *interface, | 75 | static int generic_probe(struct usb_interface *interface, |
@@ -169,6 +170,23 @@ static void generic_cleanup (struct usb_serial_port *port) | |||
169 | } | 170 | } |
170 | } | 171 | } |
171 | 172 | ||
173 | int usb_serial_generic_resume(struct usb_serial *serial) | ||
174 | { | ||
175 | struct usb_serial_port *port; | ||
176 | int i, c = 0, r; | ||
177 | |||
178 | for (i = 0; i < serial->num_ports; i++) { | ||
179 | port = serial->port[i]; | ||
180 | if (port->open_count && port->read_urb) { | ||
181 | r = usb_submit_urb(port->read_urb, GFP_NOIO); | ||
182 | if (r < 0) | ||
183 | c++; | ||
184 | } | ||
185 | } | ||
186 | |||
187 | return c ? -EIO : 0; | ||
188 | } | ||
189 | |||
172 | void usb_serial_generic_close (struct usb_serial_port *port, struct file * filp) | 190 | void usb_serial_generic_close (struct usb_serial_port *port, struct file * filp) |
173 | { | 191 | { |
174 | dbg("%s - port %d", __FUNCTION__, port->number); | 192 | dbg("%s - port %d", __FUNCTION__, port->number); |