Skip to contentSkip to conversation

misc N_TTY termios fixes

PATCH New Peter Hurley 1 participant 4 messages Sep 17, 2013 TTY layer and serial drivers

lore
Share & tools
lore
#1 lore raw

PATCH 1/3 n_tty: Remove superfluous reader wakeup

In reply to Peter Hurley

n_tty's .set_termios method unconditionally performs reader wakeup; remove extra reader wakeup for canonical mode changes.

---
 drivers/tty/n_tty.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/tty/n_tty.c +0 -3
index 01bf5eb..42d7ae7 100644
@@ -1763,9 +1763,6 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
 		ldata->lnext = 0;
 	}
 
-	if (canon_change && !L_ICANON(tty) && read_cnt(ldata))
-		wake_up_interruptible(&tty->read_wait);
-
 	ldata->icanon = (L_ICANON(tty) != 0);
 
 	if (I_ISTRIP(tty) || I_IUCLC(tty) || I_IGNCR(tty) ||
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 2/3 n_tty: Remove unnecessary local variable

In reply to Peter Hurley

Flatten conditional evaluation in n_tty_set_termios; remove canon_change.

---
 drivers/tty/n_tty.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/tty/n_tty.c +1 -4
index 42d7ae7..28c468c 100644
@@ -1752,11 +1752,8 @@ int is_ignored(int sig)
 static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
 {
 	struct n_tty_data *ldata = tty->disc_data;
-	int canon_change = 1;
 
-	if (old)
-		canon_change = (old->c_lflag ^ tty->termios.c_lflag) & ICANON;
-	if (canon_change) {
+	if (!old || (old->c_lflag ^ tty->termios.c_lflag) & ICANON) {
 		bitmap_zero(ldata->read_flags, N_TTY_BUF_SIZE);
 		ldata->line_start = ldata->canon_head = ldata->read_tail;
 		ldata->erasing = 0;
Signature · 1 line
1.8.1.2
#3 lore raw

PATCH 3/3 n_tty: Style fix in n_tty_set_termios

In reply to Peter Hurley

Remove braces from single-statement conditional in n_tty_set_termios.

---
 drivers/tty/n_tty.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/tty/n_tty.c +1 -2
index 28c468c..09505ff 100644
@@ -1814,9 +1814,8 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
 	 * Fix tty hang when I_IXON(tty) is cleared, but the tty
 	 * been stopped by STOP_CHAR(tty) before it.
 	 */
-	if (!I_IXON(tty) && old && (old->c_iflag & IXON) && !tty->flow_stopped) {
+	if (!I_IXON(tty) && old && (old->c_iflag & IXON) && !tty->flow_stopped)
 		start_tty(tty);
-	}
 
 	/* The termios change make the tty ready for I/O */
 	wake_up_interruptible(&tty->write_wait);
Signature · 1 line
1.8.1.2
#0 lore raw

cover misc N_TTY termios fixes

Hi Greg,

These 3 patches correct non-critical issues in n_tty_set_termios(). Please apply for linux-next.

Thanks,

Peter Hurley (3):
n_tty: Remove superfluous reader wakeup
n_tty: Remove unnecessary local variable
n_tty: Style fix in n_tty_set_termios

 drivers/tty/n_tty.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
Signature · 1 line
1.8.1.2