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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
dd172d72ad
commit
ec22559e0b
@@ -46,6 +46,8 @@ static struct usb_driver usb_serial_driver = {
|
||||
.name = "usbserial",
|
||||
.probe = usb_serial_probe,
|
||||
.disconnect = usb_serial_disconnect,
|
||||
.suspend = usb_serial_suspend,
|
||||
.resume = usb_serial_resume,
|
||||
.no_dynamic_id = 1,
|
||||
};
|
||||
|
||||
@@ -1069,6 +1071,35 @@ void usb_serial_disconnect(struct usb_interface *interface)
|
||||
dev_info(dev, "device disconnected\n");
|
||||
}
|
||||
|
||||
int usb_serial_suspend(struct usb_interface *intf, pm_message_t message)
|
||||
{
|
||||
struct usb_serial *serial = usb_get_intfdata(intf);
|
||||
struct usb_serial_port *port;
|
||||
int i, r = 0;
|
||||
|
||||
if (serial) {
|
||||
for (i = 0; i < serial->num_ports; ++i) {
|
||||
port = serial->port[i];
|
||||
if (port)
|
||||
kill_traffic(port);
|
||||
}
|
||||
}
|
||||
|
||||
if (serial->type->suspend)
|
||||
serial->type->suspend(serial, message);
|
||||
|
||||
return r;
|
||||
}
|
||||
EXPORT_SYMBOL(usb_serial_suspend);
|
||||
|
||||
int usb_serial_resume(struct usb_interface *intf)
|
||||
{
|
||||
struct usb_serial *serial = usb_get_intfdata(intf);
|
||||
|
||||
return serial->type->resume(serial);
|
||||
}
|
||||
EXPORT_SYMBOL(usb_serial_resume);
|
||||
|
||||
static const struct tty_operations serial_ops = {
|
||||
.open = serial_open,
|
||||
.close = serial_close,
|
||||
|
Reference in New Issue
Block a user