Skip to contentSkip to conversation

n_tty: Simplify input_available_p()

PATCH Peter Hurley 1 participant 1 message Feb 11, 2014 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

Greg,

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

Regards,
Peter Hurley

--- >% ---
From: Peter Hurley <[email protected]>
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.

---

 drivers/tty/n_tty.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/tty/n_tty.c +4 -7
index 2747a3b..df6dda6 100644
@@ -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;
 }
 
 /**
Signature · 1 line
1.8.1.2