diff options
author | Fabian Frederick <fabf@skynet.be> | 2014-10-05 13:19:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-05 22:20:53 -0500 |
commit | 6f414130e8605920d78827e2bbf79a5ce7d25e4a (patch) | |
tree | 2b9add3853c3cf925e1ba6dec8ca585f2c52c73b /drivers/tty/serial/sunzilog.c | |
parent | afc5438b4cc1082fc1ad6b729b15d26d327e70f2 (diff) |
serial: use container_of to resolve uart_sunzilog_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>
Diffstat (limited to 'drivers/tty/serial/sunzilog.c')
-rw-r--r-- | drivers/tty/serial/sunzilog.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index 02df3940b95e..844aae7683cc 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c | |||
@@ -644,7 +644,8 @@ static unsigned int sunzilog_get_mctrl(struct uart_port *port) | |||
644 | /* The port lock is held and interrupts are disabled. */ | 644 | /* The port lock is held and interrupts are disabled. */ |
645 | static void sunzilog_set_mctrl(struct uart_port *port, unsigned int mctrl) | 645 | static void sunzilog_set_mctrl(struct uart_port *port, unsigned int mctrl) |
646 | { | 646 | { |
647 | struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; | 647 | struct uart_sunzilog_port *up = |
648 | container_of(port, struct uart_sunzilog_port, port); | ||
648 | struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); | 649 | struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); |
649 | unsigned char set_bits, clear_bits; | 650 | unsigned char set_bits, clear_bits; |
650 | 651 | ||
@@ -668,7 +669,8 @@ static void sunzilog_set_mctrl(struct uart_port *port, unsigned int mctrl) | |||
668 | /* The port lock is held and interrupts are disabled. */ | 669 | /* The port lock is held and interrupts are disabled. */ |
669 | static void sunzilog_stop_tx(struct uart_port *port) | 670 | static void sunzilog_stop_tx(struct uart_port *port) |
670 | { | 671 | { |
671 | struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; | 672 | struct uart_sunzilog_port *up = |
673 | container_of(port, struct uart_sunzilog_port, port); | ||
672 | 674 | ||
673 | up->flags |= SUNZILOG_FLAG_TX_STOPPED; | 675 | up->flags |= SUNZILOG_FLAG_TX_STOPPED; |
674 | } | 676 | } |
@@ -676,7 +678,8 @@ static void sunzilog_stop_tx(struct uart_port *port) | |||
676 | /* The port lock is held and interrupts are disabled. */ | 678 | /* The port lock is held and interrupts are disabled. */ |
677 | static void sunzilog_start_tx(struct uart_port *port) | 679 | static void sunzilog_start_tx(struct uart_port *port) |
678 | { | 680 | { |
679 | struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; | 681 | struct uart_sunzilog_port *up = |
682 | container_of(port, struct uart_sunzilog_port, port); | ||
680 | struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); | 683 | struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); |
681 | unsigned char status; | 684 | unsigned char status; |
682 | 685 | ||
@@ -736,7 +739,8 @@ static void sunzilog_stop_rx(struct uart_port *port) | |||
736 | /* The port lock is held. */ | 739 | /* The port lock is held. */ |
737 | static void sunzilog_enable_ms(struct uart_port *port) | 740 | static void sunzilog_enable_ms(struct uart_port *port) |
738 | { | 741 | { |
739 | struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; | 742 | struct uart_sunzilog_port *up = |
743 | container_of(port, struct uart_sunzilog_port, port); | ||
740 | struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); | 744 | struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); |
741 | unsigned char new_reg; | 745 | unsigned char new_reg; |
742 | 746 | ||
@@ -752,7 +756,8 @@ static void sunzilog_enable_ms(struct uart_port *port) | |||
752 | /* The port lock is not held. */ | 756 | /* The port lock is not held. */ |
753 | static void sunzilog_break_ctl(struct uart_port *port, int break_state) | 757 | static void sunzilog_break_ctl(struct uart_port *port, int break_state) |
754 | { | 758 | { |
755 | struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; | 759 | struct uart_sunzilog_port *up = |
760 | container_of(port, struct uart_sunzilog_port, port); | ||
756 | struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); | 761 | struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port); |
757 | unsigned char set_bits, clear_bits, new_reg; | 762 | unsigned char set_bits, clear_bits, new_reg; |
758 | unsigned long flags; | 763 | unsigned long flags; |
@@ -938,7 +943,8 @@ static void | |||
938 | sunzilog_set_termios(struct uart_port *port, struct ktermios *termios, | 943 | sunzilog_set_termios(struct uart_port *port, struct ktermios *termios, |
939 | struct ktermios *old) | 944 | struct ktermios *old) |
940 | { | 945 | { |
941 | struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; | 946 | struct uart_sunzilog_port *up = |
947 | container_of(port, struct uart_sunzilog_port, port); | ||
942 | unsigned long flags; | 948 | unsigned long flags; |
943 | int baud, brg; | 949 | int baud, brg; |
944 | 950 | ||
@@ -998,7 +1004,8 @@ static int sunzilog_verify_port(struct uart_port *port, struct serial_struct *se | |||
998 | static int sunzilog_get_poll_char(struct uart_port *port) | 1004 | static int sunzilog_get_poll_char(struct uart_port *port) |
999 | { | 1005 | { |
1000 | unsigned char ch, r1; | 1006 | unsigned char ch, r1; |
1001 | struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port; | 1007 | struct uart_sunzilog_port *up = |
1008 | container_of(port, struct uart_sunzilog_port, port); | ||
1002 | struct zilog_channel __iomem *channel | 1009 | struct zilog_channel __iomem *channel |
1003 | = ZILOG_CHANNEL_FROM_PORT(&up->port); | 1010 | = ZILOG_CHANNEL_FROM_PORT(&up->port); |
1004 | 1011 | ||
@@ -1032,7 +1039,8 @@ static int sunzilog_get_poll_char(struct uart_port *port) | |||
1032 | static void sunzilog_put_poll_char(struct uart_port *port, | 1039 | static void sunzilog_put_poll_char(struct uart_port *port, |
1033 | unsigned char ch) | 1040 | unsigned char ch) |
1034 | { | 1041 | { |
1035 | struct uart_sunzilog_port *up = (struct uart_sunzilog_port *)port; | 1042 | struct uart_sunzilog_port *up = |
1043 | container_of(port, struct uart_sunzilog_port, port); | ||
1036 | 1044 | ||
1037 | sunzilog_putchar(&up->port, ch); | 1045 | sunzilog_putchar(&up->port, ch); |
1038 | } | 1046 | } |