| From 790111bbb9291b79c960d33b406ccc7ab9833a76 Mon Sep 17 00:00:00 2001 |
| From: Paul Gortmaker <paul.gortmaker@windriver.com> |
| Date: Thu, 8 Mar 2012 19:12:12 -0500 |
| Subject: serial: introduce generic port in/out helpers |
| |
| 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 <paul.gortmaker@windriver.com> |
| Acked-by: Alan Cox <alan@linux.intel.com> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| (cherry picked from commit 927353a75602dd97144352f53177e18093fdd198) |
| |
| Signed-off-by: Simon Horman <horms@verge.net.au> |
| --- |
| include/linux/serial_core.h | 10 ++++++++++ |
| 1 file changed, 10 insertions(+) |
| |
| diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h |
| index b6fa317..1cb6309 100644 |
| --- a/include/linux/serial_core.h |
| +++ b/include/linux/serial_core.h |
| @@ -376,6 +376,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.10.1.362.g242cab3 |
| |