From ec22559e0b7a05283a3413bda5d177e42c950e23 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Fri, 27 Apr 2007 20:54:57 +0200 Subject: USB: suspend support for usb serial this implements generic support for suspend/resume for usb serial. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/usb-serial.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'drivers/usb/serial/usb-serial.c') diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 87f378806db..e3e3728e16e 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -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, -- cgit v1.2.3-18-g5258