diff options
Diffstat (limited to 'drivers/usb/serial/pl2303.c')
-rw-r--r-- | drivers/usb/serial/pl2303.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 9ec1a49e2362..73d5f346d3e0 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -50,7 +50,7 @@ struct pl2303_buf { | |||
50 | char *buf_put; | 50 | char *buf_put; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | static struct usb_device_id id_table [] = { | 53 | static const struct usb_device_id id_table[] = { |
54 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) }, | 54 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) }, |
55 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) }, | 55 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) }, |
56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) }, | 56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) }, |
@@ -451,7 +451,6 @@ static void pl2303_send(struct usb_serial_port *port) | |||
451 | port->write_urb->transfer_buffer); | 451 | port->write_urb->transfer_buffer); |
452 | 452 | ||
453 | port->write_urb->transfer_buffer_length = count; | 453 | port->write_urb->transfer_buffer_length = count; |
454 | port->write_urb->dev = port->serial->dev; | ||
455 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 454 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
456 | if (result) { | 455 | if (result) { |
457 | dev_err(&port->dev, "%s - failed submitting write urb," | 456 | dev_err(&port->dev, "%s - failed submitting write urb," |
@@ -769,7 +768,6 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
769 | pl2303_set_termios(tty, port, &tmp_termios); | 768 | pl2303_set_termios(tty, port, &tmp_termios); |
770 | 769 | ||
771 | dbg("%s - submitting read urb", __func__); | 770 | dbg("%s - submitting read urb", __func__); |
772 | port->read_urb->dev = serial->dev; | ||
773 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | 771 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); |
774 | if (result) { | 772 | if (result) { |
775 | dev_err(&port->dev, "%s - failed submitting read urb," | 773 | dev_err(&port->dev, "%s - failed submitting read urb," |
@@ -779,7 +777,6 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
779 | } | 777 | } |
780 | 778 | ||
781 | dbg("%s - submitting interrupt urb", __func__); | 779 | dbg("%s - submitting interrupt urb", __func__); |
782 | port->interrupt_in_urb->dev = serial->dev; | ||
783 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); | 780 | result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); |
784 | if (result) { | 781 | if (result) { |
785 | dev_err(&port->dev, "%s - failed submitting interrupt urb," | 782 | dev_err(&port->dev, "%s - failed submitting interrupt urb," |
@@ -895,10 +892,23 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
895 | static int pl2303_ioctl(struct tty_struct *tty, struct file *file, | 892 | static int pl2303_ioctl(struct tty_struct *tty, struct file *file, |
896 | unsigned int cmd, unsigned long arg) | 893 | unsigned int cmd, unsigned long arg) |
897 | { | 894 | { |
895 | struct serial_struct ser; | ||
898 | struct usb_serial_port *port = tty->driver_data; | 896 | struct usb_serial_port *port = tty->driver_data; |
899 | dbg("%s (%d) cmd = 0x%04x", __func__, port->number, cmd); | 897 | dbg("%s (%d) cmd = 0x%04x", __func__, port->number, cmd); |
900 | 898 | ||
901 | switch (cmd) { | 899 | switch (cmd) { |
900 | case TIOCGSERIAL: | ||
901 | memset(&ser, 0, sizeof ser); | ||
902 | ser.type = PORT_16654; | ||
903 | ser.line = port->serial->minor; | ||
904 | ser.port = port->number; | ||
905 | ser.baud_base = 460800; | ||
906 | |||
907 | if (copy_to_user((void __user *)arg, &ser, sizeof ser)) | ||
908 | return -EFAULT; | ||
909 | |||
910 | return 0; | ||
911 | |||
902 | case TIOCMIWAIT: | 912 | case TIOCMIWAIT: |
903 | dbg("%s (%d) TIOCMIWAIT", __func__, port->number); | 913 | dbg("%s (%d) TIOCMIWAIT", __func__, port->number); |
904 | return wait_modem_info(port, arg); | 914 | return wait_modem_info(port, arg); |
@@ -1042,7 +1052,6 @@ static void pl2303_push_data(struct tty_struct *tty, | |||
1042 | tty_flag = TTY_FRAME; | 1052 | tty_flag = TTY_FRAME; |
1043 | dbg("%s - tty_flag = %d", __func__, tty_flag); | 1053 | dbg("%s - tty_flag = %d", __func__, tty_flag); |
1044 | 1054 | ||
1045 | tty_buffer_request_room(tty, urb->actual_length + 1); | ||
1046 | /* overrun is special, not associated with a char */ | 1055 | /* overrun is special, not associated with a char */ |
1047 | if (line_status & UART_OVERRUN_ERROR) | 1056 | if (line_status & UART_OVERRUN_ERROR) |
1048 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 1057 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
@@ -1072,16 +1081,11 @@ static void pl2303_read_bulk_callback(struct urb *urb) | |||
1072 | 1081 | ||
1073 | if (status) { | 1082 | if (status) { |
1074 | dbg("%s - urb status = %d", __func__, status); | 1083 | dbg("%s - urb status = %d", __func__, status); |
1075 | if (!port->port.count) { | ||
1076 | dbg("%s - port is closed, exiting.", __func__); | ||
1077 | return; | ||
1078 | } | ||
1079 | if (status == -EPROTO) { | 1084 | if (status == -EPROTO) { |
1080 | /* PL2303 mysteriously fails with -EPROTO reschedule | 1085 | /* PL2303 mysteriously fails with -EPROTO reschedule |
1081 | * the read */ | 1086 | * the read */ |
1082 | dbg("%s - caught -EPROTO, resubmitting the urb", | 1087 | dbg("%s - caught -EPROTO, resubmitting the urb", |
1083 | __func__); | 1088 | __func__); |
1084 | urb->dev = port->serial->dev; | ||
1085 | result = usb_submit_urb(urb, GFP_ATOMIC); | 1089 | result = usb_submit_urb(urb, GFP_ATOMIC); |
1086 | if (result) | 1090 | if (result) |
1087 | dev_err(&urb->dev->dev, "%s - failed" | 1091 | dev_err(&urb->dev->dev, "%s - failed" |
@@ -1108,15 +1112,10 @@ static void pl2303_read_bulk_callback(struct urb *urb) | |||
1108 | } | 1112 | } |
1109 | tty_kref_put(tty); | 1113 | tty_kref_put(tty); |
1110 | /* Schedule the next read _if_ we are still open */ | 1114 | /* Schedule the next read _if_ we are still open */ |
1111 | if (port->port.count) { | 1115 | result = usb_submit_urb(urb, GFP_ATOMIC); |
1112 | urb->dev = port->serial->dev; | 1116 | if (result && result != -EPERM) |
1113 | result = usb_submit_urb(urb, GFP_ATOMIC); | 1117 | dev_err(&urb->dev->dev, "%s - failed resubmitting" |
1114 | if (result) | 1118 | " read urb, error %d\n", __func__, result); |
1115 | dev_err(&urb->dev->dev, "%s - failed resubmitting" | ||
1116 | " read urb, error %d\n", __func__, result); | ||
1117 | } | ||
1118 | |||
1119 | return; | ||
1120 | } | 1119 | } |
1121 | 1120 | ||
1122 | static void pl2303_write_bulk_callback(struct urb *urb) | 1121 | static void pl2303_write_bulk_callback(struct urb *urb) |
@@ -1146,7 +1145,6 @@ static void pl2303_write_bulk_callback(struct urb *urb) | |||
1146 | dbg("%s - nonzero write bulk status received: %d", __func__, | 1145 | dbg("%s - nonzero write bulk status received: %d", __func__, |
1147 | status); | 1146 | status); |
1148 | port->write_urb->transfer_buffer_length = 1; | 1147 | port->write_urb->transfer_buffer_length = 1; |
1149 | port->write_urb->dev = port->serial->dev; | ||
1150 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 1148 | result = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
1151 | if (result) | 1149 | if (result) |
1152 | dev_err(&urb->dev->dev, "%s - failed resubmitting write" | 1150 | dev_err(&urb->dev->dev, "%s - failed resubmitting write" |