Commit afc5438b authored by Fabian Frederick's avatar Fabian Frederick Committed by Greg Kroah-Hartman

serial: pnx8xxx: use container_of to resolve pnx8xxx_port from uart_port

Use container_of instead of casting first structure member.
Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b70e5e9d
...@@ -126,7 +126,8 @@ static void pnx8xxx_timeout(unsigned long data) ...@@ -126,7 +126,8 @@ static void pnx8xxx_timeout(unsigned long data)
*/ */
static void pnx8xxx_stop_tx(struct uart_port *port) static void pnx8xxx_stop_tx(struct uart_port *port)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
u32 ien; u32 ien;
/* Disable TX intr */ /* Disable TX intr */
...@@ -142,7 +143,8 @@ static void pnx8xxx_stop_tx(struct uart_port *port) ...@@ -142,7 +143,8 @@ static void pnx8xxx_stop_tx(struct uart_port *port)
*/ */
static void pnx8xxx_start_tx(struct uart_port *port) static void pnx8xxx_start_tx(struct uart_port *port)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
u32 ien; u32 ien;
/* Clear all pending TX intr */ /* Clear all pending TX intr */
...@@ -158,7 +160,8 @@ static void pnx8xxx_start_tx(struct uart_port *port) ...@@ -158,7 +160,8 @@ static void pnx8xxx_start_tx(struct uart_port *port)
*/ */
static void pnx8xxx_stop_rx(struct uart_port *port) static void pnx8xxx_stop_rx(struct uart_port *port)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
u32 ien; u32 ien;
/* Disable RX intr */ /* Disable RX intr */
...@@ -174,7 +177,8 @@ static void pnx8xxx_stop_rx(struct uart_port *port) ...@@ -174,7 +177,8 @@ static void pnx8xxx_stop_rx(struct uart_port *port)
*/ */
static void pnx8xxx_enable_ms(struct uart_port *port) static void pnx8xxx_enable_ms(struct uart_port *port)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
mod_timer(&sport->timer, jiffies); mod_timer(&sport->timer, jiffies);
} }
...@@ -313,14 +317,16 @@ static irqreturn_t pnx8xxx_int(int irq, void *dev_id) ...@@ -313,14 +317,16 @@ static irqreturn_t pnx8xxx_int(int irq, void *dev_id)
*/ */
static unsigned int pnx8xxx_tx_empty(struct uart_port *port) static unsigned int pnx8xxx_tx_empty(struct uart_port *port)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
return serial_in(sport, PNX8XXX_FIFO) & PNX8XXX_UART_FIFO_TXFIFO_STA ? 0 : TIOCSER_TEMT; return serial_in(sport, PNX8XXX_FIFO) & PNX8XXX_UART_FIFO_TXFIFO_STA ? 0 : TIOCSER_TEMT;
} }
static unsigned int pnx8xxx_get_mctrl(struct uart_port *port) static unsigned int pnx8xxx_get_mctrl(struct uart_port *port)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
unsigned int mctrl = TIOCM_DSR; unsigned int mctrl = TIOCM_DSR;
unsigned int msr; unsigned int msr;
...@@ -347,7 +353,8 @@ static void pnx8xxx_set_mctrl(struct uart_port *port, unsigned int mctrl) ...@@ -347,7 +353,8 @@ static void pnx8xxx_set_mctrl(struct uart_port *port, unsigned int mctrl)
*/ */
static void pnx8xxx_break_ctl(struct uart_port *port, int break_state) static void pnx8xxx_break_ctl(struct uart_port *port, int break_state)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
unsigned long flags; unsigned long flags;
unsigned int lcr; unsigned int lcr;
...@@ -363,7 +370,8 @@ static void pnx8xxx_break_ctl(struct uart_port *port, int break_state) ...@@ -363,7 +370,8 @@ static void pnx8xxx_break_ctl(struct uart_port *port, int break_state)
static int pnx8xxx_startup(struct uart_port *port) static int pnx8xxx_startup(struct uart_port *port)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
int retval; int retval;
/* /*
...@@ -397,7 +405,8 @@ static int pnx8xxx_startup(struct uart_port *port) ...@@ -397,7 +405,8 @@ static int pnx8xxx_startup(struct uart_port *port)
static void pnx8xxx_shutdown(struct uart_port *port) static void pnx8xxx_shutdown(struct uart_port *port)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
int lcr; int lcr;
/* /*
...@@ -434,7 +443,8 @@ static void ...@@ -434,7 +443,8 @@ static void
pnx8xxx_set_termios(struct uart_port *port, struct ktermios *termios, pnx8xxx_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old) struct ktermios *old)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
unsigned long flags; unsigned long flags;
unsigned int lcr_fcr, old_ien, baud, quot; unsigned int lcr_fcr, old_ien, baud, quot;
unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8; unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8;
...@@ -551,7 +561,8 @@ pnx8xxx_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -551,7 +561,8 @@ pnx8xxx_set_termios(struct uart_port *port, struct ktermios *termios,
static const char *pnx8xxx_type(struct uart_port *port) static const char *pnx8xxx_type(struct uart_port *port)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
return sport->port.type == PORT_PNX8XXX ? "PNX8XXX" : NULL; return sport->port.type == PORT_PNX8XXX ? "PNX8XXX" : NULL;
} }
...@@ -561,7 +572,8 @@ static const char *pnx8xxx_type(struct uart_port *port) ...@@ -561,7 +572,8 @@ static const char *pnx8xxx_type(struct uart_port *port)
*/ */
static void pnx8xxx_release_port(struct uart_port *port) static void pnx8xxx_release_port(struct uart_port *port)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
release_mem_region(sport->port.mapbase, UART_PORT_SIZE); release_mem_region(sport->port.mapbase, UART_PORT_SIZE);
} }
...@@ -571,7 +583,8 @@ static void pnx8xxx_release_port(struct uart_port *port) ...@@ -571,7 +583,8 @@ static void pnx8xxx_release_port(struct uart_port *port)
*/ */
static int pnx8xxx_request_port(struct uart_port *port) static int pnx8xxx_request_port(struct uart_port *port)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
return request_mem_region(sport->port.mapbase, UART_PORT_SIZE, return request_mem_region(sport->port.mapbase, UART_PORT_SIZE,
"pnx8xxx-uart") != NULL ? 0 : -EBUSY; "pnx8xxx-uart") != NULL ? 0 : -EBUSY;
} }
...@@ -581,7 +594,8 @@ static int pnx8xxx_request_port(struct uart_port *port) ...@@ -581,7 +594,8 @@ static int pnx8xxx_request_port(struct uart_port *port)
*/ */
static void pnx8xxx_config_port(struct uart_port *port, int flags) static void pnx8xxx_config_port(struct uart_port *port, int flags)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
if (flags & UART_CONFIG_TYPE && if (flags & UART_CONFIG_TYPE &&
pnx8xxx_request_port(&sport->port) == 0) pnx8xxx_request_port(&sport->port) == 0)
...@@ -596,7 +610,8 @@ static void pnx8xxx_config_port(struct uart_port *port, int flags) ...@@ -596,7 +610,8 @@ static void pnx8xxx_config_port(struct uart_port *port, int flags)
static int static int
pnx8xxx_verify_port(struct uart_port *port, struct serial_struct *ser) pnx8xxx_verify_port(struct uart_port *port, struct serial_struct *ser)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
int ret = 0; int ret = 0;
if (ser->type != PORT_UNKNOWN && ser->type != PORT_PNX8XXX) if (ser->type != PORT_UNKNOWN && ser->type != PORT_PNX8XXX)
...@@ -662,7 +677,8 @@ static void __init pnx8xxx_init_ports(void) ...@@ -662,7 +677,8 @@ static void __init pnx8xxx_init_ports(void)
static void pnx8xxx_console_putchar(struct uart_port *port, int ch) static void pnx8xxx_console_putchar(struct uart_port *port, int ch)
{ {
struct pnx8xxx_port *sport = (struct pnx8xxx_port *)port; struct pnx8xxx_port *sport =
container_of(port, struct pnx8xxx_port, port);
int status; int status;
do { do {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment