diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2013-06-15 10:21:25 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-23 20:10:17 -0400 |
commit | 554117bdc8c245249f364ddcdbd65ae5701a5ead (patch) | |
tree | e693ee729ced818cef938548fa3b3b503a61bf1b /drivers/tty/n_tty.c | |
parent | d2f8d7abd1e7ac04a0b42df36b53fef00d5d73aa (diff) |
n_tty: Factor raw mode receive_buf() into separate fn
Convert to modal receive_buf() processing; factor raw mode
per-char i/o into n_tty_receive_buf_raw().
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.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 6aa90332dd3e..900ebbe0a7ab 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -1259,11 +1259,6 @@ static inline void n_tty_receive_char(struct tty_struct *tty, unsigned char c) | |||
1259 | struct n_tty_data *ldata = tty->disc_data; | 1259 | struct n_tty_data *ldata = tty->disc_data; |
1260 | int parmrk; | 1260 | int parmrk; |
1261 | 1261 | ||
1262 | if (ldata->raw) { | ||
1263 | put_tty_queue(c, ldata); | ||
1264 | return; | ||
1265 | } | ||
1266 | |||
1267 | if (I_ISTRIP(tty)) | 1262 | if (I_ISTRIP(tty)) |
1268 | c &= 0x7f; | 1263 | c &= 0x7f; |
1269 | if (I_IUCLC(tty) && L_IEXTEN(tty)) | 1264 | if (I_IUCLC(tty) && L_IEXTEN(tty)) |
@@ -1530,6 +1525,23 @@ n_tty_receive_buf_real_raw(struct tty_struct *tty, const unsigned char *cp, | |||
1530 | ldata->read_head += n; | 1525 | ldata->read_head += n; |
1531 | } | 1526 | } |
1532 | 1527 | ||
1528 | static void | ||
1529 | n_tty_receive_buf_raw(struct tty_struct *tty, const unsigned char *cp, | ||
1530 | char *fp, int count) | ||
1531 | { | ||
1532 | struct n_tty_data *ldata = tty->disc_data; | ||
1533 | char flag = TTY_NORMAL; | ||
1534 | |||
1535 | while (count--) { | ||
1536 | if (fp) | ||
1537 | flag = *fp++; | ||
1538 | if (likely(flag == TTY_NORMAL)) | ||
1539 | put_tty_queue(*cp++, ldata); | ||
1540 | else | ||
1541 | n_tty_receive_char_flagged(tty, *cp++, flag); | ||
1542 | } | ||
1543 | } | ||
1544 | |||
1533 | static void __receive_buf(struct tty_struct *tty, const unsigned char *cp, | 1545 | static void __receive_buf(struct tty_struct *tty, const unsigned char *cp, |
1534 | char *fp, int count) | 1546 | char *fp, int count) |
1535 | { | 1547 | { |
@@ -1537,6 +1549,8 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
1537 | 1549 | ||
1538 | if (ldata->real_raw) | 1550 | if (ldata->real_raw) |
1539 | n_tty_receive_buf_real_raw(tty, cp, fp, count); | 1551 | n_tty_receive_buf_real_raw(tty, cp, fp, count); |
1552 | else if (ldata->raw) | ||
1553 | n_tty_receive_buf_raw(tty, cp, fp, count); | ||
1540 | else { | 1554 | else { |
1541 | char flag = TTY_NORMAL; | 1555 | char flag = TTY_NORMAL; |
1542 | 1556 | ||