if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):startup(%s)\n", __FILE__, __LINE__, info->device_name);
 
-       if (info->port.flags & ASYNC_INITIALIZED)
+       if (tty_port_initialized(&info->port))
                return 0;
 
        if (!info->tx_buf) {
        if (tty)
                clear_bit(TTY_IO_ERROR, &tty->flags);
 
-       info->port.flags |= ASYNC_INITIALIZED;
+       tty_port_set_initialized(&info->port, 1);
 
        return 0;
 }
 {
        unsigned long flags;
 
-       if (!(info->port.flags & ASYNC_INITIALIZED))
+       if (!tty_port_initialized(&info->port))
                return;
 
        if (debug_level >= DEBUG_LEVEL_INFO)
        if (tty)
                set_bit(TTY_IO_ERROR, &tty->flags);
 
-       info->port.flags &= ~ASYNC_INITIALIZED;
+       tty_port_set_initialized(&info->port, 0);
 }
 
 static void mgslpc_program_hw(MGSLPC_INFO *info, struct tty_struct *tty)
        if (tty_port_close_start(port, tty, filp) == 0)
                goto cleanup;
 
-       if (port->flags & ASYNC_INITIALIZED)
+       if (tty_port_initialized(port))
                mgslpc_wait_until_sent(tty, info->timeout);
 
        mgslpc_flush_buffer(tty);
        if (mgslpc_paranoia_check(info, tty->name, "mgslpc_wait_until_sent"))
                return;
 
-       if (!(info->port.flags & ASYNC_INITIALIZED))
+       if (!tty_port_initialized(&info->port))
                goto exit;
 
        orig_jiffies = jiffies;
 
        tty_port_hangup(&channel->tty_port);
 
        ipoctal_reset_channel(channel);
-
-       clear_bit(ASYNCB_INITIALIZED, &channel->tty_port.flags);
+       tty_port_set_initialized(&channel->tty_port, 0);
        wake_up_interruptible(&channel->tty_port.open_wait);
 }
 
                return;
 
        ipoctal_reset_channel(channel);
