Commit 89bb4a36 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman

n_tty: remove n_tty_receive_char_fast

n_tty_receive_char_fast is a copy of n_tty_receive_char with one
exception: PARMRK is not doubled in the former. Unify these two and
double PARMRK depending on a newly added parameter (bool parmrk_dbl).

I don't think the theoretical speedup is worth the code duplication.
Which is directly connected with maintenance burden.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210505091928.22010-4-jslaby@suse.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7fb8a8af
...@@ -1400,8 +1400,8 @@ n_tty_receive_char_special(struct tty_struct *tty, unsigned char c) ...@@ -1400,8 +1400,8 @@ n_tty_receive_char_special(struct tty_struct *tty, unsigned char c)
return 0; return 0;
} }
static inline void static void n_tty_receive_char(struct tty_struct *tty, unsigned char c,
n_tty_receive_char(struct tty_struct *tty, unsigned char c) bool parmrk_dbl)
{ {
struct n_tty_data *ldata = tty->disc_data; struct n_tty_data *ldata = tty->disc_data;
...@@ -1418,31 +1418,11 @@ n_tty_receive_char(struct tty_struct *tty, unsigned char c) ...@@ -1418,31 +1418,11 @@ n_tty_receive_char(struct tty_struct *tty, unsigned char c)
commit_echoes(tty); commit_echoes(tty);
} }
/* PARMRK doubling check */ /* PARMRK doubling check */
if (c == (unsigned char) '\377' && I_PARMRK(tty)) if (parmrk_dbl && c == (unsigned char) '\377' && I_PARMRK(tty))
put_tty_queue(c, ldata); put_tty_queue(c, ldata);
put_tty_queue(c, ldata); put_tty_queue(c, ldata);
} }
static inline void
n_tty_receive_char_fast(struct tty_struct *tty, unsigned char c)
{
struct n_tty_data *ldata = tty->disc_data;
if (tty->stopped && !tty->flow_stopped && I_IXON(tty) && I_IXANY(tty)) {
start_tty(tty);
process_echoes(tty);
}
if (L_ECHO(tty)) {
finish_erasing(ldata);
/* Record the column of first canon char. */
if (ldata->canon_head == ldata->read_head)
echo_set_canon_col(ldata);
echo_char(c, tty);
commit_echoes(tty);
}
put_tty_queue(c, ldata);
}
static void n_tty_receive_char_closing(struct tty_struct *tty, unsigned char c) static void n_tty_receive_char_closing(struct tty_struct *tty, unsigned char c)
{ {
if (I_ISTRIP(tty)) if (I_ISTRIP(tty))
...@@ -1494,7 +1474,7 @@ n_tty_receive_char_lnext(struct tty_struct *tty, unsigned char c, char flag) ...@@ -1494,7 +1474,7 @@ n_tty_receive_char_lnext(struct tty_struct *tty, unsigned char c, char flag)
c &= 0x7f; c &= 0x7f;
if (I_IUCLC(tty) && L_IEXTEN(tty)) if (I_IUCLC(tty) && L_IEXTEN(tty))
c = tolower(c); c = tolower(c);
n_tty_receive_char(tty, c); n_tty_receive_char(tty, c, true);
} else } else
n_tty_receive_char_flagged(tty, c, flag); n_tty_receive_char_flagged(tty, c, flag);
} }
...@@ -1572,7 +1552,7 @@ n_tty_receive_buf_standard(struct tty_struct *tty, const unsigned char *cp, ...@@ -1572,7 +1552,7 @@ n_tty_receive_buf_standard(struct tty_struct *tty, const unsigned char *cp,
continue; continue;
} }
if (!test_bit(c, ldata->char_map)) if (!test_bit(c, ldata->char_map))
n_tty_receive_char(tty, c); n_tty_receive_char(tty, c, true);
else if (n_tty_receive_char_special(tty, c) && count) { else if (n_tty_receive_char_special(tty, c) && count) {
if (fp) if (fp)
flag = *fp++; flag = *fp++;
...@@ -1598,7 +1578,7 @@ n_tty_receive_buf_fast(struct tty_struct *tty, const unsigned char *cp, ...@@ -1598,7 +1578,7 @@ n_tty_receive_buf_fast(struct tty_struct *tty, const unsigned char *cp,
unsigned char c = *cp++; unsigned char c = *cp++;
if (!test_bit(c, ldata->char_map)) if (!test_bit(c, ldata->char_map))
n_tty_receive_char_fast(tty, c); n_tty_receive_char(tty, c, false);
else if (n_tty_receive_char_special(tty, c) && count) { else if (n_tty_receive_char_special(tty, c) && count) {
if (fp) if (fp)
flag = *fp++; flag = *fp++;
......
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