summaryrefslogtreecommitdiff
path: root/drivers/tty/n_tty.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2013-06-15 18:04:28 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-24 04:02:22 +0400
commit29c7c5ca36d9c132cf9c37a09bc43626e790fb4c (patch)
tree83062c0fa9301be49efcb2c0db157372c0ad8602 /drivers/tty/n_tty.c
parentbc5b1ec5860a9bf52842be4a3a9d96e19f06c11d (diff)
downloadlinux-29c7c5ca36d9c132cf9c37a09bc43626e790fb4c.tar.xz
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: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/n_tty.c')
-rw-r--r--drivers/tty/n_tty.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 59f3f10f37f3..7f15b269cf3e 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -656,8 +656,7 @@ static size_t __process_echoes(struct tty_struct *tty)
old_space = space = tty_write_room(tty);
tail = ldata->echo_tail;
- nr = ldata->echo_commit - ldata->echo_tail;
- while (nr > 0) {
+ while (ldata->echo_commit != tail) {
c = echo_buf(ldata, tail);
if (c == ECHO_OP_START) {
unsigned char op;
@@ -701,20 +700,17 @@ static size_t __process_echoes(struct tty_struct *tty)
ldata->column--;
}
tail += 3;
- nr -= 3;
break;
case ECHO_OP_SET_CANON_COL:
ldata->canon_column = ldata->column;
tail += 2;
- nr -= 2;
break;
case ECHO_OP_MOVE_BACK_COL:
if (ldata->column > 0)
ldata->column--;
tail += 2;
- nr -= 2;
break;
case ECHO_OP_START:
@@ -727,7 +723,6 @@ static size_t __process_echoes(struct tty_struct *tty)
ldata->column++;
space--;
tail += 2;
- nr -= 2;
break;
default:
@@ -749,7 +744,6 @@ static size_t __process_echoes(struct tty_struct *tty)
ldata->column += 2;
space -= 2;
tail += 2;
- nr -= 2;
}
if (no_space_left)
@@ -767,7 +761,6 @@ static size_t __process_echoes(struct tty_struct *tty)
space -= 1;
}
tail += 1;
- nr -= 1;
}
}