if (!brd->channels[i])
                        continue;
 
-               DGNC_SPINLOCK_INIT(ch->ch_lock);
+               spin_lock_init(&ch->ch_lock);
 
                /* Store all our magic numbers */
                ch->magic = DGNC_CHANNEL_MAGIC;
        ushort  head;
        ushort  tail;
        int     data_len;
-       ulong   lock_flags;
+       unsigned long flags;
        int flip_len;
        int len = 0;
        int n = 0;
        if (!bd || bd->magic != DGNC_BOARD_MAGIC)
                return;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        /*
         *      Figure the number of characters in the buffer.
        data_len = (head - tail) & rmask;
 
        if (data_len == 0) {
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return;
        }
 
                /* Force queue flow control to be released, if needed */
                dgnc_check_queue_flow_control(ch);
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return;
        }
 
         * If we are throttled, simply don't read any data.
         */
        if (ch->ch_flags & CH_FORCED_STOPI) {
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return;
        }
 
        }
 
        if (len <= 0) {
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                if (ld)
                        tty_ldisc_deref(ld);
                return;
        ch->ch_r_tail = tail & rmask;
        ch->ch_e_tail = tail & rmask;
        dgnc_check_queue_flow_control(ch);
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        /* Tell the tty layer its okay to "eat" the data now */
        tty_flip_buffer_push(tp->port);
 void dgnc_wakeup_writes(struct channel_t *ch)
 {
        int qlen = 0;
-       ulong lock_flags;
+       unsigned long flags;
 
        if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
                return;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        /*
         * If channel now has space, wake up anyone waiting on the condition.
                qlen += WQUEUESIZE;
 
        if (qlen >= (WQUEUESIZE - 256)) {
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return;
        }
 
        if (ch->ch_tun.un_flags & UN_ISOPEN) {
                if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
                        ch->ch_tun.un_tty->ldisc->ops->write_wakeup) {
-                       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+                       spin_unlock_irqrestore(&ch->ch_lock, flags);
                        (ch->ch_tun.un_tty->ldisc->ops->write_wakeup)(ch->ch_tun.un_tty);
-                       DGNC_LOCK(ch->ch_lock, lock_flags);
+                       spin_lock_irqsave(&ch->ch_lock, flags);
                }
 
                wake_up_interruptible(&ch->ch_tun.un_tty->write_wait);
        if (ch->ch_pun.un_flags & UN_ISOPEN) {
                if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
                        ch->ch_pun.un_tty->ldisc->ops->write_wakeup) {
-                       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+                       spin_unlock_irqrestore(&ch->ch_lock, flags);
                        (ch->ch_pun.un_tty->ldisc->ops->write_wakeup)(ch->ch_pun.un_tty);
-                       DGNC_LOCK(ch->ch_lock, lock_flags);
+                       spin_lock_irqsave(&ch->ch_lock, flags);
                }
 
                wake_up_interruptible(&ch->ch_pun.un_tty->write_wait);
                wake_up_interruptible(&ch->ch_pun.un_flags_wait);
        }
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
 
        uint            major = 0;
        uint            minor = 0;
        int             rc = 0;
-       ulong           lock_flags;
+       unsigned long flags;
 
        rc = 0;
 
        if (rc)
                return rc;
 
-       DGNC_LOCK(brd->bd_lock, lock_flags);
+       spin_lock_irqsave(&brd->bd_lock, flags);
 
        /* If opened device is greater than our number of ports, bail. */
        if (PORT_NUM(minor) > brd->nasync) {
-               DGNC_UNLOCK(brd->bd_lock, lock_flags);
+               spin_unlock_irqrestore(&brd->bd_lock, flags);
                return -ENXIO;
        }
 
        ch = brd->channels[PORT_NUM(minor)];
        if (!ch) {
-               DGNC_UNLOCK(brd->bd_lock, lock_flags);
+               spin_unlock_irqrestore(&brd->bd_lock, flags);
                return -ENXIO;
        }
 
        /* Drop board lock */
-       DGNC_UNLOCK(brd->bd_lock, lock_flags);
+       spin_unlock_irqrestore(&brd->bd_lock, flags);
 
        /* Grab channel lock */
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        /* Figure out our type */
        if (!IS_PRINT(minor)) {
                un = &brd->channels[PORT_NUM(minor)]->ch_pun;
                un->un_type = DGNC_PRINT;
        } else {
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return -ENXIO;
        }
 
         * where we simply cannot safely keep going, wait until the
         * state clears.
         */
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        rc = wait_event_interruptible(ch->ch_flags_wait, ((ch->ch_flags & CH_OPENING) == 0));
 
        if (rc)
                return -EINTR;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
 
        /* Store our unit into driver_data, so we always have it available. */
        ch->ch_flags |= (CH_OPENING);
 
        /* Drop locks, as malloc with GFP_KERNEL can sleep */
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        if (!ch->ch_rqueue)
                ch->ch_rqueue = kzalloc(RQUEUESIZE, GFP_KERNEL);
        if (!ch->ch_wqueue)
                ch->ch_wqueue = kzalloc(WQUEUESIZE, GFP_KERNEL);
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        ch->ch_flags &= ~(CH_OPENING);
        wake_up_interruptible(&ch->ch_flags_wait);
         * follow protocol for opening port
         */
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        rc = dgnc_block_til_ready(tty, file, ch);
 
        /* No going back now, increment our unit and channel counters */
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
        ch->ch_open_count++;
        un->un_open_count++;
        un->un_flags |= (UN_ISOPEN);
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        return rc;
 }
 {
        int retval = 0;
        struct un_t *un = NULL;
-       ulong   lock_flags;
+       unsigned long flags;
        uint    old_flags = 0;
        int     sleep_on_un_flags = 0;
 
        if (!un || un->magic != DGNC_UNIT_MAGIC)
                return -ENXIO;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        ch->ch_wopen++;
 
                 * eventually goes active.
                 */
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
 
                /*
                 * Wait for something in the flags to change from the current value.
                 * We got woken up for some reason.
                 * Before looping around, grab our channel lock.
                 */
-               DGNC_LOCK(ch->ch_lock, lock_flags);
+               spin_lock_irqsave(&ch->ch_lock, flags);
        }
 
        ch->ch_wopen--;
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        if (retval)
                return retval;
        struct dgnc_board *bd;
        struct channel_t *ch;
        struct un_t *un;
-       ulong lock_flags;
+       unsigned long flags;
        int rc = 0;
 
        if (!tty || tty->magic != TTY_MAGIC)
 
        ts = &tty->termios;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        /*
         * Determine if this is the last close or not - and if we agree about
        ch->ch_open_count--;
 
        if (ch->ch_open_count && un->un_open_count) {
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return;
        }
 
                        ch->ch_flags &= ~CH_PRON;
                }
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                /* wait for output to drain */
                /* This will also return if we take an interrupt */
 
                dgnc_tty_flush_buffer(tty);
                tty_ldisc_flush(tty);
 
-               DGNC_LOCK(ch->ch_lock, lock_flags);
+               spin_lock_irqsave(&ch->ch_lock, flags);
 
                tty->closing = 0;
 
                         * have been dropped for modems to see it.
                         */
                        if (ch->ch_close_delay) {
-                               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+                               spin_unlock_irqrestore(&ch->ch_lock,
+                                                      flags);
                                dgnc_ms_sleep(ch->ch_close_delay);
-                               DGNC_LOCK(ch->ch_lock, lock_flags);
+                               spin_lock_irqsave(&ch->ch_lock, flags);
                        }
                }
 
        wake_up_interruptible(&ch->ch_flags_wait);
        wake_up_interruptible(&un->un_flags_wait);
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
 
        ushort ttail;
        uint tmask;
        uint chars = 0;
-       ulong   lock_flags = 0;
+       unsigned long flags;
 
        if (tty == NULL)
                return 0;
        if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
                return 0;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        tmask = WQUEUEMASK;
        thead = ch->ch_w_head & tmask;
        ttail = ch->ch_w_tail & tmask;
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        if (ttail == thead) {
                chars = 0;
        ushort tail;
        ushort tmask;
        int ret = 0;
-       ulong   lock_flags = 0;
+       unsigned long flags;
 
        if (tty == NULL || dgnc_TmpWriteBuf == NULL)
                return 0;
        if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
                return 0;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        tmask = WQUEUEMASK;
        head = (ch->ch_w_head) & tmask;
        if (ret < 0)
                ret = 0;
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        return ret;
 }
        struct un_t *un = NULL;
        int bufcount = 0, n = 0;
        int orig_count = 0;
-       ulong lock_flags;
+       unsigned long flags;
        ushort head;
        ushort tail;
        ushort tmask;
         */
        orig_count = count;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        /* Get our space available for the channel from the board */
        tmask = WQUEUEMASK;
         * Bail if no space left.
         */
        if (count <= 0) {
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return 0;
        }
 
         * If there is nothing left to copy, or I can't handle any more data, leave.
         */
        if (count <= 0) {
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return 0;
        }
 
 
                count = min(count, WRITEBUFLEN);
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
 
                /*
                 * If data is coming from user space, copy it into a temporary
                        return -EFAULT;
                }
 
-               DGNC_LOCK(ch->ch_lock, lock_flags);
+               spin_lock_irqsave(&ch->ch_lock, flags);
 
                buf = dgnc_TmpWriteBuf;
 
        }
 
        if (from_user) {
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                up(&dgnc_TmpWriteSem);
        } else {
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
        }
 
        if (count) {
        struct un_t *un;
        int result = -EIO;
        uchar mstat = 0;
-       ulong   lock_flags;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return result;
        if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
                return result;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        mstat = (ch->ch_mostat | ch->ch_mistat);
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        result = 0;
 
        struct channel_t *ch;
        struct un_t *un;
        int ret = -EIO;
-       ulong   lock_flags;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return ret;
        if (!bd || bd->magic != DGNC_BOARD_MAGIC)
                return ret;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        if (set & TIOCM_RTS)
                ch->ch_mostat |= UART_MCR_RTS;
 
        ch->ch_bd->bd_ops->assert_modem_signals(ch);
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        return 0;
 }
        struct channel_t *ch;
        struct un_t *un;
        int ret = -EIO;
-       ulong   lock_flags;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return ret;
                break;
        }
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        ch->ch_bd->bd_ops->send_break(ch, msec);
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        return 0;
 
        struct dgnc_board *bd;
        struct channel_t *ch;
        struct un_t *un;
-       ulong   lock_flags;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return;
 
        dev_dbg(tty->dev, "dgnc_tty_send_xchar start\n");
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
        bd->bd_ops->send_immediate_char(ch, c);
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        dev_dbg(tty->dev, "dgnc_tty_send_xchar finish\n");
        return;
 {
        unsigned char mstat;
        int result = -EIO;
-       ulong   lock_flags;
+       unsigned long flags;
 
        if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
                return -ENXIO;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        mstat = (ch->ch_mostat | ch->ch_mistat);
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        result = 0;
 
        struct un_t *un;
        int ret = -ENXIO;
        unsigned int arg = 0;
-       ulong   lock_flags;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return ret;
                return -EINVAL;
        }
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        ch->ch_bd->bd_ops->assert_modem_signals(ch);
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        return 0;
 }
        struct channel_t *ch;
        struct un_t *un;
        struct digi_t tmp;
-       ulong   lock_flags;
+       unsigned long flags;
 
        if (!retinfo)
                return -EFAULT;
 
        memset(&tmp, 0, sizeof(tmp));
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
        memcpy(&tmp, &ch->ch_digi, sizeof(tmp));
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
                return -EFAULT;
        struct channel_t *ch;
        struct un_t *un;
        struct digi_t new_digi;
-       ulong lock_flags;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return -EFAULT;
        if (copy_from_user(&new_digi, new_info, sizeof(new_digi)))
                return -EFAULT;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        /*
         * Handle transistions to and from RTS Toggle.
 
        ch->ch_bd->bd_ops->param(tty);
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 
        return 0;
 }
        struct dgnc_board *bd;
        struct channel_t *ch;
        struct un_t *un;
-       unsigned long lock_flags;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return;
        if (!bd || bd->magic != DGNC_BOARD_MAGIC)
                return;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        ch->ch_c_cflag   = tty->termios.c_cflag;
        ch->ch_c_iflag   = tty->termios.c_iflag;
        ch->ch_bd->bd_ops->param(tty);
        dgnc_carrier(ch);
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
 
 {
        struct channel_t *ch;
        struct un_t *un;
-       ulong   lock_flags = 0;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return;
        if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
                return;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        ch->ch_flags |= (CH_FORCED_STOPI);
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
 
 {
        struct channel_t *ch;
        struct un_t *un;
-       ulong   lock_flags;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return;
        if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
                return;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        ch->ch_flags &= ~(CH_FORCED_STOPI);
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
 
        struct dgnc_board *bd;
        struct channel_t *ch;
        struct un_t *un;
-       ulong lock_flags;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return;
        if (!bd || bd->magic != DGNC_BOARD_MAGIC)
                return;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        ch->ch_flags &= ~(CH_FORCED_STOP);
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
 
        struct dgnc_board *bd;
        struct channel_t *ch;
        struct un_t *un;
-       ulong lock_flags;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return;
        if (!bd || bd->magic != DGNC_BOARD_MAGIC)
                return;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        ch->ch_flags |= (CH_FORCED_STOP);
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
 
        struct dgnc_board *bd;
        struct channel_t *ch;
        struct un_t *un;
-       ulong lock_flags;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return;
        if (!bd || bd->magic != DGNC_BOARD_MAGIC)
                return;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        /* Do something maybe here */
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
 
 {
        struct channel_t *ch;
        struct un_t *un;
-       ulong lock_flags;
+       unsigned long flags;
 
        if (!tty || tty->magic != TTY_MAGIC)
                return;
        if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
                return;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        ch->ch_flags &= ~CH_STOP;
 
                wake_up_interruptible(&ch->ch_pun.un_flags_wait);
        }
 
-       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+       spin_unlock_irqrestore(&ch->ch_lock, flags);
 }
 
 
        struct channel_t *ch;
        struct un_t *un;
        int rc;
-       ulong lock_flags;
+       unsigned long flags;
        void __user *uarg = (void __user *) arg;
 
        if (!tty || tty->magic != TTY_MAGIC)
        if (!bd || bd->magic != DGNC_BOARD_MAGIC)
                return -ENODEV;
 
-       DGNC_LOCK(ch->ch_lock, lock_flags);
+       spin_lock_irqsave(&ch->ch_lock, flags);
 
        if (un->un_open_count <= 0) {
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return -EIO;
        }
 
                 * in the middle: 0.375 seconds.
                 */
                rc = tty_check_change(tty);
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                if (rc)
                        return rc;
 
                if (rc)
                        return -EINTR;
 
-               DGNC_LOCK(ch->ch_lock, lock_flags);
+               spin_lock_irqsave(&ch->ch_lock, flags);
 
                if (((cmd == TCSBRK) && (!arg)) || (cmd == TCSBRKP)) {
                        ch->ch_bd->bd_ops->send_break(ch, 250);
                }
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
 
                return 0;
 
                 * in the middle: 0.375 seconds.
                 */
                rc = tty_check_change(tty);
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                if (rc)
                        return rc;
 
                if (rc)
                        return -EINTR;
 
