diff options
author | Fabian Frederick <fabf@skynet.be> | 2014-10-05 13:01:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-05 22:20:52 -0500 |
commit | 726657653ff1400bd144b6f293b907d2a1fc9865 (patch) | |
tree | 0ceeb7441ae120f3df4946fd066471a57f01a83b | |
parent | 9a6962c531d890880b5b6a75df0678b1ba7742cc (diff) |
serial: sunsab: use container_of to resolve uart_sunsu_port from uart_port
Use container_of instead of casting first structure member.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/sunsab.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c index b339fe4811cd..e3b43a449d46 100644 --- a/drivers/tty/serial/sunsab.c +++ b/drivers/tty/serial/sunsab.c | |||
@@ -345,7 +345,8 @@ static irqreturn_t sunsab_interrupt(int irq, void *dev_id) | |||
345 | /* port->lock is not held. */ | 345 | /* port->lock is not held. */ |
346 | static unsigned int sunsab_tx_empty(struct uart_port *port) | 346 | static unsigned int sunsab_tx_empty(struct uart_port *port) |
347 | { | 347 | { |
348 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; | 348 | struct uart_sunsab_port *up = |
349 | container_of(port, struct uart_sunsab_port, port); | ||
349 | int ret; | 350 | int ret; |
350 | 351 | ||
351 | /* Do not need a lock for a state test like this. */ | 352 | /* Do not need a lock for a state test like this. */ |
@@ -360,7 +361,8 @@ static unsigned int sunsab_tx_empty(struct uart_port *port) | |||
360 | /* port->lock held by caller. */ | 361 | /* port->lock held by caller. */ |
361 | static void sunsab_set_mctrl(struct uart_port *port, unsigned int mctrl) | 362 | static void sunsab_set_mctrl(struct uart_port *port, unsigned int mctrl) |
362 | { | 363 | { |
363 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; | 364 | struct uart_sunsab_port *up = |
365 | container_of(port, struct uart_sunsab_port, port); | ||
364 | 366 | ||
365 | if (mctrl & TIOCM_RTS) { | 367 | if (mctrl & TIOCM_RTS) { |
366 | up->cached_mode &= ~SAB82532_MODE_FRTS; | 368 | up->cached_mode &= ~SAB82532_MODE_FRTS; |
@@ -383,7 +385,8 @@ static void sunsab_set_mctrl(struct uart_port *port, unsigned int mctrl) | |||
383 | /* port->lock is held by caller and interrupts are disabled. */ | 385 | /* port->lock is held by caller and interrupts are disabled. */ |
384 | static unsigned int sunsab_get_mctrl(struct uart_port *port) | 386 | static unsigned int sunsab_get_mctrl(struct uart_port *port) |
385 | { | 387 | { |
386 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; | 388 | struct uart_sunsab_port *up = |
389 | container_of(port, struct uart_sunsab_port, port); | ||
387 | unsigned char val; | 390 | unsigned char val; |
388 | unsigned int result; | 391 | unsigned int result; |
389 | 392 | ||
@@ -404,7 +407,8 @@ static unsigned int sunsab_get_mctrl(struct uart_port *port) | |||
404 | /* port->lock held by caller. */ | 407 | /* port->lock held by caller. */ |
405 | static void sunsab_stop_tx(struct uart_port *port) | 408 | static void sunsab_stop_tx(struct uart_port *port) |
406 | { | 409 | { |
407 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; | 410 | struct uart_sunsab_port *up = |
411 | container_of(port, struct uart_sunsab_port, port); | ||
408 | 412 | ||
409 | up->interrupt_mask1 |= SAB82532_IMR1_XPR; | 413 | up->interrupt_mask1 |= SAB82532_IMR1_XPR; |
410 | writeb(up->interrupt_mask1, &up->regs->w.imr1); | 414 | writeb(up->interrupt_mask1, &up->regs->w.imr1); |
@@ -432,7 +436,8 @@ static void sunsab_tx_idle(struct uart_sunsab_port *up) | |||
432 | /* port->lock held by caller. */ | 436 | /* port->lock held by caller. */ |
433 | static void sunsab_start_tx(struct uart_port *port) | 437 | static void sunsab_start_tx(struct uart_port *port) |
434 | { | 438 | { |
435 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; | 439 | struct uart_sunsab_port *up = |
440 | container_of(port, struct uart_sunsab_port, port); | ||
436 | struct circ_buf *xmit = &up->port.state->xmit; | 441 | struct circ_buf *xmit = &up->port.state->xmit; |
437 | int i; | 442 | int i; |
438 | 443 | ||
@@ -465,7 +470,8 @@ static void sunsab_start_tx(struct uart_port *port) | |||
465 | /* port->lock is not held. */ | 470 | /* port->lock is not held. */ |
466 | static void sunsab_send_xchar(struct uart_port *port, char ch) | 471 | static void sunsab_send_xchar(struct uart_port *port, char ch) |
467 | { | 472 | { |
468 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; | 473 | struct uart_sunsab_port *up = |
474 | container_of(port, struct uart_sunsab_port, port); | ||
469 | unsigned long flags; | 475 | unsigned long flags; |
470 | 476 | ||
471 | if (ch == __DISABLED_CHAR) | 477 | if (ch == __DISABLED_CHAR) |
@@ -482,7 +488,8 @@ static void sunsab_send_xchar(struct uart_port *port, char ch) | |||
482 | /* port->lock held by caller. */ | 488 | /* port->lock held by caller. */ |
483 | static void sunsab_stop_rx(struct uart_port *port) | 489 | static void sunsab_stop_rx(struct uart_port *port) |
484 | { | 490 | { |
485 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; | 491 | struct uart_sunsab_port *up = |
492 | container_of(port, struct uart_sunsab_port, port); | ||
486 | 493 | ||
487 | up->interrupt_mask0 |= SAB82532_IMR0_TCD; | 494 | up->interrupt_mask0 |= SAB82532_IMR0_TCD; |
488 | writeb(up->interrupt_mask1, &up->regs->w.imr0); | 495 | writeb(up->interrupt_mask1, &up->regs->w.imr0); |
@@ -491,7 +498,8 @@ static void sunsab_stop_rx(struct uart_port *port) | |||
491 | /* port->lock is not held. */ | 498 | /* port->lock is not held. */ |
492 | static void sunsab_break_ctl(struct uart_port *port, int break_state) | 499 | static void sunsab_break_ctl(struct uart_port *port, int break_state) |
493 | { | 500 | { |
494 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; | 501 | struct uart_sunsab_port *up = |
502 | container_of(port, struct uart_sunsab_port, port); | ||
495 | unsigned long flags; | 503 | unsigned long flags; |
496 | unsigned char val; | 504 | unsigned char val; |
497 | 505 | ||
@@ -514,7 +522,8 @@ static void sunsab_break_ctl(struct uart_port *port, int break_state) | |||
514 | /* port->lock is not held. */ | 522 | /* port->lock is not held. */ |
515 | static int sunsab_startup(struct uart_port *port) | 523 | static int sunsab_startup(struct uart_port *port) |
516 | { | 524 | { |
517 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; | 525 | struct uart_sunsab_port *up = |
526 | container_of(port, struct uart_sunsab_port, port); | ||
518 | unsigned long flags; | 527 | unsigned long flags; |
519 | unsigned char tmp; | 528 | unsigned char tmp; |
520 | int err = request_irq(up->port.irq, sunsab_interrupt, | 529 | int err = request_irq(up->port.irq, sunsab_interrupt, |
@@ -585,7 +594,8 @@ static int sunsab_startup(struct uart_port *port) | |||
585 | /* port->lock is not held. */ | 594 | /* port->lock is not held. */ |
586 | static void sunsab_shutdown(struct uart_port *port) | 595 | static void sunsab_shutdown(struct uart_port *port) |
587 | { | 596 | { |
588 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; | 597 | struct uart_sunsab_port *up = |
598 | container_of(port, struct uart_sunsab_port, port); | ||
589 | unsigned long flags; | 599 | unsigned long flags; |
590 | 600 | ||
591 | spin_lock_irqsave(&up->port.lock, flags); | 601 | spin_lock_irqsave(&up->port.lock, flags); |
@@ -771,7 +781,8 @@ static void sunsab_convert_to_sab(struct uart_sunsab_port *up, unsigned int cfla | |||
771 | static void sunsab_set_termios(struct uart_port *port, struct ktermios *termios, | 781 | static void sunsab_set_termios(struct uart_port *port, struct ktermios *termios, |
772 | struct ktermios *old) | 782 | struct ktermios *old) |
773 | { | 783 | { |
774 | struct uart_sunsab_port *up = (struct uart_sunsab_port *) port; | 784 | struct uart_sunsab_port *up = |
785 | container_of(port, struct uart_sunsab_port, port); | ||
775 | unsigned long flags; | 786 | unsigned long flags; |
776 | unsigned int baud = uart_get_baud_rate(port, termios, old, 0, 4000000); | 787 | unsigned int baud = uart_get_baud_rate(port, termios, old, 0, 4000000); |
777 | unsigned int quot = uart_get_divisor(port, baud); | 788 | unsigned int quot = uart_get_divisor(port, baud); |
@@ -840,7 +851,8 @@ static struct uart_sunsab_port *sunsab_ports; | |||
840 | 851 | ||
841 | static void sunsab_console_putchar(struct uart_port *port, int c) | 852 | static void sunsab_console_putchar(struct uart_port *port, int c) |
842 | { | 853 | { |
843 | struct uart_sunsab_port *up = (struct uart_sunsab_port *)port; | 854 | struct uart_sunsab_port *up = |
855 | container_of(port, struct uart_sunsab_port, port); | ||
844 | 856 | ||
845 | sunsab_tec_wait(up); | 857 | sunsab_tec_wait(up); |
846 | writeb(c, &up->regs->w.tic); | 858 | writeb(c, &up->regs->w.tic); |