[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1268116151-1448-5-git-send-email-jason.wessel@windriver.com>
Date: Tue, 9 Mar 2010 00:29:09 -0600
From: Jason Wessel <jason.wessel@...driver.com>
To: gregkh@...e.de
Cc: linux-usb@...r.kernel.org, Alan Stern <stern@...land.harvard.edu>,
linux-kernel@...r.kernel.org,
Jason Wessel <jason.wessel@...driver.com>,
Alan Cox <alan@...ux.intel.com>,
Oliver Neukum <oliver@...kum.org>
Subject: [PATCH 4/6] usb-serial: optimize sysrq function calls
There is no need to have external function calls for the sysrq
functions. The compiler can inline the sysrq calls such that they are
entirely a NOP if CONFIG_MAGIC_SYSRQ is not set.
CC: Greg Kroah-Hartman <gregkh@...e.de>
CC: Alan Cox <alan@...ux.intel.com>
CC: Alan Stern <stern@...land.harvard.edu>
CC: Oliver Neukum <oliver@...kum.org>
CC: linux-usb@...r.kernel.org
Signed-off-by: Jason Wessel <jason.wessel@...driver.com>
---
drivers/usb/serial/generic.c | 26 --------------------------
include/linux/usb/serial.h | 34 +++++++++++++++++++++++++++++-----
2 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 4dea9d7..0cdfccb 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -553,32 +553,6 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty)
}
}
-int usb_serial_handle_sysrq_char(struct tty_struct *tty,
- struct usb_serial_port *port, unsigned int ch)
-{
- if (port->sysrq && port->port.console) {
- if (ch && time_before(jiffies, port->sysrq)) {
- handle_sysrq(ch, tty);
- port->sysrq = 0;
- return 1;
- }
- port->sysrq = 0;
- }
- return 0;
-}
-EXPORT_SYMBOL_GPL(usb_serial_handle_sysrq_char);
-
-int usb_serial_handle_break(struct usb_serial_port *port)
-{
- if (!port->sysrq) {
- port->sysrq = jiffies + HZ*5;
- return 1;
- }
- port->sysrq = 0;
- return 0;
-}
-EXPORT_SYMBOL_GPL(usb_serial_handle_break);
-
int usb_serial_generic_resume(struct usb_serial *serial)
{
struct usb_serial_port *port;
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index b7682fe..60f8422 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -318,11 +318,6 @@ extern int usb_serial_generic_register(int debug);
extern void usb_serial_generic_deregister(void);
extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port,
gfp_t mem_flags);
-extern int usb_serial_handle_sysrq_char(struct tty_struct *tty,
- struct usb_serial_port *port,
- unsigned int ch);
-extern int usb_serial_handle_break(struct usb_serial_port *port);
-
extern int usb_serial_bus_register(struct usb_serial_driver *device);
extern void usb_serial_bus_deregister(struct usb_serial_driver *device);
@@ -331,6 +326,35 @@ extern struct usb_serial_driver usb_serial_generic_device;
extern struct bus_type usb_serial_bus_type;
extern struct tty_driver *usb_serial_tty_driver;
+static inline int usb_serial_handle_sysrq_char(struct tty_struct *tty,
+ struct usb_serial_port *port,
+ unsigned int ch)
+{
+#ifdef CONFIG_MAGIC_SYSRQ
+ if (port->sysrq && port->port.console) {
+ if (ch && time_before(jiffies, port->sysrq)) {
+ handle_sysrq(ch, tty);
+ port->sysrq = 0;
+ return 1;
+ }
+ port->sysrq = 0;
+ }
+#endif /* CONFIG_MAGIC_SYSRQ */
+ return 0;
+}
+
+static inline int usb_serial_handle_break(struct usb_serial_port *port)
+{
+#ifdef CONFIG_MAGIC_SYSRQ
+ if (!port->sysrq) {
+ port->sysrq = jiffies + HZ*5;
+ return 1;
+ }
+ port->sysrq = 0;
+#endif /* CONFIG_MAGIC_SYSRQ */
+ return 0;
+}
+
static inline void usb_serial_debug_data(int debug,
struct device *dev,
const char *function, int size,
--
1.6.3.1.9.g95405b
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists