static void set_io_from_upio(struct uart_port *p)
 {
-       struct uart_8250_port *up =
-               container_of(p, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(p);
 
        up->dl_read = default_serial_dl_read;
        up->dl_write = default_serial_dl_write;
 
 static void serial8250_stop_tx(struct uart_port *port)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
 
        __stop_tx(up);
 
 
 static void serial8250_start_tx(struct uart_port *port)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
 
        if (up->dma && !serial8250_tx_dma(up)) {
                return;
 
 static void serial8250_stop_rx(struct uart_port *port)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
 
        up->ier &= ~UART_IER_RLSI;
        up->port.read_status_mask &= ~UART_LSR_DR;
 
 static void serial8250_enable_ms(struct uart_port *port)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
 
        /* no MSR capabilities */
        if (up->bugs & UART_BUG_NOMSR)
 {
        unsigned char status;
        unsigned long flags;
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
        int dma_err = 0;
 
        if (iir & UART_IIR_NO_INT)
 
 static unsigned int serial8250_tx_empty(struct uart_port *port)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
        unsigned long flags;
        unsigned int lsr;
 
 
 static unsigned int serial8250_get_mctrl(struct uart_port *port)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
        unsigned int status;
        unsigned int ret;
 
 
 static void serial8250_set_mctrl(struct uart_port *port, unsigned int mctrl)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
        unsigned char mcr = 0;
 
        if (mctrl & TIOCM_RTS)
 
 static void serial8250_break_ctl(struct uart_port *port, int break_state)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
        unsigned long flags;
 
        spin_lock_irqsave(&port->lock, flags);
                         unsigned char c)
 {
        unsigned int ier;
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
 
        /*
         *      First save the IER then disable the interrupts
 
 static int serial8250_startup(struct uart_port *port)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
        unsigned long flags;
        unsigned char lsr, iir;
        int retval;
 
 static void serial8250_shutdown(struct uart_port *port)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
        unsigned long flags;
 
        /*
 serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
                          struct ktermios *old)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
        unsigned char cval, fcr = 0;
        unsigned long flags;
        unsigned int baud, quot;
 void serial8250_do_pm(struct uart_port *port, unsigned int state,
                      unsigned int oldstate)
 {
-       struct uart_8250_port *p =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *p = up_to_u8250p(port);
 
        serial8250_set_sleep(p, state != 0);
 }
 
 static void serial8250_release_port(struct uart_port *port)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
 
        serial8250_release_std_resource(up);
        if (port->type == PORT_RSA)
 
 static int serial8250_request_port(struct uart_port *port)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
        int ret;
 
        if (port->type == PORT_8250_CIR)
 
 static void serial8250_config_port(struct uart_port *port, int flags)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
        int probeflags = PROBE_ANY;
        int ret;
 
 
 static void serial8250_console_putchar(struct uart_port *port, int ch)
 {
-       struct uart_8250_port *up =
-               container_of(port, struct uart_8250_port, port);
+       struct uart_8250_port *up = up_to_u8250p(port);
 
        wait_for_xmitr(up, UART_LSR_THRE);
        serial_port_out(port, UART_TX, ch);