提交 d1c0713d 编写于 作者: O Oliver Neukum 提交者: Greg Kroah-Hartman

USB: suspend/resume for opticon driver

this does the standard support for suspend/resume for the opticon
driver.
Signed-off-by: NOliver Neukum <oneukum@suse.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 4901b2c3
...@@ -306,11 +306,37 @@ static void opticon_shutdown(struct usb_serial *serial) ...@@ -306,11 +306,37 @@ static void opticon_shutdown(struct usb_serial *serial)
usb_set_serial_data(serial, NULL); 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 = { static struct usb_driver opticon_driver = {
.name = "opticon", .name = "opticon",
.probe = usb_serial_probe, .probe = usb_serial_probe,
.disconnect = usb_serial_disconnect, .disconnect = usb_serial_disconnect,
.suspend = opticon_suspend,
.resume = opticon_resume,
.id_table = id_table, .id_table = id_table,
.no_dynamic_id = 1, .no_dynamic_id = 1,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册