-       clear_bit(ASYNCB_INITIALIZED, &channel->tty_port.flags);
+       tty_port_set_initialized(&channel->tty_port, 0);
 }
 
 static void ipoctal_cleanup(struct tty_struct *tty)
 
 static int
 isdn_tty_startup(modem_info *info)
 {
-       if (info->port.flags & ASYNC_INITIALIZED)
+       if (tty_port_initialized(&info->port))
                return 0;
        isdn_lock_drivers();
 #ifdef ISDN_DEBUG_MODEM_OPEN
         */
        isdn_tty_change_speed(info);
 
-       info->port.flags |= ASYNC_INITIALIZED;
+       tty_port_set_initialized(&info->port, 1);
        info->msr |= (UART_MSR_DSR | UART_MSR_CTS);
        info->send_outstanding = 0;
        return 0;
 static void
 isdn_tty_shutdown(modem_info *info)
 {
-       if (!(info->port.flags & ASYNC_INITIALIZED))
+       if (!tty_port_initialized(&info->port))
                return;
 #ifdef ISDN_DEBUG_MODEM_OPEN
        printk(KERN_DEBUG "Shutting down isdnmodem port %d ....\n", info->line);
        if (info->port.tty)
                set_bit(TTY_IO_ERROR, &info->port.tty->flags);
 
-       info->port.flags &= ~ASYNC_INITIALIZED;
+       tty_port_set_initialized(&info->port, 0);
 }
 
 /* isdn_tty_write() is the main send-routine. It is called from the upper
         * interrupt driver to stop checking the data ready bit in the
         * line status register.
         */
-       if (port->flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(port)) {
                tty_wait_until_sent(tty, 3000); /* 30 seconds timeout */
                /*
                 * Before we drop DTR, make sure the UART transmitter
 
  */
 static inline void raw3215_try_io(struct raw3215_info *raw)
 {
-       if (!(raw->port.flags & ASYNC_INITIALIZED) ||
-           tty_port_suspended(&raw->port))
+       if (!tty_port_initialized(&raw->port) || tty_port_suspended(&raw->port))
                return;
        if (raw->queued_read != NULL)
                raw3215_start_io(raw);
 {
        unsigned long flags;
 
-       if (raw->port.flags & ASYNC_INITIALIZED)
+       if (tty_port_initialized(&raw->port))
                return 0;
        raw->line_pos = 0;
-       raw->port.flags |= ASYNC_INITIALIZED;
+       tty_port_set_initialized(&raw->port, 1);
        spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
        raw3215_try_io(raw);
        spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
        DECLARE_WAITQUEUE(wait, current);
        unsigned long flags;
 
-       if (!(raw->port.flags & ASYNC_INITIALIZED) ||
-           (raw->flags & RAW3215_FIXED))
+       if (!tty_port_initialized(&raw->port) || (raw->flags & RAW3215_FIXED))
                return;
        /* Wait for outstanding requests, then free irq */
        spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
                spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
                remove_wait_queue(&raw->empty_wait, &wait);
                set_current_state(TASK_RUNNING);
-               raw->port.flags &= ~ASYNC_INITIALIZED;
+               tty_port_set_initialized(&raw->port, 1);
        }
        spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
 }
 
 
        local_irq_save(flags);
 
-       if (port->flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(port)) {
                free_page(page);
                goto errout;
        }
         */
        change_speed(tty, info, NULL);
 
-       port->flags |= ASYNC_INITIALIZED;
+       tty_port_set_initialized(port, 1);
        local_irq_restore(flags);
        return 0;
 
        unsigned long   flags;
        struct serial_state *state;
 
-       if (!(info->tport.flags & ASYNC_INITIALIZED))
+       if (!tty_port_initialized(&info->tport))
                return;
 
        state = info;
 
        set_bit(TTY_IO_ERROR, &tty->flags);
 
-       info->tport.flags &= ~ASYNC_INITIALIZED;
+       tty_port_set_initialized(&info->tport, 0);
        local_irq_restore(flags);
 }
 
        port->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
 check_and_exit:
-       if (port->flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(port)) {
                if (change_spd) {
                        if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
                                tty->alt_speed = 57600;
         * line status register.
         */
        state->read_status_mask &= ~UART_LSR_DR;
-       if (port->flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(port)) {
                /* disable receive interrupts */
                custom.intena = IF_RBF;
                mb();
 
        local_irq_save(flags);
        status = ciab.pra;
-       control = (state->tport.flags & ASYNC_INITIALIZED) ? state->MCR : status;
+       control = tty_port_initialized(&state->tport) ? state->MCR : status;
        local_irq_restore(flags);
 
        stat_buf[0] = 0;
 
 
        spin_lock_irqsave(&card->card_lock, flags);
 
-       if (info->port.flags & ASYNC_INITIALIZED)
+       if (tty_port_initialized(&info->port))
                goto errout;
 
        if (!info->type) {
                /* enable send, recv, modem !!! */
        }
 
-       info->port.flags |= ASYNC_INITIALIZED;
+       tty_port_set_initialized(&info->port, 1);
 
        clear_bit(TTY_IO_ERROR, &tty->flags);
        info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
        struct cyclades_card *card;
        unsigned long flags;
 
-       if (!(info->port.flags & ASYNC_INITIALIZED))
+       if (!tty_port_initialized(&info->port))
                return;
 
        card = info->card;
                   some later date (after testing)!!! */
 
                set_bit(TTY_IO_ERROR, &tty->flags);
-               info->port.flags &= ~ASYNC_INITIALIZED;
+               tty_port_set_initialized(&info->port, 0);
                spin_unlock_irqrestore(&card->card_lock, flags);
        } else {
 #ifdef CY_DEBUG_OPEN
                        tty_port_lower_dtr_rts(&info->port);
 
                set_bit(TTY_IO_ERROR, &tty->flags);
-               info->port.flags &= ~ASYNC_INITIALIZED;
+               tty_port_set_initialized(&info->port, 0);
 
                spin_unlock_irqrestore(&card->card_lock, flags);
        }
                /* Stop accepting input */
                cyy_writeb(info, CyCAR, channel & 0x03);
                cyy_writeb(info, CySRER, cyy_readb(info, CySRER) & ~CyRxData);
-               if (info->port.flags & ASYNC_INITIALIZED) {
+               if (tty_port_initialized(&info->port)) {
                        /* Waiting for on-board buffers to be empty before
                           closing the port */
                        spin_unlock_irqrestore(&card->card_lock, flags);
        info->port.closing_wait = new_serial.closing_wait * HZ / 100;
 
 check_and_exit:
-       if (info->port.flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(&info->port)) {
                cy_set_line_char(info, tty);
                ret = 0;
        } else {
 
 
        for (; count > 0; count--, port++) {
                /* port not active or tx disabled to force flow control */
-               if (!(port->port.flags & ASYNC_INITIALIZED) ||
-                               !(port->status & ISI_TXOK))
+               if (!tty_port_initialized(&port->port) ||
+                       !(port->status & ISI_TXOK))
                        continue;
 
                txcount = min_t(short, TX_SIZE, port->xmit_cnt);
                return IRQ_HANDLED;
        }
        port = card->ports + channel;
-       if (!(port->port.flags & ASYNC_INITIALIZED)) {
+       if (!tty_port_initialized(&port->port)) {
                outw(0x0000, base+0x04); /* enable interrupts */
                spin_unlock(&card->card_lock);
                return IRQ_HANDLED;
 
 
        /* pci hot-un-plug support */
        for (a = 0; a < brd->numPorts; a++)
-               if (brd->ports[a].port.flags & ASYNC_INITIALIZED)
+               if (tty_port_initialized(&brd->ports[a].port))
                        tty_port_tty_hangup(&brd->ports[a].port, false);
 
        for (a = 0; a < MAX_PORTS_PER_BOARD; a++)
        while (1) {
                opened = 0;
                for (a = 0; a < brd->numPorts; a++)
-                       if (brd->ports[a].port.flags & ASYNC_INITIALIZED)
+                       if (tty_port_initialized(&brd->ports[a].port))
                                opened++;
                mutex_unlock(&moxa_openlock);
                if (!opened)
        tty->driver_data = ch;
        tty_port_tty_set(&ch->port, tty);
        mutex_lock(&ch->port.mutex);
-       if (!(ch->port.flags & ASYNC_INITIALIZED)) {
+       if (!tty_port_initialized(&ch->port)) {
                ch->statusflags = 0;
                moxa_set_tty_param(tty, &tty->termios);
                MoxaPortLineCtrl(ch, 1, 1);
                MoxaPortEnable(ch);
                MoxaSetFifo(ch, ch->type == PORT_16550A);
-               ch->port.flags |= ASYNC_INITIALIZED;
+               tty_port_set_initialized(&ch->port, 1);
        }
        mutex_unlock(&ch->port.mutex);
        mutex_unlock(&moxa_openlock);
 {
        struct tty_struct *tty = tty_port_tty_get(&p->port);
        void __iomem *ofsAddr;
-       unsigned int inited = p->port.flags & ASYNC_INITIALIZED;
+       unsigned int inited = tty_port_initialized(&p->port);
        u16 intr;
 
        if (tty) {
 
        mutex_lock(&port->mutex);
        mxser_close_port(port);
        mxser_flush_buffer(tty);
-       if (test_bit(ASYNCB_INITIALIZED, &port->flags)) {
-               if (C_HUPCL(tty))
-                       tty_port_lower_dtr_rts(port);
-       }
+       if (tty_port_initialized(port) && C_HUPCL(tty))
+               tty_port_lower_dtr_rts(port);
        mxser_shutdown_port(port);
-       clear_bit(ASYNCB_INITIALIZED, &port->flags);
+       tty_port_set_initialized(port, 0);
        mutex_unlock(&port->mutex);
        info->closing = 0;
        /* Right now the tty_port set is done outside of the close_end helper
 
        process_txrx_fifo(info);
 
-       if (test_bit(ASYNCB_INITIALIZED, &port->flags)) {
+       if (tty_port_initialized(port)) {
                if (flags != (port->flags & ASYNC_SPD_MASK)) {
                        spin_lock_irqsave(&info->slock, sl_flags);
                        mxser_change_speed(tty, NULL);
        } else {
                retval = mxser_activate(port, tty);
                if (retval == 0)
-                       set_bit(ASYNCB_INITIALIZED, &port->flags);
+                       tty_port_set_initialized(port, 1);
        }
        return retval;
 }
                                iir &= MOXA_MUST_IIR_MASK;
                                tty = tty_port_tty_get(&port->port);
                                if (!tty || port->closing ||
-                                   !(port->port.flags & ASYNC_INITIALIZED)) {
+                                   !tty_port_initialized(&port->port)) {
                                        status = inb(port->ioaddr + UART_LSR);
                                        outb(0x27, port->ioaddr + UART_FCR);
                                        inb(port->ioaddr + UART_MSR);
 
        dlci->modem_rx = 0;
        /* We could in theory open and close before we wait - eg if we get
           a DM straight back. This is ok as that will have caused a hangup */
-       set_bit(ASYNCB_INITIALIZED, &port->flags);
+       tty_port_set_initialized(port, 1);
        /* Start sending off SABM messages */
        gsm_dlci_begin_open(dlci);
        /* And wait for virtual carrier */
        if (tty_port_close_start(&dlci->port, tty, filp) == 0)
                return;
        gsm_dlci_begin_close(dlci);
-       if (test_bit(ASYNCB_INITIALIZED, &dlci->port.flags)) {
-               if (C_HUPCL(tty))
-                       tty_port_lower_dtr_rts(&dlci->port);
-       }
+       if (tty_port_initialized(&dlci->port) && C_HUPCL(tty))
+               tty_port_lower_dtr_rts(&dlci->port);
        tty_port_close_end(&dlci->port, tty);
        tty_port_tty_set(&dlci->port, NULL);
        return;
 
        if (!info)
                return;
 
-       if ((info->port.flags & ASYNC_INITIALIZED) == 0) {
+       if (!tty_port_initialized(&info->port)) {
                printk(KERN_WARNING "rp: WARNING: rp_handle_port called with "
                                "info->flags & NOT_INIT\n");
                return;
        /*
         * Info->count is now 1; so it's safe to sleep now.
         */
-       if (!test_bit(ASYNCB_INITIALIZED, &port->flags)) {
+       if (!tty_port_initialized(port)) {
                cp = &info->channel;
                sSetRxTrigger(cp, TRIG_1);
                if (sGetChanStatus(cp) & CD_ACT)
                sEnRxFIFO(cp);
                sEnTransmit(cp);
 
-               set_bit(ASYNCB_INITIALIZED, &info->port.flags);
+               tty_port_set_initialized(&info->port, 1);
 
                /*
                 * Set up the tty->alt_speed kludge
                }
        }
        spin_lock_irq(&port->lock);
-       port->flags &= ~ASYNC_INITIALIZED;
        tty->closing = 0;
        spin_unlock_irq(&port->lock);
+       tty_port_set_initialized(port, 0);
        tty_port_set_active(port, 0);
        mutex_unlock(&port->mutex);
        tty_port_tty_set(port, NULL);
        sDisCTSFlowCtl(cp);
        sDisTxSoftFlowCtl(cp);
        sClrTxXOFF(cp);
-       clear_bit(ASYNCB_INITIALIZED, &info->port.flags);
+       tty_port_set_initialized(&info->port, 0);
 
        wake_up_interruptible(&info->port.open_wait);
 }
 
 
        /* if it was already initialized, skip this */
 
-       if (info->port.flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(&info->port)) {
                local_irq_restore(flags);
                free_page(xmit_page);
                return 0;
        e100_rts(info, 1);
        e100_dtr(info, 1);
 
-       info->port.flags |= ASYNC_INITIALIZED;
+       tty_port_set_initialized(&info->port, 1);
 
        local_irq_restore(flags);
        return 0;
                info->tr_running = 0;
        }
 
-       if (!(info->port.flags & ASYNC_INITIALIZED))
+       if (!tty_port_initialized(&info->port))
                return;
 
 #ifdef SERIAL_DEBUG_OPEN
        if (info->port.tty)
                set_bit(TTY_IO_ERROR, &info->port.tty->flags);
 
-       info->port.flags &= ~ASYNC_INITIALIZED;
+       tty_port_set_initialized(&info->port, 0);
        local_irq_restore(flags);
 }
 
        info->port.low_latency = (info->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
 
  check_and_exit:
-       if (info->port.flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(&info->port))
                change_speed(info);
-       } else
+       else
                retval = startup(info);
        return retval;
 }
        e100_disable_rx(info);
        e100_disable_rx_irq(info);
 
-       if (info->port.flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(&info->port)) {
                /*
                 * Before we drop DTR, make sure the UART transmitter
                 * has completely drained; this is especially
                e100_dtr(info, 1);
                local_irq_restore(flags);
                set_current_state(TASK_INTERRUPTIBLE);
-               if (tty_hung_up_p(filp) ||
-                   !(info->port.flags & ASYNC_INITIALIZED)) {
+               if (tty_hung_up_p(filp) || !tty_port_initialized(&info->port)) {
 #ifdef SERIAL_DO_RESTART
                        if (info->port.flags & ASYNC_HUP_NOTIFY)
                                retval = -EAGAIN;
 
        struct tty_port *port = &state->port;
        int retval;
 
-       if (port->flags & ASYNC_INITIALIZED)
+       if (tty_port_initialized(port))
                return 0;
 
        /*
 
        retval = uart_port_startup(tty, state, init_hw);
        if (!retval) {
-               set_bit(ASYNCB_INITIALIZED, &port->flags);
+               tty_port_set_initialized(port, 1);
                clear_bit(TTY_IO_ERROR, &tty->flags);
        } else if (retval > 0)
                retval = 0;
        if (tty)
                set_bit(TTY_IO_ERROR, &tty->flags);
 
-       if (test_and_clear_bit(ASYNCB_INITIALIZED, &port->flags)) {
+       if (tty_port_initialized(port)) {
+               tty_port_set_initialized(port, 0);
+
                /*
                 * Turn off DTR and RTS early.
                 */
        retval = 0;
        if (uport->type == PORT_UNKNOWN)
                goto exit;
-       if (port->flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(port)) {
                if (((old_flags ^ uport->flags) & UPF_SPD_MASK) ||
                    old_custom_divisor != uport->custom_divisor) {
                        /*
         * At this point, we stop accepting input.  To do this, we
         * disable the receive line status interrupts.
         */
-       if (port->flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(port)) {
                spin_lock_irq(&uport->lock);
                uport->ops->stop_rx(uport);
                spin_unlock_irq(&uport->lock);
 
        uport->suspended = 1;
 
-       if (port->flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(port)) {
                const struct uart_ops *ops = uport->ops;
                int tries;
 
                tty_port_set_suspended(port, 1);
-               clear_bit(ASYNCB_INITIALIZED, &port->flags);
+               tty_port_set_initialized(port, 0);
 
                spin_lock_irq(&uport->lock);
                ops->stop_tx(uport);
                                ops->set_mctrl(uport, uport->mctrl);
                                ops->start_tx(uport);
                                spin_unlock_irq(&uport->lock);
-                               set_bit(ASYNCB_INITIALIZED, &port->flags);
+                               tty_port_set_initialized(port, 1);
                        } else {
                                /*
                                 * Failed to resume - maybe hardware went away?
                ret = 0;
                mutex_lock(&tport->mutex);
                /*
-                * We don't set ASYNCB_INITIALIZED as we only initialized the
-                * hw, e.g. state->xmit is still uninitialized.
+                * We don't set initialized as we only initialized the hw,
+                * e.g. state->xmit is still uninitialized.
                 */
-               if (!test_bit(ASYNCB_INITIALIZED, &tport->flags))
+               if (!tty_port_initialized(tport))
                        ret = port->ops->poll_init(port);
                mutex_unlock(&tport->mutex);
                if (ret)
 
 static int startup(struct mgsl_struct * info)
 {
        int retval = 0;
-       
+
        if ( debug_level >= DEBUG_LEVEL_INFO )
                printk("%s(%d):mgsl_startup(%s)\n",__FILE__,__LINE__,info->device_name);
-               
-       if (info->port.flags & ASYNC_INITIALIZED)
+
+       if (tty_port_initialized(&info->port))
                return 0;
-       
+
        if (!info->xmit_buf) {
                /* allocate a page of memory for a transmit buffer */
                info->xmit_buf = (unsigned char *)get_zeroed_page(GFP_KERNEL);
 
        /* program hardware for current parameters */
        mgsl_change_params(info);
-       
+
        if (info->port.tty)
                clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
 
-       info->port.flags |= ASYNC_INITIALIZED;
-       
+       tty_port_set_initialized(&info->port, 1);
+
        return 0;
-       
 }      /* end of startup() */
 
 /* shutdown()
 static void shutdown(struct mgsl_struct * info)
 {
        unsigned long flags;
-       
-       if (!(info->port.flags & ASYNC_INITIALIZED))
+
+       if (!tty_port_initialized(&info->port))
                return;
 
        if (debug_level >= DEBUG_LEVEL_INFO)
 
        spin_unlock_irqrestore(&info->irq_spinlock,flags);
 
-       mgsl_release_resources(info);   
-       
+       mgsl_release_resources(info);
+
        if (info->port.tty)
                set_bit(TTY_IO_ERROR, &info->port.tty->flags);
 
-       info->port.flags &= ~ASYNC_INITIALIZED;
-       
+       tty_port_set_initialized(&info->port, 0);
 }      /* end of shutdown() */
 
 static void mgsl_program_hw(struct mgsl_struct *info)
                goto cleanup;
 
        mutex_lock(&info->port.mutex);
-       if (info->port.flags & ASYNC_INITIALIZED)
+       if (tty_port_initialized(&info->port))
                mgsl_wait_until_sent(tty, info->timeout);
        mgsl_flush_buffer(tty);
        tty_ldisc_flush(tty);
        if (debug_level >= DEBUG_LEVEL_INFO)
                printk("%s(%d):mgsl_wait_until_sent(%s) entry\n",
                         __FILE__,__LINE__, info->device_name );
-      
+
        if (mgsl_paranoia_check(info, tty->name, "mgsl_wait_until_sent"))
                return;
 
-       if (!(info->port.flags & ASYNC_INITIALIZED))
+       if (!tty_port_initialized(&info->port))
                goto exit;
-        
+
        orig_jiffies = jiffies;
-      
+
        /* Set check interval to 1/5 of estimated time to
         * send a character, and make it at least 1. The check
         * interval should also be less than the timeout.
        port->count--;
        spin_unlock_irqrestore(&info->irq_spinlock, flags);
        port->blocked_open++;
-       
+
        while (1) {
-               if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags))
+               if (C_BAUD(tty) && tty_port_initialized(port))
                        tty_port_raise_dtr_rts(port);
-               
+
                set_current_state(TASK_INTERRUPTIBLE);
-               
-               if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)){
+
+               if (tty_hung_up_p(filp) || !tty_port_initialized(port)) {
                        retval = (port->flags & ASYNC_HUP_NOTIFY) ?
                                        -EAGAIN : -ERESTARTSYS;
                        break;
 
                goto cleanup;
 
        mutex_lock(&info->port.mutex);
-       if (info->port.flags & ASYNC_INITIALIZED)
+       if (tty_port_initialized(&info->port))
                wait_until_sent(tty, info->timeout);
        flush_buffer(tty);
        tty_ldisc_flush(tty);
        if (sanity_check(info, tty->name, "wait_until_sent"))
                return;
        DBGINFO(("%s wait_until_sent entry\n", info->device_name));
-       if (!(info->port.flags & ASYNC_INITIALIZED))
+       if (!tty_port_initialized(&info->port))
                goto exit;
 
        orig_jiffies = jiffies;
 {
        DBGINFO(("%s startup\n", info->device_name));
 
-       if (info->port.flags & ASYNC_INITIALIZED)
+       if (tty_port_initialized(&info->port))
                return 0;
 
        if (!info->tx_buf) {
        if (info->port.tty)
                clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
 
-       info->port.flags |= ASYNC_INITIALIZED;
+       tty_port_set_initialized(&info->port, 1);
 
        return 0;
 }
 {
        unsigned long flags;
 
-       if (!(info->port.flags & ASYNC_INITIALIZED))
+       if (!tty_port_initialized(&info->port))
                return;
 
        DBGINFO(("%s shutdown\n", info->device_name));
        if (info->port.tty)
                set_bit(TTY_IO_ERROR, &info->port.tty->flags);
 
-       info->port.flags &= ~ASYNC_INITIALIZED;
+       tty_port_set_initialized(&info->port, 0);
 }
 
 static void program_hw(struct slgt_info *info)
        port->blocked_open++;
 
        while (1) {
-               if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags))
+               if (C_BAUD(tty) && tty_port_initialized(port))
                        tty_port_raise_dtr_rts(port);
 
                set_current_state(TASK_INTERRUPTIBLE);
 
-               if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)){
+               if (tty_hung_up_p(filp) || !tty_port_initialized(port)) {
                        retval = (port->flags & ASYNC_HUP_NOTIFY) ?
                                        -EAGAIN : -ERESTARTSYS;
                        break;
 
                goto cleanup;
 
        mutex_lock(&info->port.mutex);
-       if (info->port.flags & ASYNC_INITIALIZED)
+       if (tty_port_initialized(&info->port))
                wait_until_sent(tty, info->timeout);
 
        flush_buffer(tty);
        if (sanity_check(info, tty->name, "wait_until_sent"))
                return;
 
-       if (!test_bit(ASYNCB_INITIALIZED, &info->port.flags))
+       if (!tty_port_initialized(&info->port))
                goto exit;
 
        orig_jiffies = jiffies;
        if ( debug_level >= DEBUG_LEVEL_INFO )
                printk("%s(%d):%s tx_releaseup()\n",__FILE__,__LINE__,info->device_name);
 
-       if (info->port.flags & ASYNC_INITIALIZED)
+       if (tty_port_initialized(&info->port))
                return 0;
 
        if (!info->tx_buf) {
        if (info->port.tty)
                clear_bit(TTY_IO_ERROR, &info->port.tty->flags);
 
-       info->port.flags |= ASYNC_INITIALIZED;
+       tty_port_set_initialized(&info->port, 1);
 
        return 0;
 }
 {
        unsigned long flags;
 
-       if (!(info->port.flags & ASYNC_INITIALIZED))
+       if (!tty_port_initialized(&info->port))
                return;
 
        if (debug_level >= DEBUG_LEVEL_INFO)
        if (info->port.tty)
                set_bit(TTY_IO_ERROR, &info->port.tty->flags);
 
-       info->port.flags &= ~ASYNC_INITIALIZED;
+       tty_port_set_initialized(&info->port, 0);
 }
 
 static void program_hw(SLMP_INFO *info)
        port->blocked_open++;
 
        while (1) {
-               if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags))
+               if (C_BAUD(tty) && tty_port_initialized(port))
                        tty_port_raise_dtr_rts(port);
 
                set_current_state(TASK_INTERRUPTIBLE);
 
-               if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)){
+               if (tty_hung_up_p(filp) || !tty_port_initialized(port)) {
                        retval = (port->flags & ASYNC_HUP_NOTIFY) ?
                                        -EAGAIN : -ERESTARTSYS;
                        break;
 
        if (port->console)
                goto out;
 
-       if (test_and_clear_bit(ASYNCB_INITIALIZED, &port->flags)) {
+       if (tty_port_initialized(port)) {
+               tty_port_set_initialized(port, 0);
                /*
                 * Drop DTR/RTS if HUPCL is set. This causes any attached
                 * modem to hang up the line.
 
        while (1) {
                /* Indicate we are open */
-               if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags))
+               if (C_BAUD(tty) && tty_port_initialized(port))
                        tty_port_raise_dtr_rts(port);
 
                prepare_to_wait(&port->open_wait, &wait, TASK_INTERRUPTIBLE);
                /* Check for a hangup or uninitialised port.
                                                        Return accordingly */
-               if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) {
+               if (tty_hung_up_p(filp) || !tty_port_initialized(port)) {
                        if (port->flags & ASYNC_HUP_NOTIFY)
                                retval = -EAGAIN;
                        else
 
        tty->closing = 1;
 
-       if (test_bit(ASYNCB_INITIALIZED, &port->flags)) {
+       if (tty_port_initialized(port)) {
                /* Don't block on a stalled port, just pull the chain */
                if (tty->flow_stopped)
                        tty_driver_flush_buffer(tty);
 
        mutex_lock(&port->mutex);
 
-       if (!test_bit(ASYNCB_INITIALIZED, &port->flags)) {
+       if (!tty_port_initialized(port)) {
                clear_bit(TTY_IO_ERROR, &tty->flags);
                if (port->ops->activate) {
                        int retval = port->ops->activate(port, tty);
                                return retval;
                        }
                }
-               set_bit(ASYNCB_INITIALIZED, &port->flags);
+               tty_port_set_initialized(port, 1);
        }
        mutex_unlock(&port->mutex);
        return tty_port_block_til_ready(port, tty, filp);
 
        if (--acm->susp_count)
                goto out;
 
-       if (test_bit(ASYNCB_INITIALIZED, &acm->port.flags)) {
+       if (tty_port_initialized(&acm->port)) {
                rv = usb_submit_urb(acm->ctrlurb, GFP_ATOMIC);
 
                for (;;) {
 {
        struct acm *acm = usb_get_intfdata(intf);
 
-       if (test_bit(ASYNCB_INITIALIZED, &acm->port.flags))
+       if (tty_port_initialized(&acm->port))
                tty_port_tty_hangup(&acm->port, false);
 
        return acm_resume(intf);
 
        info->port = port;
 
        ++port->port.count;
-       if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags)) {
+       if (!tty_port_initialized(&port->port)) {
                if (serial->type->set_termios) {
                        /*
                         * allocate a fake tty so the driver can initialize
                        tty_port_tty_set(&port->port, NULL);
                        tty_kref_put(tty);
                }
-               set_bit(ASYNCB_INITIALIZED, &port->port.flags);
+               tty_port_set_initialized(&port->port, 1);
        }
        /* Now that any required fake tty operations are completed restore
         * the tty port count */
 
         * Use tty-port initialised flag to detect all hangups including the
         * one generated at USB-device disconnect.
         */
-       if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags))
+       if (!tty_port_initialized(&port->port))
                return true;
 
        spin_lock_irqsave(&port->lock, flags);
 
        ret = wait_event_interruptible(port->port.delta_msr_wait,
                        usb_serial_generic_msr_changed(tty, arg, &cnow));
-       if (!ret && !test_bit(ASYNCB_INITIALIZED, &port->port.flags))
+       if (!ret && !tty_port_initialized(&port->port))
                ret = -EIO;
 
        return ret;
 
        for (i = 0; i < serial->num_ports; i++) {
                port = serial->port[i];
-               if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags))
+               if (!tty_port_initialized(&port->port))
                        continue;
 
                if (port->bulk_in_size) {
 
                        return;
                }
 
-               if (test_bit(ASYNCB_INITIALIZED, &demux_port->port.flags)) {
+               if (tty_port_initialized(&demux_port->port)) {
                        ch = data + HEADER_SIZE;
                        mxuport_process_read_urb_data(demux_port, ch, rcv_len);
                } else {
                }
 
                demux_port = serial->port[rcv_port];
-               if (test_bit(ASYNCB_INITIALIZED, &demux_port->port.flags)) {
+               if (tty_port_initialized(&demux_port->port)) {
                        ch = data + HEADER_SIZE;
                        rcv_event = get_unaligned_be16(data + 2);
                        mxuport_process_read_urb_event(demux_port, ch,
 
        for (i = 0; i < serial->num_ports; i++) {
                port = serial->port[i];
-               if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags))
+               if (!tty_port_initialized(&port->port))
                        continue;
 
                r = usb_serial_generic_write_start(port, GFP_NOIO);
 
 
        /*
         * Need to take susp_lock to make sure port is not already being
-        * resumed, but no need to hold it due to ASYNC_INITIALIZED.
+        * resumed, but no need to hold it due to initialized
         */
        spin_lock_irq(&intfdata->susp_lock);
        if (--intfdata->open_ports == 0)
        for (i = 0; i < serial->num_ports; i++) {
                port = serial->port[i];
 
-               if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags))
+               if (!tty_port_initialized(&port->port))
                        continue;
 
                err = sierra_submit_delayed_urbs(port);
 
  *
  * Shut down a USB serial port. Serialized against activate by the
  * tport mutex and kept to matching open/close pairs
- * of calls by the ASYNCB_INITIALIZED flag.
+ * of calls by the initialized flag.
  *
  * Not called if tty is console.
  */
 
 
        /*
         * Need to take susp_lock to make sure port is not already being
-        * resumed, but no need to hold it due to ASYNC_INITIALIZED.
+        * resumed, but no need to hold it due to initialized
         */
        spin_lock_irq(&intfdata->susp_lock);
        if (--intfdata->open_ports == 0)
        for (i = 0; i < serial->num_ports; i++) {
                port = serial->port[i];
 
-               if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags))
+               if (!tty_port_initialized(&port->port))
                        continue;
 
                portdata = usb_get_serial_port_data(port);
 
                clear_bit(TTY_PORT_SUSPENDED, &port->iflags);
 }
 
+static inline bool tty_port_initialized(struct tty_port *port)
+{
+       return test_bit(TTY_PORT_INITIALIZED, &port->iflags);
+}
+
+static inline void tty_port_set_initialized(struct tty_port *port, bool val)
+{
+       if (val)
+               set_bit(TTY_PORT_INITIALIZED, &port->iflags);
+       else
+               clear_bit(TTY_PORT_INITIALIZED, &port->iflags);
+}
+
 extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
 extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
 extern int tty_port_carrier_raised(struct tty_port *port);
 
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
 
        /* Check if already open */
-       if (test_and_set_bit(ASYNCB_INITIALIZED, &self->port.flags)) {
+       if (tty_port_initialized(&self->port)) {
                pr_debug("%s(), already open so break out!\n", __func__);
                return 0;
        }
+       tty_port_set_initialized(&self->port, 1);
 
        /* Register with IrCOMM */
        irda_notify_init(¬ify);
 
        return 0;
 err:
-       clear_bit(ASYNCB_INITIALIZED, &self->port.flags);
+       tty_port_set_initialized(&self->port, 0);
        return ret;
 }
 
        spin_unlock_irqrestore(&port->lock, flags);
 
        while (1) {
-               if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags))
+               if (C_BAUD(tty) && tty_port_initialized(port))
                        tty_port_raise_dtr_rts(port);
 
                set_current_state(TASK_INTERRUPTIBLE);
 
-               if (tty_hung_up_p(filp) ||
-                   !test_bit(ASYNCB_INITIALIZED, &port->flags)) {
+               if (tty_hung_up_p(filp) || !tty_port_initialized(port)) {
                        retval = (port->flags & ASYNC_HUP_NOTIFY) ?
                                        -EAGAIN : -ERESTARTSYS;
                        break;
        IRDA_ASSERT(self != NULL, return;);
        IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
 
-       if (!test_and_clear_bit(ASYNCB_INITIALIZED, &self->port.flags))
+       if (!tty_port_initialized(&self->port))
                return;
+       tty_port_set_initialized(&self->port, 0);
 
        ircomm_tty_detach_cable(self);
 
                seq_printf(m, "%cASYNC_CHECK_CD", sep);
                sep = '|';
        }
-       if (self->port.flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(&self->port)) {
                seq_printf(m, "%cASYNC_INITIALIZED", sep);
                sep = '|';
        }
 
 
  check_and_exit:
 
-       if (self->flags & ASYNC_INITIALIZED) {
+       if (tty_port_initialized(self)) {
                if (((old_state.flags & ASYNC_SPD_MASK) !=
                     (self->flags & ASYNC_SPD_MASK)) ||
                    (old_driver.custom_divisor != driver->custom_divisor)) {