diff options
author | Oliver Neukum <oliver@neukum.org> | 2009-01-14 12:34:06 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:20:29 -0400 |
commit | d1c0713daea5d1d881ecc8707458ca6746031376 (patch) | |
tree | 6428eba428aed06a8ffcbf8d9353b5209e3e4c58 /drivers/usb/serial | |
parent | 4901b2c34ecb6fc45909228ad269c8126efe4401 (diff) |
USB: suspend/resume for opticon driver
this does the standard support for suspend/resume for the opticon
driver.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/opticon.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index cea326f1f105..00d5c60adeda 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
@@ -306,11 +306,37 @@ static void opticon_shutdown(struct usb_serial *serial) | |||
306 | usb_set_serial_data(serial, NULL); | 306 | usb_set_serial_data(serial, NULL); |
307 | } | 307 | } |
308 | 308 | ||
309 | static int opticon_suspend(struct usb_interface *intf, pm_message_t message) | ||
310 | { | ||
311 | struct usb_serial *serial = usb_get_intfdata(intf); | ||
312 | struct opticon_private *priv = usb_get_serial_data(serial); | ||
313 | |||
314 | usb_kill_urb(priv->bulk_read_urb); | ||
315 | return 0; | ||
316 | } | ||
317 | |||
318 | static int opticon_resume(struct usb_interface *intf) | ||
319 | { | ||
320 | struct usb_serial *serial = usb_get_intfdata(intf); | ||
321 | struct opticon_private *priv = usb_get_serial_data(serial); | ||
322 | struct usb_serial_port *port = serial->port[0]; | ||
323 | int result; | ||
324 | |||
325 | mutex_lock(&port->mutex); | ||
326 | if (port->port.count) | ||
327 | result = usb_submit_urb(priv->bulk_read_urb, GFP_NOIO); | ||
328 | else | ||
329 | result = 0; | ||
330 | mutex_unlock(&port->mutex); | ||
331 | return result; | ||
332 | } | ||
309 | 333 | ||
310 | static struct usb_driver opticon_driver = { | 334 | static struct usb_driver opticon_driver = { |
311 | .name = "opticon", | 335 | .name = "opticon", |
312 | .probe = usb_serial_probe, | 336 | .probe = usb_serial_probe, |
313 | .disconnect = usb_serial_disconnect, | 337 | .disconnect = usb_serial_disconnect, |
338 | .suspend = opticon_suspend, | ||
339 | .resume = opticon_resume, | ||
314 | .id_table = id_table, | 340 | .id_table = id_table, |
315 | .no_dynamic_id = 1, | 341 | .no_dynamic_id = 1, |
316 | }; | 342 | }; |