Thread (9 messages) 9 messages, 2 authors, 2012-03-09
STALE5205d
Revisions (2)
  1. rfc [diff vs current]
  2. v2 current

[PATCH 5/7] serial: introduce generic port in/out helpers

From: Paul Gortmaker <hidden>
Date: 2012-03-09 00:12:29
Subsystem: the rest, tty layer and serial drivers · Maintainers: Linus Torvalds, Greg Kroah-Hartman, Jiri Slaby

Looking at the existing serial drivers (esp. the 8250 derived
variants) we see a common trend.  They create a hardware specific
port struct, which in turn contains a generic serial_port struct.

The other trend, is that they all create some sort of shortcut
to go through the hardware specific struct, to the serial_port
struct, which has the basic in/out operations within.  Looking
for the serial_in and serial_out in several drivers shows this.

Rather than let this continue, lets create a generic set of
similar helper wrappers that can be used on a struct port, so
we can eliminate bouncing out through hardware specific struct
pointers just to come back into struct port where possible.

Signed-off-by: Paul Gortmaker <redacted>
---
 include/linux/serial_core.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 585bfd0..f51bf2e 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -383,6 +383,16 @@ struct uart_port {
 	void			*private_data;		/* generic platform data pointer */
 };
 
+static inline int serial_port_in(struct uart_port *up, int offset)
+{
+	return up->serial_in(up, offset);
+}
+
+static inline void serial_port_out(struct uart_port *up, int offset, int value)
+{
+	up->serial_out(up, offset, value);
+}
+
 /*
  * This is the state information which is persistent across opens.
  */
-- 
1.7.9.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help