Commit 29c7c5ca authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

n_tty: Eliminate counter in __process_echoes

Since neither echo_commit nor echo_tail can change for the duration
of __process_echoes loop, substitute index comparison for the
snapshot counter.
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bc5b1ec5
...@@ -656,8 +656,7 @@ static size_t __process_echoes(struct tty_struct *tty) ...@@ -656,8 +656,7 @@ static size_t __process_echoes(struct tty_struct *tty)
old_space = space = tty_write_room(tty); old_space = space = tty_write_room(tty);
tail = ldata->echo_tail; tail = ldata->echo_tail;
nr = ldata->echo_commit - ldata->echo_tail; while (ldata->echo_commit != tail) {
while (nr > 0) {
c = echo_buf(ldata, tail); c = echo_buf(ldata, tail);
if (c == ECHO_OP_START) { if (c == ECHO_OP_START) {
unsigned char op; unsigned char op;
...@@ -701,20 +700,17 @@ static size_t __process_echoes(struct tty_struct *tty) ...@@ -701,20 +700,17 @@ static size_t __process_echoes(struct tty_struct *tty)
ldata->column--; ldata->column--;
} }
tail += 3; tail += 3;
nr -= 3;
break; break;
case ECHO_OP_SET_CANON_COL: case ECHO_OP_SET_CANON_COL:
ldata->canon_column = ldata->column; ldata->canon_column = ldata->column;
tail += 2; tail += 2;
nr -= 2;
break; break;
case ECHO_OP_MOVE_BACK_COL: case ECHO_OP_MOVE_BACK_COL:
if (ldata->column > 0) if (ldata->column > 0)
ldata->column--; ldata->column--;
tail += 2; tail += 2;
nr -= 2;
break; break;
case ECHO_OP_START: case ECHO_OP_START:
...@@ -727,7 +723,6 @@ static size_t __process_echoes(struct tty_struct *tty) ...@@ -727,7 +723,6 @@ static size_t __process_echoes(struct tty_struct *tty)
ldata->column++; ldata->column++;
space--; space--;
tail += 2; tail += 2;
nr -= 2;
break; break;
default: default:
...@@ -749,7 +744,6 @@ static size_t __process_echoes(struct tty_struct *tty) ...@@ -749,7 +744,6 @@ static size_t __process_echoes(struct tty_struct *tty)
ldata->column += 2; ldata->column += 2;
space -= 2; space -= 2;
tail += 2; tail += 2;
nr -= 2;
} }
if (no_space_left) if (no_space_left)
...@@ -767,7 +761,6 @@ static size_t __process_echoes(struct tty_struct *tty) ...@@ -767,7 +761,6 @@ static size_t __process_echoes(struct tty_struct *tty)
space -= 1; space -= 1;
} }
tail += 1; tail += 1;
nr -= 1;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment