aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/serial/generic.c18
-rw-r--r--drivers/usb/serial/usb-serial.c31
2 files changed, 49 insertions, 0 deletions
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 4f8282ad7720..b90ef3f70f4c 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -69,6 +69,7 @@ struct usb_serial_driver usb_serial_generic_device = {
69 .shutdown = usb_serial_generic_shutdown, 69 .shutdown = usb_serial_generic_shutdown,
70 .throttle = usb_serial_generic_throttle, 70 .throttle = usb_serial_generic_throttle,
71 .unthrottle = usb_serial_generic_unthrottle, 71 .unthrottle = usb_serial_generic_unthrottle,
72 .resume = usb_serial_generic_resume,
72}; 73};
73 74
74static int generic_probe(struct usb_interface *interface, 75static int generic_probe(struct usb_interface *interface,
@@ -169,6 +170,23 @@ static void generic_cleanup (struct usb_serial_port *port)
169 } 170 }
170} 171}
171 172
173int usb_serial_generic_resume(struct usb_serial *serial)
174{
175 struct usb_serial_port *port;
176 int i, c = 0, r;
177
178 for (i = 0; i < serial->num_ports; i++) {
179 port = serial->port[i];
180 if (port->open_count && port->read_urb) {
181 r = usb_submit_urb(port->read_urb, GFP_NOIO);
182 if (r < 0)
183 c++;
184 }
185 }
186
187 return c ? -EIO : 0;
188}
189
172void usb_serial_generic_close (struct usb_serial_port *port, struct file * filp) 190void usb_serial_generic_close (struct usb_serial_port *port, struct file * filp)
173{ 191{
174 dbg("%s - port %d", __FUNCTION__, port->number); 192 dbg("%s - port %d", __FUNCTION__, port->number);
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
1074int 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}
1093EXPORT_SYMBOL(usb_serial_suspend);
1094
1095int 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}
1101EXPORT_SYMBOL(usb_serial_resume);
1102
1072static const struct tty_operations serial_ops = { 1103static const struct tty_operations serial_ops = {
1073 .open = serial_open, 1104 .open = serial_open,
1074 .close = serial_close, 1105 .close = serial_close,