USB: serial: only set sysrq timestamp for consoles
Only set the sysrq timestamp for console ports to avoid having every driver also check the console flag when processing incoming data. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
This commit is contained in:
@@ -355,13 +355,13 @@ void usb_serial_generic_process_read_urb(struct urb *urb)
|
||||
* stuff like 3G modems, so shortcircuit it in the 99.9999999% of
|
||||
* cases where the USB serial is not a console anyway.
|
||||
*/
|
||||
if (!port->port.console || !port->sysrq) {
|
||||
tty_insert_flip_string(&port->port, ch, urb->actual_length);
|
||||
} else {
|
||||
if (port->sysrq) {
|
||||
for (i = 0; i < urb->actual_length; i++, ch++) {
|
||||
if (!usb_serial_handle_sysrq_char(port, *ch))
|
||||
tty_insert_flip_char(&port->port, *ch, TTY_NORMAL);
|
||||
}
|
||||
} else {
|
||||
tty_insert_flip_string(&port->port, ch, urb->actual_length);
|
||||
}
|
||||
tty_flip_buffer_push(&port->port);
|
||||
}
|
||||
@@ -574,7 +574,7 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_get_icount);
|
||||
#ifdef CONFIG_MAGIC_SYSRQ
|
||||
int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch)
|
||||
{
|
||||
if (port->sysrq && port->port.console) {
|
||||
if (port->sysrq) {
|
||||
if (ch && time_before(jiffies, port->sysrq)) {
|
||||
handle_sysrq(ch);
|
||||
port->sysrq = 0;
|
||||
@@ -594,6 +594,9 @@ EXPORT_SYMBOL_GPL(usb_serial_handle_sysrq_char);
|
||||
|
||||
int usb_serial_handle_break(struct usb_serial_port *port)
|
||||
{
|
||||
if (!port->port.console)
|
||||
return 0;
|
||||
|
||||
if (!port->sysrq) {
|
||||
port->sysrq = jiffies + HZ*5;
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user