diff options
author | Oliver Neukum <oneukum@suse.de> | 2007-04-27 14:54:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 19:29:44 -0400 |
commit | ec22559e0b7a05283a3413bda5d177e42c950e23 (patch) | |
tree | 5f7a9ae8907cdf910532381111ce4b8aae877e05 /drivers/usb/serial/usb-serial.c | |
parent | dd172d72addefd89795e819cc2cc3eb1b9d12a7f (diff) |
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>
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 87f378806db6..e3e3728e16e3 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 = { | |||
46 | .name = "usbserial", | 46 | .name = "usbserial", |
47 | .probe = usb_serial_probe, | 47 | .probe = usb_serial_probe, |
48 | .disconnect = usb_serial_disconnect, | 48 | .disconnect = usb_serial_disconnect, |
49 | .suspend = usb_serial_suspend, | ||
50 | .resume = usb_serial_resume, | ||
49 | .no_dynamic_id = 1, | 51 | .no_dynamic_id = 1, |
50 | }; | 52 | }; |
51 | 53 | ||
@@ -1069,6 +1071,35 @@ void usb_serial_disconnect(struct usb_interface *interface) | |||
1069 | dev_info(dev, "device disconnected\n"); | 1071 | dev_info(dev, "device disconnected\n"); |
1070 | } | 1072 | } |
1071 | 1073 | ||
1074 | int usb_serial_suspend(struct usb_interface *intf, pm_message_t message) | ||
1075 | { | ||
1076 | struct usb_serial *serial = usb_get_intfdata(intf); | ||
1077 | struct usb_serial_port *port; | ||
1078 | int i, r = 0; | ||
1079 | |||
1080 | if (serial) { | ||
1081 | for (i = 0; i < serial->num_ports; ++i) { | ||
1082 | port = serial->port[i]; | ||
1083 | if (port) | ||
1084 | kill_traffic(port); | ||
1085 | } | ||
1086 | } | ||
1087 | |||
1088 | if (serial->type->suspend) | ||
1089 | serial->type->suspend(serial, message); | ||
1090 | |||
1091 | return r; | ||
1092 | } | ||
1093 | EXPORT_SYMBOL(usb_serial_suspend); | ||
1094 | |||
1095 | int usb_serial_resume(struct usb_interface *intf) | ||
1096 | { | ||
1097 | struct usb_serial *serial = usb_get_intfdata(intf); | ||
1098 | |||
1099 | return serial->type->resume(serial); | ||
1100 | } | ||
1101 | EXPORT_SYMBOL(usb_serial_resume); | ||
1102 | |||
1072 | static const struct tty_operations serial_ops = { | 1103 | static const struct tty_operations serial_ops = { |
1073 | .open = serial_open, | 1104 | .open = serial_open, |
1074 | .close = serial_close, | 1105 | .close = serial_close, |