n_tty: Simplify input_available_p()
authorPeter Hurley <peter@hurleysoftware.com>
Tue, 11 Feb 2014 23:55:30 +0000 (18:55 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Feb 2014 18:18:48 +0000 (10:18 -0800)
Greg,

Please note this patch requires
   n_tty: Fix poll() when TIME_CHAR and MIN_CHAR == 0

Regards,
Peter Hurley

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_tty.c

index d15624c1b75161877e6319e6460981866feb54cb..41fe8a047d373cf84b14a9a2f5d8f41e07fd3b5f 100644 (file)
@@ -1900,13 +1900,10 @@ static inline int input_available_p(struct tty_struct *tty, int poll)
        struct n_tty_data *ldata = tty->disc_data;
        int amt = poll && !TIME_CHAR(tty) && MIN_CHAR(tty) ? MIN_CHAR(tty) : 1;
 
-       if (ldata->icanon && !L_EXTPROC(tty)) {
-               if (ldata->canon_head != ldata->read_tail)
-                       return 1;
-       } else if (read_cnt(ldata) >= amt)
-               return 1;
-
-       return 0;
+       if (ldata->icanon && !L_EXTPROC(tty))
+               return ldata->canon_head != ldata->read_tail;
+       else
+               return read_cnt(ldata) >= amt;
 }
 
 /**