-               DGNC_LOCK(ch->ch_lock, lock_flags);
+               spin_lock_irqsave(&ch->ch_lock, flags);
 
                ch->ch_bd->bd_ops->send_break(ch, 250);
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
 
                return 0;
 
        case TIOCSBRK:
                rc = tty_check_change(tty);
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                if (rc)
                        return rc;
 
                if (rc)
                        return -EINTR;
 
-               DGNC_LOCK(ch->ch_lock, lock_flags);
+               spin_lock_irqsave(&ch->ch_lock, flags);
 
                ch->ch_bd->bd_ops->send_break(ch, 250);
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
 
                return 0;
 
        case TIOCCBRK:
                /* Do Nothing */
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return 0;
 
        case TIOCGSOFTCAR:
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
 
                rc = put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *) arg);
                return rc;
 
        case TIOCSSOFTCAR:
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                rc = get_user(arg, (unsigned long __user *) arg);
                if (rc)
                        return rc;
 
-               DGNC_LOCK(ch->ch_lock, lock_flags);
+               spin_lock_irqsave(&ch->ch_lock, flags);
                tty->termios.c_cflag = ((tty->termios.c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0));
                ch->ch_bd->bd_ops->param(tty);
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
 
                return 0;
 
        case TIOCMGET:
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return dgnc_get_modem_info(ch, uarg);
 
        case TIOCMBIS:
        case TIOCMBIC:
        case TIOCMSET:
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return dgnc_set_modem_info(tty, cmd, uarg);
 
                /*
                 */
                rc = tty_check_change(tty);
                if (rc) {
-                       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+                       spin_unlock_irqrestore(&ch->ch_lock, flags);
                        return rc;
                }
 
                }
 
                /* pretend we didn't recognize this IOCTL */
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return -ENOIOCTLCMD;
        case TCSETSF:
        case TCSETSW:
                }
 
                /* now wait for all the output to drain */
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                rc = ch->ch_bd->bd_ops->drain(tty, 0);
                if (rc)
                        return -EINTR;
 
        case TCSETAW:
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                rc = ch->ch_bd->bd_ops->drain(tty, 0);
                if (rc)
                        return -EINTR;
                return -ENOIOCTLCMD;
 
        case TCXONC:
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                /* Make the ld do it */
                return -ENOIOCTLCMD;
 
        case DIGI_GETA:
                /* get information for ditty */
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return dgnc_tty_digigeta(tty, uarg);
 
        case DIGI_SETAW:
                /* set information for ditty */
                if (cmd == (DIGI_SETAW)) {
 
-                       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+                       spin_unlock_irqrestore(&ch->ch_lock, flags);
                        rc = ch->ch_bd->bd_ops->drain(tty, 0);
 
                        if (rc)
                                return -EINTR;
 
-                       DGNC_LOCK(ch->ch_lock, lock_flags);
+                       spin_lock_irqsave(&ch->ch_lock, flags);
                } else {
                        tty_ldisc_flush(tty);
                }
                /* fall thru */
 
        case DIGI_SETA:
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return dgnc_tty_digiseta(tty, uarg);
 
        case DIGI_LOOPBACK:
                {
                        uint loopback = 0;
                        /* Let go of locks when accessing user space, could sleep */
-                       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+                       spin_unlock_irqrestore(&ch->ch_lock, flags);
                        rc = get_user(loopback, (unsigned int __user *) arg);
                        if (rc)
                                return rc;
-                       DGNC_LOCK(ch->ch_lock, lock_flags);
+                       spin_lock_irqsave(&ch->ch_lock, flags);
 
                        /* Enable/disable internal loopback for this port */
                        if (loopback)
                                ch->ch_flags &= ~(CH_LOOPBACK);
 
                        ch->ch_bd->bd_ops->param(tty);
-                       DGNC_UNLOCK(ch->ch_lock, lock_flags);
+                       spin_unlock_irqrestore(&ch->ch_lock, flags);
                        return 0;
                }
 
        case DIGI_GETCUSTOMBAUD:
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                rc = put_user(ch->ch_custom_speed, (unsigned int __user *) arg);
                return rc;
 
        {
                int new_rate;
                /* Let go of locks when accessing user space, could sleep */
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                rc = get_user(new_rate, (int __user *) arg);
                if (rc)
                        return rc;
-               DGNC_LOCK(ch->ch_lock, lock_flags);
+               spin_lock_irqsave(&ch->ch_lock, flags);
                dgnc_set_custom_speed(ch, new_rate);
                ch->ch_bd->bd_ops->param(tty);
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return 0;
        }
 
        case DIGI_REALPORT_SENDIMMEDIATE:
        {
                unsigned char c;
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                rc = get_user(c, (unsigned char __user *) arg);
                if (rc)
                        return rc;
-               DGNC_LOCK(ch->ch_lock, lock_flags);
+               spin_lock_irqsave(&ch->ch_lock, flags);
                ch->ch_bd->bd_ops->send_immediate_char(ch, c);
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                return 0;
        }
 
                buf.rbytes = ch->ch_rxcount;
                buf.tbytes = ch->ch_txcount;
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
 
                if (copy_to_user(uarg, &buf, sizeof(buf)))
                        return -EFAULT;
                        events |= (EV_IPU | EV_IPS);
                }
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
                rc = put_user(events, (unsigned int __user *) arg);
                return rc;
        }
                int tdist;
                int count;
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
 
                /*
                 * Get data from user first.
                if (copy_from_user(&buf, uarg, sizeof(buf)))
                        return -EFAULT;
 
-               DGNC_LOCK(ch->ch_lock, lock_flags);
+               spin_lock_irqsave(&ch->ch_lock, flags);
 
                /*
                 * Figure out how much data is in our RX and TX queues.
                else
                        buf.txdone = 1;
 
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
 
                if (copy_to_user(uarg, &buf, sizeof(buf)))
                        return -EFAULT;
                return 0;
        }
        default:
-               DGNC_UNLOCK(ch->ch_lock, lock_flags);
+               spin_unlock_irqrestore(&ch->ch_lock, flags);
 
                return -ENOIOCTLCMD;
        }