]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
tty: use container_of to resolve uart_pmac_port from uart_port
authorFabian Frederick <fabf@skynet.be>
Sun, 5 Oct 2014 17:01:08 +0000 (19:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Nov 2014 03:20:52 +0000 (19:20 -0800)
Use container_of instead of casting first structure member.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/pmac_zilog.c

index abbfedb84901731793aeddef5a98910c72520b42..4aca3229b7bb4ada7df459e96b253758c0ecc348 100644 (file)
@@ -1352,7 +1352,8 @@ static int pmz_verify_port(struct uart_port *port, struct serial_struct *ser)
 
 static int pmz_poll_get_char(struct uart_port *port)
 {
-       struct uart_pmac_port *uap = (struct uart_pmac_port *)port;
+       struct uart_pmac_port *uap =
+               container_of(port, struct uart_pmac_port, port);
        int tries = 2;
 
        while (tries) {
@@ -1367,7 +1368,8 @@ static int pmz_poll_get_char(struct uart_port *port)
 
 static void pmz_poll_put_char(struct uart_port *port, unsigned char c)
 {
-       struct uart_pmac_port *uap = (struct uart_pmac_port *)port;
+       struct uart_pmac_port *uap =
+               container_of(port, struct uart_pmac_port, port);
 
        /* Wait for the transmit buffer to empty. */
        while ((read_zsreg(uap, R0) & Tx_BUF_EMP) == 0)
@@ -1954,7 +1956,8 @@ static void __exit exit_pmz(void)
 
 static void pmz_console_putchar(struct uart_port *port, int ch)
 {
-       struct uart_pmac_port *uap = (struct uart_pmac_port *)port;
+       struct uart_pmac_port *uap =
+               container_of(port, struct uart_pmac_port, port);
 
        /* Wait for the transmit buffer to empty. */
        while ((read_zsreg(uap, R0) & Tx_BUF_EMP) == 0)