linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: linux-usb@vger.kernel.org
Cc: Johan Hovold <johan@kernel.org>
Subject: [PATCH 06/10] USB: serial: inline sysrq dummy function
Date: Wed,  8 Jul 2020 14:49:56 +0200	[thread overview]
Message-ID: <20200708125000.15659-7-johan@kernel.org> (raw)
In-Reply-To: <20200708125000.15659-1-johan@kernel.org>

Inline the dummy sysrq character handling when either console support or
magic-sysrq support isn't enabled to allow the compiler to eliminate
unused code.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/generic.c | 9 ++-------
 include/linux/usb/serial.h   | 9 +++++++++
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index c5b35252c931..a9b6d103aaf6 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -571,7 +571,7 @@ int usb_serial_generic_get_icount(struct tty_struct *tty,
 }
 EXPORT_SYMBOL_GPL(usb_serial_generic_get_icount);
 
-#ifdef CONFIG_MAGIC_SYSRQ
+#if defined(CONFIG_USB_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
 int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch)
 {
 	if (port->sysrq) {
@@ -584,13 +584,8 @@ int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch)
 	}
 	return 0;
 }
-#else
-int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch)
-{
-	return 0;
-}
-#endif
 EXPORT_SYMBOL_GPL(usb_serial_handle_sysrq_char);
+#endif
 
 int usb_serial_handle_break(struct usb_serial_port *port)
 {
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 14cac4a1ae8f..be73646706a9 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -365,8 +365,17 @@ extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port,
 extern void usb_serial_generic_process_read_urb(struct urb *urb);
 extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
 						void *dest, size_t size);
+
+#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);
+#else
+static inline int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch)
+{
+	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,
-- 
2.26.2


  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 ` Johan Hovold [this message]
2020-07-08 12:49 ` [PATCH 07/10] USB: serial: add sysrq break-handler dummy Johan Hovold
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-7-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).