diff options
author | Oliver Neukum <oliver@neukum.org> | 2009-01-14 18:34:06 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 16:20:29 -0700 |
commit | d1c0713daea5d1d881ecc8707458ca6746031376 (patch) | |
tree | 6428eba428aed06a8ffcbf8d9353b5209e3e4c58 /drivers/usb/serial/opticon.c | |
parent | 4901b2c34ecb6fc45909228ad269c8126efe4401 (diff) | |
download | blackbird-op-linux-d1c0713daea5d1d881ecc8707458ca6746031376.tar.gz blackbird-op-linux-d1c0713daea5d1d881ecc8707458ca6746031376.zip |
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/opticon.c')
-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) usb_set_serial_data(serial, NULL); } +static int opticon_suspend(struct usb_interface *intf, pm_message_t message) +{ + struct usb_serial *serial = usb_get_intfdata(intf); + struct opticon_private *priv = usb_get_serial_data(serial); + + usb_kill_urb(priv->bulk_read_urb); + return 0; +} + +static int opticon_resume(struct usb_interface *intf) +{ + struct usb_serial *serial = usb_get_intfdata(intf); + struct opticon_private *priv = usb_get_serial_data(serial); + struct usb_serial_port *port = serial->port[0]; + int result; + + mutex_lock(&port->mutex); + if (port->port.count) + result = usb_submit_urb(priv->bulk_read_urb, GFP_NOIO); + else + result = 0; + mutex_unlock(&port->mutex); + return result; +} static struct usb_driver opticon_driver = { .name = "opticon", .probe = usb_serial_probe, .disconnect = usb_serial_disconnect, + .suspend = opticon_suspend, + .resume = opticon_resume, .id_table = id_table, .no_dynamic_id = 1, }; |