History

USB: serial: add sysrq break-handler dummy

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.

Johan Hovold committed 6 years ago

Commit 4b5cf2b1 parent 4fbfbdb2 files · +7 −3Browse files

Unified · Split

2 files
  1. drivers/usb/serial/generic.c +2 −2
  2. include/linux/usb/serial.h +5 −1
drivers/usb/serial/generic.c+2−2
@@ -585,11 +585,10 @@ int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) · 584 unmodified lines
585 return 0;585 return 0;
586}586}
587EXPORT_SYMBOL_GPL(usb_serial_handle_sysrq_char);587EXPORT_SYMBOL_GPL(usb_serial_handle_sysrq_char);
588#endif
589 588
590int usb_serial_handle_break(struct usb_serial_port *port)589int usb_serial_handle_break(struct usb_serial_port *port)
591{590{
592 if (!port->port.console || !IS_ENABLED(CONFIG_MAGIC_SYSRQ))591 if (!port->port.console)
593 return 0;592 return 0;
594 593
595 if (!port->sysrq) {594 if (!port->sysrq) {
@@ -600,6 +599,7 @@ int usb_serial_handle_break(struct usb_serial_port *port) · 4 unmodified lines
600 return 0;599 return 0;
601}600}
602EXPORT_SYMBOL_GPL(usb_serial_handle_break);601EXPORT_SYMBOL_GPL(usb_serial_handle_break);
602#endif
603 603
604/**604/**
605 * usb_serial_handle_dcd_change - handle a change of carrier detect state605 * usb_serial_handle_dcd_change - handle a change of carrier detect state
include/linux/usb/serial.h+5−1
@@ -369,14 +369,18 @@ extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, · 368 unmodified lines
369#if defined(CONFIG_USB_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)369#if defined(CONFIG_USB_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
370extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port,370extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port,
371 unsigned int ch);371 unsigned int ch);
372extern int usb_serial_handle_break(struct usb_serial_port *port);
372#else373#else
373static inline int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch)374static inline int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch)
374{375{
375 return 0;376 return 0;
376}377}
378static inline int usb_serial_handle_break(struct usb_serial_port *port)
379{
380 return 0;
381}
377#endif382#endif
378 383
379extern int usb_serial_handle_break(struct usb_serial_port *port);
380extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,384extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,
381 struct tty_struct *tty,385 struct tty_struct *tty,
382 unsigned int status);386 unsigned int status);