public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* n_tty: Simplify input_available_p()
@ 2014-02-11 23:55 Peter Hurley
  0 siblings, 0 replies; only message in thread
From: Peter Hurley @ 2014-02-11 23:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Jiri Slaby, linux-kernel, Peter Hurley

Greg,

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

Regards,
Peter Hurley

--- >% ---
From: Peter Hurley <peter@hurleysoftware.com>
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@hurleysoftware.com>
---

 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-02-11 23:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-11 23:55 n_tty: Simplify input_available_p() Peter Hurley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox