提交 3399ba5b 编写于 作者: D Denis Vlasenko 提交者: Linus Torvalds

[PATCH] moxa: do not ignore input

Stop using tty internal structure in mxser_receive_chars(), use
tty_insert_flip_char(tty, ch flag); instead.

Without this change driver ignores any rx'ed chars.

Run tested.

Cc: Alan Cox <alan@redhat.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 a5117181
...@@ -1995,9 +1995,6 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status) ...@@ -1995,9 +1995,6 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status)
unsigned char ch, gdl; unsigned char ch, gdl;
int ignored = 0; int ignored = 0;
int cnt = 0; int cnt = 0;
unsigned char *cp;
char *fp;
int count;
int recv_room; int recv_room;
int max = 256; int max = 256;
unsigned long flags; unsigned long flags;
...@@ -2011,10 +2008,6 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status) ...@@ -2011,10 +2008,6 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status)
//return; //return;
} }
cp = tty->flip.char_buf;
fp = tty->flip.flag_buf;
count = 0;
// following add by Victor Yu. 09-02-2002 // following add by Victor Yu. 09-02-2002
if (info->IsMoxaMustChipFlag != MOXA_OTHER_UART) { if (info->IsMoxaMustChipFlag != MOXA_OTHER_UART) {
...@@ -2041,12 +2034,10 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status) ...@@ -2041,12 +2034,10 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status)
} }
while (gdl--) { while (gdl--) {
ch = inb(info->base + UART_RX); ch = inb(info->base + UART_RX);
count++; tty_insert_flip_char(tty, ch, 0);
*cp++ = ch;
*fp++ = 0;
cnt++; cnt++;
/* /*
if((count>=HI_WATER) && (info->stop_rx==0)){ if((cnt>=HI_WATER) && (info->stop_rx==0)){
mxser_stoprx(tty); mxser_stoprx(tty);
info->stop_rx=1; info->stop_rx=1;
break; break;
...@@ -2061,7 +2052,7 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status) ...@@ -2061,7 +2052,7 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status)
if (max-- < 0) if (max-- < 0)
break; break;
/* /*
if((count>=HI_WATER) && (info->stop_rx==0)){ if((cnt>=HI_WATER) && (info->stop_rx==0)){
mxser_stoprx(tty); mxser_stoprx(tty);
info->stop_rx=1; info->stop_rx=1;
break; break;
...@@ -2078,36 +2069,33 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status) ...@@ -2078,36 +2069,33 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status)
if (++ignored > 100) if (++ignored > 100)
break; break;
} else { } else {
count++; char flag = 0;
if (*status & UART_LSR_SPECIAL) { if (*status & UART_LSR_SPECIAL) {
if (*status & UART_LSR_BI) { if (*status & UART_LSR_BI) {
*fp++ = TTY_BREAK; flag = TTY_BREAK;
/* added by casper 1/11/2000 */ /* added by casper 1/11/2000 */
info->icount.brk++; info->icount.brk++;
/* */ /* */
if (info->flags & ASYNC_SAK) if (info->flags & ASYNC_SAK)
do_SAK(tty); do_SAK(tty);
} else if (*status & UART_LSR_PE) { } else if (*status & UART_LSR_PE) {
*fp++ = TTY_PARITY; flag = TTY_PARITY;
/* added by casper 1/11/2000 */ /* added by casper 1/11/2000 */
info->icount.parity++; info->icount.parity++;
/* */ /* */
} else if (*status & UART_LSR_FE) { } else if (*status & UART_LSR_FE) {
*fp++ = TTY_FRAME; flag = TTY_FRAME;
/* added by casper 1/11/2000 */ /* added by casper 1/11/2000 */
info->icount.frame++; info->icount.frame++;
/* */ /* */
} else if (*status & UART_LSR_OE) { } else if (*status & UART_LSR_OE) {
*fp++ = TTY_OVERRUN; flag = TTY_OVERRUN;
/* added by casper 1/11/2000 */ /* added by casper 1/11/2000 */
info->icount.overrun++; info->icount.overrun++;
/* */ /* */
} else }
*fp++ = 0; }
} else tty_insert_flip_char(tty, ch, flag);
*fp++ = 0;
*cp++ = ch;
cnt++; cnt++;
if (cnt >= recv_room) { if (cnt >= recv_room) {
if (!info->ldisc_stop_rx) { if (!info->ldisc_stop_rx) {
...@@ -2132,13 +2120,13 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status) ...@@ -2132,13 +2120,13 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status)
// above add by Victor Yu. 09-02-2002 // above add by Victor Yu. 09-02-2002
} while (*status & UART_LSR_DR); } while (*status & UART_LSR_DR);
end_intr: // add by Victor Yu. 09-02-2002 end_intr: // add by Victor Yu. 09-02-2002
mxvar_log.rxcnt[info->port] += cnt; mxvar_log.rxcnt[info->port] += cnt;
info->mon_data.rxcnt += cnt; info->mon_data.rxcnt += cnt;
info->mon_data.up_rxcnt += cnt; info->mon_data.up_rxcnt += cnt;
spin_unlock_irqrestore(&info->slock, flags); spin_unlock_irqrestore(&info->slock, flags);
tty_flip_buffer_push(tty); tty_flip_buffer_push(tty);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册