diff options
Diffstat (limited to 'drivers/usb/serial/sierra.c')
-rw-r--r-- | drivers/usb/serial/sierra.c | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 3eb6143bb646..34e6f894cba9 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -226,7 +226,7 @@ static const struct sierra_iface_info direct_ip_interface_blacklist = { | |||
226 | .ifaceinfo = direct_ip_non_serial_ifaces, | 226 | .ifaceinfo = direct_ip_non_serial_ifaces, |
227 | }; | 227 | }; |
228 | 228 | ||
229 | static struct usb_device_id id_table [] = { | 229 | static const struct usb_device_id id_table[] = { |
230 | { USB_DEVICE(0x0F3D, 0x0112) }, /* Airprime/Sierra PC 5220 */ | 230 | { USB_DEVICE(0x0F3D, 0x0112) }, /* Airprime/Sierra PC 5220 */ |
231 | { USB_DEVICE(0x03F0, 0x1B1D) }, /* HP ev2200 a.k.a MC5720 */ | 231 | { USB_DEVICE(0x03F0, 0x1B1D) }, /* HP ev2200 a.k.a MC5720 */ |
232 | { USB_DEVICE(0x03F0, 0x1E1D) }, /* HP hs2300 a.k.a MC8775 */ | 232 | { USB_DEVICE(0x03F0, 0x1E1D) }, /* HP hs2300 a.k.a MC8775 */ |
@@ -304,16 +304,6 @@ static struct usb_device_id id_table [] = { | |||
304 | }; | 304 | }; |
305 | MODULE_DEVICE_TABLE(usb, id_table); | 305 | MODULE_DEVICE_TABLE(usb, id_table); |
306 | 306 | ||
307 | static struct usb_driver sierra_driver = { | ||
308 | .name = "sierra", | ||
309 | .probe = usb_serial_probe, | ||
310 | .disconnect = usb_serial_disconnect, | ||
311 | .suspend = usb_serial_suspend, | ||
312 | .resume = usb_serial_resume, | ||
313 | .id_table = id_table, | ||
314 | .no_dynamic_id = 1, | ||
315 | .supports_autosuspend = 1, | ||
316 | }; | ||
317 | 307 | ||
318 | struct sierra_port_private { | 308 | struct sierra_port_private { |
319 | spinlock_t lock; /* lock the structure */ | 309 | spinlock_t lock; /* lock the structure */ |
@@ -477,7 +467,7 @@ static void sierra_outdat_callback(struct urb *urb) | |||
477 | static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port, | 467 | static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port, |
478 | const unsigned char *buf, int count) | 468 | const unsigned char *buf, int count) |
479 | { | 469 | { |
480 | struct sierra_port_private *portdata = usb_get_serial_port_data(port); | 470 | struct sierra_port_private *portdata; |
481 | struct sierra_intf_private *intfdata; | 471 | struct sierra_intf_private *intfdata; |
482 | struct usb_serial *serial = port->serial; | 472 | struct usb_serial *serial = port->serial; |
483 | unsigned long flags; | 473 | unsigned long flags; |
@@ -604,14 +594,15 @@ static void sierra_indat_callback(struct urb *urb) | |||
604 | } else { | 594 | } else { |
605 | if (urb->actual_length) { | 595 | if (urb->actual_length) { |
606 | tty = tty_port_tty_get(&port->port); | 596 | tty = tty_port_tty_get(&port->port); |
607 | 597 | if (tty) { | |
608 | tty_buffer_request_room(tty, urb->actual_length); | 598 | tty_insert_flip_string(tty, data, |
609 | tty_insert_flip_string(tty, data, urb->actual_length); | 599 | urb->actual_length); |
610 | tty_flip_buffer_push(tty); | 600 | tty_flip_buffer_push(tty); |
611 | 601 | ||
612 | tty_kref_put(tty); | 602 | tty_kref_put(tty); |
613 | usb_serial_debug_data(debug, &port->dev, __func__, | 603 | usb_serial_debug_data(debug, &port->dev, |
614 | urb->actual_length, data); | 604 | __func__, urb->actual_length, data); |
605 | } | ||
615 | } else { | 606 | } else { |
616 | dev_dbg(&port->dev, "%s: empty read urb" | 607 | dev_dbg(&port->dev, "%s: empty read urb" |
617 | " received\n", __func__); | 608 | " received\n", __func__); |
@@ -619,10 +610,10 @@ static void sierra_indat_callback(struct urb *urb) | |||
619 | } | 610 | } |
620 | 611 | ||
621 | /* Resubmit urb so we continue receiving */ | 612 | /* Resubmit urb so we continue receiving */ |
622 | if (port->port.count && status != -ESHUTDOWN && status != -EPERM) { | 613 | if (status != -ESHUTDOWN && status != -EPERM) { |
623 | usb_mark_last_busy(port->serial->dev); | 614 | usb_mark_last_busy(port->serial->dev); |
624 | err = usb_submit_urb(urb, GFP_ATOMIC); | 615 | err = usb_submit_urb(urb, GFP_ATOMIC); |
625 | if (err) | 616 | if (err && err != -EPERM) |
626 | dev_err(&port->dev, "resubmit read urb failed." | 617 | dev_err(&port->dev, "resubmit read urb failed." |
627 | "(%d)\n", err); | 618 | "(%d)\n", err); |
628 | } | 619 | } |
@@ -681,11 +672,11 @@ static void sierra_instat_callback(struct urb *urb) | |||
681 | dev_dbg(&port->dev, "%s: error %d\n", __func__, status); | 672 | dev_dbg(&port->dev, "%s: error %d\n", __func__, status); |
682 | 673 | ||
683 | /* Resubmit urb so we continue receiving IRQ data */ | 674 | /* Resubmit urb so we continue receiving IRQ data */ |
684 | if (port->port.count && status != -ESHUTDOWN && status != -ENOENT) { | 675 | if (status != -ESHUTDOWN && status != -ENOENT) { |
685 | usb_mark_last_busy(serial->dev); | 676 | usb_mark_last_busy(serial->dev); |
686 | urb->dev = serial->dev; | 677 | urb->dev = serial->dev; |
687 | err = usb_submit_urb(urb, GFP_ATOMIC); | 678 | err = usb_submit_urb(urb, GFP_ATOMIC); |
688 | if (err) | 679 | if (err && err != -EPERM) |
689 | dev_err(&port->dev, "%s: resubmit intr urb " | 680 | dev_err(&port->dev, "%s: resubmit intr urb " |
690 | "failed. (%d)\n", __func__, err); | 681 | "failed. (%d)\n", __func__, err); |
691 | } | 682 | } |
@@ -1061,11 +1052,31 @@ static int sierra_resume(struct usb_serial *serial) | |||
1061 | 1052 | ||
1062 | return ec ? -EIO : 0; | 1053 | return ec ? -EIO : 0; |
1063 | } | 1054 | } |
1055 | |||
1056 | static int sierra_reset_resume(struct usb_interface *intf) | ||
1057 | { | ||
1058 | struct usb_serial *serial = usb_get_intfdata(intf); | ||
1059 | dev_err(&serial->dev->dev, "%s\n", __func__); | ||
1060 | return usb_serial_resume(intf); | ||
1061 | } | ||
1064 | #else | 1062 | #else |
1065 | #define sierra_suspend NULL | 1063 | #define sierra_suspend NULL |
1066 | #define sierra_resume NULL | 1064 | #define sierra_resume NULL |
1065 | #define sierra_reset_resume NULL | ||
1067 | #endif | 1066 | #endif |
1068 | 1067 | ||
1068 | static struct usb_driver sierra_driver = { | ||
1069 | .name = "sierra", | ||
1070 | .probe = usb_serial_probe, | ||
1071 | .disconnect = usb_serial_disconnect, | ||
1072 | .suspend = usb_serial_suspend, | ||
1073 | .resume = usb_serial_resume, | ||
1074 | .reset_resume = sierra_reset_resume, | ||
1075 | .id_table = id_table, | ||
1076 | .no_dynamic_id = 1, | ||
1077 | .supports_autosuspend = 1, | ||
1078 | }; | ||
1079 | |||
1069 | static struct usb_serial_driver sierra_device = { | 1080 | static struct usb_serial_driver sierra_device = { |
1070 | .driver = { | 1081 | .driver = { |
1071 | .owner = THIS_MODULE, | 1082 | .owner = THIS_MODULE, |