Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: use container_of to resolve uart_ip22zilog_port from uart_port

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>

authored by

Fabian Frederick and committed by
Greg Kroah-Hartman
2413b320 c9db776b

+12 -6
+12 -6
drivers/tty/serial/ip22zilog.c
··· 544 544 /* The port lock is held and interrupts are disabled. */ 545 545 static void ip22zilog_set_mctrl(struct uart_port *port, unsigned int mctrl) 546 546 { 547 - struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port; 547 + struct uart_ip22zilog_port *up = 548 + container_of(port, struct uart_ip22zilog_port, port); 548 549 struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port); 549 550 unsigned char set_bits, clear_bits; 550 551 ··· 569 568 /* The port lock is held and interrupts are disabled. */ 570 569 static void ip22zilog_stop_tx(struct uart_port *port) 571 570 { 572 - struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port; 571 + struct uart_ip22zilog_port *up = 572 + container_of(port, struct uart_ip22zilog_port, port); 573 573 574 574 up->flags |= IP22ZILOG_FLAG_TX_STOPPED; 575 575 } ··· 578 576 /* The port lock is held and interrupts are disabled. */ 579 577 static void ip22zilog_start_tx(struct uart_port *port) 580 578 { 581 - struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port; 579 + struct uart_ip22zilog_port *up = 580 + container_of(port, struct uart_ip22zilog_port, port); 582 581 struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port); 583 582 unsigned char status; 584 583 ··· 639 636 /* The port lock is held. */ 640 637 static void ip22zilog_enable_ms(struct uart_port *port) 641 638 { 642 - struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port; 639 + struct uart_ip22zilog_port *up = 640 + container_of(port, struct uart_ip22zilog_port, port); 643 641 struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port); 644 642 unsigned char new_reg; 645 643 ··· 656 652 /* The port lock is not held. */ 657 653 static void ip22zilog_break_ctl(struct uart_port *port, int break_state) 658 654 { 659 - struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port; 655 + struct uart_ip22zilog_port *up = 656 + container_of(port, struct uart_ip22zilog_port, port); 660 657 struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port); 661 658 unsigned char set_bits, clear_bits, new_reg; 662 659 unsigned long flags; ··· 878 873 ip22zilog_set_termios(struct uart_port *port, struct ktermios *termios, 879 874 struct ktermios *old) 880 875 { 881 - struct uart_ip22zilog_port *up = (struct uart_ip22zilog_port *) port; 876 + struct uart_ip22zilog_port *up = 877 + container_of(port, struct uart_ip22zilog_port, port); 882 878 unsigned long flags; 883 879 int baud, brg; 884 880