n_tty: Simplify input_available_p()

From: Peter Hurley
Date: Tue Feb 11 2014 - 18:56:03 EST


Greg,

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

Regards,
Peter Hurley

--- >% ---
From: Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
Date: Tue, 11 Feb 2014 10:19:14 -0500
Subject: [PATCH] n_tty: Simplify input_available_p()

Return the result of the respective boolean evaluation, rather
than evaluating and returning 0 or 1.

Signed-off-by: Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
---

drivers/tty/n_tty.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 2747a3b..df6dda6 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1898,13 +1898,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;
}

/**
--
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/