USB: serial: add sysrq break-handler dummy
authorJohan Hovold <johan@kernel.org>
Wed, 8 Jul 2020 12:49:57 +0000 (14:49 +0200)
committerJohan Hovold <johan@kernel.org>
Thu, 9 Jul 2020 07:20:10 +0000 (09:20 +0200)
Add inline sysrq break-handler dummy to allow the compiler to eliminate
further code when either console or sysrq support isn't enabled and to
clearly mark the two sysrq functions as belonging together.

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

index a9b6d103aaf6fd4872d1ead60e7e354290c5a145..e60f74f11acce76ec065f9ec8eb2cefb3f7f9c3a 100644 (file)
@@ -585,11 +585,10 @@ int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch)
        return 0;
 }
 EXPORT_SYMBOL_GPL(usb_serial_handle_sysrq_char);
-#endif
 
 int usb_serial_handle_break(struct usb_serial_port *port)
 {
-       if (!port->port.console || !IS_ENABLED(CONFIG_MAGIC_SYSRQ))
+       if (!port->port.console)
                return 0;
 
        if (!port->sysrq) {
@@ -600,6 +599,7 @@ int usb_serial_handle_break(struct usb_serial_port *port)
        return 0;
 }
 EXPORT_SYMBOL_GPL(usb_serial_handle_break);
+#endif
 
 /**
  * usb_serial_handle_dcd_change - handle a change of carrier detect state
index be73646706a9b70bc24f7c5b8b9b6e06494681d0..c4ed4404335e4366d6bebce45b8261886094b5a1 100644 (file)
@@ -369,14 +369,18 @@ extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
 #if defined(CONFIG_USB_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
 extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port,
                                        unsigned int ch);
+extern int usb_serial_handle_break(struct usb_serial_port *port);
 #else
 static inline int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch)
 {
        return 0;
 }
+static inline int usb_serial_handle_break(struct usb_serial_port *port)
+{
+       return 0;
+}
 #endif
 
-extern int usb_serial_handle_break(struct usb_serial_port *port);
 extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,
                                         struct tty_struct *tty,
                                         unsigned int status);