aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/n_tty.c
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2013-07-24 08:29:52 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-24 12:27:55 -0400
commit6baad008678cf07820a3099bfb2bb558b5d0fa2a (patch)
treeaa32c1082a452f78dbbd1bfb66a6e9bacff335d5 /drivers/tty/n_tty.c
parent4b1f79c2d7352605b567cab49de20d3b67762ee3 (diff)
n_tty: Factor ISTRIP and IUCLC receive_buf into separate fn
Convert to modal receive_buf processing; factor char receive processing for unusual termios settings out of normal per-char i/o path. 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.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 8686124b1309..59c73ee32fbf 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -1418,16 +1418,6 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c)
1418 struct n_tty_data *ldata = tty->disc_data; 1418 struct n_tty_data *ldata = tty->disc_data;
1419 int parmrk; 1419 int parmrk;
1420 1420
1421 if (I_ISTRIP(tty))
1422 c &= 0x7f;
1423 if (I_IUCLC(tty) && L_IEXTEN(tty))
1424 c = tolower(c);
1425
1426 if (L_EXTPROC(tty)) {
1427 put_tty_queue(c, ldata);
1428 return;
1429 }
1430
1431 /* 1421 /*
1432 * If the previous character was LNEXT, or we know that this 1422 * If the previous character was LNEXT, or we know that this
1433 * character is not one of the characters that we'll have to 1423 * character is not one of the characters that we'll have to
@@ -1585,7 +1575,34 @@ n_tty_receive_buf_closing(struct tty_struct *tty, const unsigned char *cp,
1585 1575
1586static void 1576static void
1587n_tty_receive_buf_standard(struct tty_struct *tty, const unsigned char *cp, 1577n_tty_receive_buf_standard(struct tty_struct *tty, const unsigned char *cp,
1588 char *fp, int count) 1578 char *fp, int count)
1579{
1580 struct n_tty_data *ldata = tty->disc_data;
1581 char flag = TTY_NORMAL;
1582
1583 while (count--) {
1584 if (fp)
1585 flag = *fp++;
1586 if (likely(flag == TTY_NORMAL)) {
1587 unsigned char c = *cp++;
1588
1589 if (I_ISTRIP(tty))
1590 c &= 0x7f;
1591 if (I_IUCLC(tty) && L_IEXTEN(tty))
1592 c = tolower(c);
1593 if (L_EXTPROC(tty)) {
1594 put_tty_queue(c, ldata);
1595 continue;
1596 }
1597 n_tty_receive_char(tty, c);
1598 } else
1599 n_tty_receive_char_flagged(tty, *cp++, flag);
1600 }
1601}
1602
1603static void
1604n_tty_receive_buf_fast(struct tty_struct *tty, const unsigned char *cp,
1605 char *fp, int count)
1589{ 1606{
1590 char flag = TTY_NORMAL; 1607 char flag = TTY_NORMAL;
1591 1608
@@ -1612,7 +1629,10 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
1612 else if (tty->closing && !L_EXTPROC(tty)) 1629 else if (tty->closing && !L_EXTPROC(tty))
1613 n_tty_receive_buf_closing(tty, cp, fp, count); 1630 n_tty_receive_buf_closing(tty, cp, fp, count);
1614 else { 1631 else {
1615 n_tty_receive_buf_standard(tty, cp, fp, count); 1632 if (!preops)
1633 n_tty_receive_buf_fast(tty, cp, fp, count);
1634 else
1635 n_tty_receive_buf_standard(tty, cp, fp, count);
1616 1636
1617 flush_echoes(tty); 1637 flush_echoes(tty);
1618 if (tty->ops->flush_chars) 1638 if (tty->ops->flush_chars)