Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tty: Fix the PL2303 private methods for sysrq

PL2303 has private data shovelling methods that also have no fast path. Fix
them to work the same way as the default handler.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Alan Cox and committed by
Linus Torvalds
d4fc4a7b 24a15a62

+33 -25
+33 -25
drivers/usb/serial/pl2303.c
··· 971 971 __func__, retval); 972 972 } 973 973 974 + static void pl2303_push_data(struct tty_struct *tty, 975 + struct usb_serial_port *port, struct urb *urb, 976 + u8 line_status) 977 + { 978 + unsigned char *data = urb->transfer_buffer; 979 + /* get tty_flag from status */ 980 + char tty_flag = TTY_NORMAL; 981 + /* break takes precedence over parity, */ 982 + /* which takes precedence over framing errors */ 983 + if (line_status & UART_BREAK_ERROR) 984 + tty_flag = TTY_BREAK; 985 + else if (line_status & UART_PARITY_ERROR) 986 + tty_flag = TTY_PARITY; 987 + else if (line_status & UART_FRAME_ERROR) 988 + tty_flag = TTY_FRAME; 989 + dbg("%s - tty_flag = %d", __func__, tty_flag); 990 + 991 + tty_buffer_request_room(tty, urb->actual_length + 1); 992 + /* overrun is special, not associated with a char */ 993 + if (line_status & UART_OVERRUN_ERROR) 994 + tty_insert_flip_char(tty, 0, TTY_OVERRUN); 995 + if (port->console && port->sysrq) { 996 + int i; 997 + for (i = 0; i < urb->actual_length; ++i) 998 + if (!usb_serial_handle_sysrq_char(tty, port, data[i])) 999 + tty_insert_flip_char(tty, data[i], tty_flag); 1000 + } else 1001 + tty_insert_flip_string(tty, data, urb->actual_length); 1002 + tty_flip_buffer_push(tty); 1003 + } 1004 + 974 1005 static void pl2303_read_bulk_callback(struct urb *urb) 975 1006 { 976 1007 struct usb_serial_port *port = urb->context; 977 1008 struct pl2303_private *priv = usb_get_serial_port_data(port); 978 1009 struct tty_struct *tty; 979 - unsigned char *data = urb->transfer_buffer; 980 1010 unsigned long flags; 981 - int i; 982 1011 int result; 983 1012 int status = urb->status; 984 1013 u8 line_status; 985 - char tty_flag; 986 1014 987 1015 dbg("%s - port %d", __func__, port->number); 988 1016 ··· 1038 1010 } 1039 1011 1040 1012 usb_serial_debug_data(debug, &port->dev, __func__, 1041 - urb->actual_length, data); 1042 - 1043 - /* get tty_flag from status */ 1044 - tty_flag = TTY_NORMAL; 1013 + urb->actual_length, urb->transfer_buffer); 1045 1014 1046 1015 spin_lock_irqsave(&priv->lock, flags); 1047 1016 line_status = priv->line_status; ··· 1046 1021 spin_unlock_irqrestore(&priv->lock, flags); 1047 1022 wake_up_interruptible(&priv->delta_msr_wait); 1048 1023 1049 - /* break takes precedence over parity, */ 1050 - /* which takes precedence over framing errors */ 1051 - if (line_status & UART_BREAK_ERROR) 1052 - tty_flag = TTY_BREAK; 1053 - else if (line_status & UART_PARITY_ERROR) 1054 - tty_flag = TTY_PARITY; 1055 - else if (line_status & UART_FRAME_ERROR) 1056 - tty_flag = TTY_FRAME; 1057 - dbg("%s - tty_flag = %d", __func__, tty_flag); 1058 - 1059 1024 tty = tty_port_tty_get(&port->port); 1060 1025 if (tty && urb->actual_length) { 1061 - tty_buffer_request_room(tty, urb->actual_length + 1); 1062 - /* overrun is special, not associated with a char */ 1063 - if (line_status & UART_OVERRUN_ERROR) 1064 - tty_insert_flip_char(tty, 0, TTY_OVERRUN); 1065 - for (i = 0; i < urb->actual_length; ++i) 1066 - if (!usb_serial_handle_sysrq_char(tty, port, data[i])) 1067 - tty_insert_flip_char(tty, data[i], tty_flag); 1068 - tty_flip_buffer_push(tty); 1026 + pl2303_push_data(tty, port, urb, line_status); 1069 1027 } 1070 1028 tty_kref_put(tty); 1071 1029 /* Schedule the next read _if_ we are still open */