diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2014-07-14 14:26:14 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-17 18:16:23 -0700 |
commit | b1261c86fe238cc0da3f5dc837a38a0c39f3e7c4 (patch) | |
tree | 4a62c30754e5aca7cf5c665efeabf545b69d52da /drivers/tty/serial/8250/8250_dw.c | |
parent | 380c966c093e7239e42a81f165b20b2bad2658bc (diff) | |
download | op-kernel-dev-b1261c86fe238cc0da3f5dc837a38a0c39f3e7c4.zip op-kernel-dev-b1261c86fe238cc0da3f5dc837a38a0c39f3e7c4.tar.gz |
serial: 8250: introduce up_to_u8250p() helper
It helps to cast struct uart_port to struct uart_8250_port at runtime.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/8250/8250_dw.c')
-rw-r--r-- | drivers/tty/serial/8250/8250_dw.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index c531fa4..affdcb1 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -84,8 +84,9 @@ static inline int dw8250_modify_msr(struct uart_port *p, int offset, int value) static void dw8250_force_idle(struct uart_port *p) { - serial8250_clear_and_reinit_fifos(container_of - (p, struct uart_8250_port, port)); + struct uart_8250_port *up = up_to_u8250p(p); + + serial8250_clear_and_reinit_fifos(up); (void)p->serial_in(p, UART_RX); } @@ -255,6 +256,7 @@ static int dw8250_probe_of(struct uart_port *p, struct dw8250_data *data) { struct device_node *np = p->dev->of_node; + struct uart_8250_port *up = up_to_u8250p(p); u32 val; bool has_ucv = true; @@ -287,7 +289,7 @@ static int dw8250_probe_of(struct uart_port *p, } } if (has_ucv) - dw8250_setup_port(container_of(p, struct uart_8250_port, port)); + dw8250_setup_port(up); if (!of_property_read_u32(np, "reg-shift", &val)) p->regshift = val; |