Skip to content

Commit

Permalink
serial: introduce generic port in/out helpers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Gortmaker authored and Greg Kroah-Hartman committed Mar 9, 2012
1 parent dfe4244 commit 927353a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/linux/serial_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down

0 comments on commit 927353a

Please sign in to comment.