Skip to content

Commit

Permalink
staging: dgnc: clean up dgnc_input function
Browse files Browse the repository at this point in the history
This is for fixing checkpatch.pl warning about
"Alignment should match open parenthesis" but if that is
fixed, code line is over 80 characters.
I think "ch->ch_rqueue + tail + i" could be declared once in
the begining of loop.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Daeseok Youn authored and Greg Kroah-Hartman committed Mar 31, 2016
1 parent e491e71 commit 56d118c
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions drivers/staging/dgnc/dgnc_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ void dgnc_input(struct channel_t *ch)
* or the amount of data the card actually has pending...
*/
while (n) {
unsigned char *ch_pos = ch->ch_equeue + tail;

s = ((head >= tail) ? head : RQUEUESIZE) - tail;
s = min(s, n);

Expand All @@ -616,29 +618,20 @@ void dgnc_input(struct channel_t *ch)
*/
if (I_PARMRK(tp) || I_BRKINT(tp) || I_INPCK(tp)) {
for (i = 0; i < s; i++) {
if (*(ch->ch_equeue + tail + i) & UART_LSR_BI)
tty_insert_flip_char(tp->port,
*(ch->ch_rqueue + tail + i),
TTY_BREAK);
else if (*(ch->ch_equeue + tail + i) &
UART_LSR_PE)
tty_insert_flip_char(tp->port,
*(ch->ch_rqueue + tail + i),
TTY_PARITY);
else if (*(ch->ch_equeue + tail + i) &
UART_LSR_FE)
tty_insert_flip_char(tp->port,
*(ch->ch_rqueue + tail + i),
TTY_FRAME);
else
tty_insert_flip_char(tp->port,
*(ch->ch_rqueue + tail + i),
TTY_NORMAL);
unsigned char ch = *(ch_pos + i);
char flag = TTY_NORMAL;

if (ch & UART_LSR_BI)
flag = TTY_BREAK;
else if (ch & UART_LSR_PE)
flag = TTY_PARITY;
else if (ch & UART_LSR_FE)
flag = TTY_FRAME;

tty_insert_flip_char(tp->port, ch, flag);
}
} else {
tty_insert_flip_string(tp->port,
ch->ch_rqueue + tail,
s);
tty_insert_flip_string(tp->port, ch_pos, s);
}

tail += s;
Expand Down

0 comments on commit 56d118c

Please sign in to comment.