2013-09-17 16:53:58

by Peter Hurley

[permalink] [raw]
Subject: [PATCH tty-next 0/3] 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(-)

--
1.8.1.2


2013-09-17 16:54:03

by Peter Hurley

[permalink] [raw]
Subject: [PATCH tty-next 2/3] n_tty: Remove unnecessary local variable

Flatten conditional evaluation in n_tty_set_termios; remove
canon_change.

Signed-off-by: Peter Hurley <[email protected]>
---
drivers/tty/n_tty.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 42d7ae7..28c468c 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -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;
--
1.8.1.2

2013-09-17 16:54:24

by Peter Hurley

[permalink] [raw]
Subject: [PATCH tty-next 3/3] n_tty: Style fix in n_tty_set_termios

Remove braces from single-statement conditional in
n_tty_set_termios.

Signed-off-by: Peter Hurley <[email protected]>
---
drivers/tty/n_tty.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 28c468c..09505ff 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -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);
--
1.8.1.2

2013-09-17 16:54:40

by Peter Hurley

[permalink] [raw]
Subject: [PATCH tty-next 1/3] n_tty: Remove superfluous reader wakeup

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

Signed-off-by: Peter Hurley <[email protected]>
---
drivers/tty/n_tty.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 01bf5eb..42d7ae7 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -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) ||
--
1.8.1.2