Merge tag 'staging-4.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[cascardo/linux.git] / drivers / staging / dgnc / dgnc_tty.c
index 1b37f7b..bcd2bdf 100644 (file)
@@ -443,15 +443,13 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
        brd->PrintDriver.termios = NULL;
 }
 
-/*=======================================================================
- *
+/*
  *     dgnc_wmove - Write data to transmit queue.
  *
  *             ch      - Pointer to channel structure.
  *             buf     - Pointer to characters to be moved.
  *             n       - Number of characters to move.
- *
- *=======================================================================*/
+ */
 static void dgnc_wmove(struct channel_t *ch, char *buf, uint n)
 {
        int     remain;
@@ -489,13 +487,11 @@ static void dgnc_wmove(struct channel_t *ch, char *buf, uint n)
        ch->ch_w_head = head;
 }
 
-/*=======================================================================
- *
+/*
  *      dgnc_input - Process received data.
  *
  *           ch      - Pointer to channel structure.
- *
- *=======================================================================*/
+ */
 void dgnc_input(struct channel_t *ch)
 {
        struct dgnc_board *bd;
@@ -541,7 +537,7 @@ void dgnc_input(struct channel_t *ch)
         */
        if (!tp || (tp->magic != TTY_MAGIC) ||
            !(ch->ch_tun.un_flags & UN_ISOPEN) ||
-           !(tp->termios.c_cflag & CREAD) ||
+           !C_CREAD(tp) ||
            (ch->ch_tun.un_flags & UN_CLOSING)) {
                ch->ch_r_head = tail;
 
@@ -933,14 +929,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
        }
 
        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) {
-                       spin_unlock_irqrestore(&ch->ch_lock, flags);
-                       ch->ch_tun.un_tty->ldisc->ops->write_wakeup(ch->ch_tun.un_tty);
-                       spin_lock_irqsave(&ch->ch_lock, flags);
-               }
-
-               wake_up_interruptible(&ch->ch_tun.un_tty->write_wait);
+               tty_wakeup(ch->ch_tun.un_tty);
 
                /*
                 * If unit is set to wait until empty, check to make sure
@@ -975,14 +964,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
        }
 
        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) {
-                       spin_unlock_irqrestore(&ch->ch_lock, flags);
-                       ch->ch_pun.un_tty->ldisc->ops->write_wakeup(ch->ch_pun.un_tty);
-                       spin_lock_irqsave(&ch->ch_lock, flags);
-               }
-
-               wake_up_interruptible(&ch->ch_pun.un_tty->write_wait);
+               tty_wakeup(ch->ch_pun.un_tty);
 
                /*
                 * If unit is set to wait until empty, check to make sure
@@ -1800,8 +1782,8 @@ static int dgnc_tty_write(struct tty_struct *tty,
        }
 
        /* Update printer buffer empty time. */
-       if ((un->un_type == DGNC_PRINT) && (ch->ch_digi.digi_maxcps > 0)
-           && (ch->ch_digi.digi_bufsize > 0)) {
+       if ((un->un_type == DGNC_PRINT) && (ch->ch_digi.digi_maxcps > 0) &&
+           (ch->ch_digi.digi_bufsize > 0)) {
                ch->ch_cpstime += (HZ * count) / ch->ch_digi.digi_maxcps;
        }