From: Johan Hovold <johan@kernel.org>
To: linux-usb@vger.kernel.org
Cc: Johan Hovold <johan@kernel.org>
Subject: [PATCH 07/10] USB: serial: add sysrq break-handler dummy
Date: Wed, 8 Jul 2020 14:49:57 +0200 [thread overview]
Message-ID: <20200708125000.15659-8-johan@kernel.org> (raw)
In-Reply-To: <20200708125000.15659-1-johan@kernel.org>
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.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/generic.c | 4 ++--
include/linux/usb/serial.h | 6 +++++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index a9b6d103aaf6..e60f74f11acc 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -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
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index be73646706a9..c4ed4404335e 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -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);
--
2.26.2
next prev parent reply other threads:[~2020-07-08 12:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-08 12:49 [PATCH 00/10] USB: serial: break and sysrq fixes and cleanups Johan Hovold
2020-07-08 12:49 ` [PATCH 01/10] USB: serial: ftdi_sio: make process-packet buffer unsigned Johan Hovold
2020-07-08 12:49 ` [PATCH 02/10] USB: serial: ftdi_sio: clean up receive processing Johan Hovold
2020-07-08 12:49 ` [PATCH 03/10] USB: serial: ftdi_sio: fix break and sysrq handling Johan Hovold
2020-07-08 12:49 ` [PATCH 04/10] USB: serial: only set sysrq timestamp for consoles Johan Hovold
2020-07-08 12:49 ` [PATCH 05/10] USB: serial: only process sysrq when enabled Johan Hovold
2020-07-08 12:49 ` [PATCH 06/10] USB: serial: inline sysrq dummy function Johan Hovold
2020-07-08 12:49 ` Johan Hovold [this message]
2020-07-08 12:49 ` [PATCH 08/10] USB: serial: drop unnecessary sysrq include Johan Hovold
2020-07-08 12:49 ` [PATCH 09/10] USB: serial: drop extern keyword from function declarations Johan Hovold
2020-07-08 12:50 ` [PATCH 10/10] USB: serial: drop redundant transfer-buffer casts Johan Hovold
2020-07-08 15:45 ` [PATCH 00/10] USB: serial: break and sysrq fixes and cleanups Greg KH
2020-07-09 7:23 ` Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200708125000.15659-8-johan@kernel.org \
--to=johan@kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.