USB: serial: only process sysrq when enabled
authorJohan Hovold <johan@kernel.org>
Wed, 8 Jul 2020 12:49:55 +0000 (14:49 +0200)
committerJohan Hovold <johan@kernel.org>
Thu, 9 Jul 2020 07:20:04 +0000 (09:20 +0200)
Do not set the sysrq timestamp unless CONFIG_MAGIC_SYSRQ is enabled to
avoid unnecessary per-character processing for consoles.

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/generic.c

index 05a2a3aa39636655ee749993ce1de02ba330626f..c5b35252c931a98484d9585d4cfaaea60b424fc7 100644 (file)
@@ -594,7 +594,7 @@ EXPORT_SYMBOL_GPL(usb_serial_handle_sysrq_char);
 
 int usb_serial_handle_break(struct usb_serial_port *port)
 {
-       if (!port->port.console)
+       if (!port->port.console || !IS_ENABLED(CONFIG_MAGIC_SYSRQ))
                return 0;
 
        if (!port->sysrq) {