Commit 6a3ae841 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

USB: keyspan: pull in one indent level

We can remove the "if (urb->actual_length) {" check because checking for
"while (i < urb->actual_length) {" is sufficient.  This lets us pull the
code in one indent level.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7ca2cd29
...@@ -726,45 +726,44 @@ static void usa49wg_indat_callback(struct urb *urb) ...@@ -726,45 +726,44 @@ static void usa49wg_indat_callback(struct urb *urb)
i = 0; i = 0;
len = 0; len = 0;
if (urb->actual_length) { while (i < urb->actual_length) {
while (i < urb->actual_length) {
/* Check port number from message*/ /* Check port number from message */
if (data[i] >= serial->num_ports) { if (data[i] >= serial->num_ports) {
dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n", dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n",
__func__, data[i]); __func__, data[i]);
return; return;
} }
port = serial->port[data[i++]]; port = serial->port[data[i++]];
len = data[i++]; len = data[i++];
/* 0x80 bit is error flag */ /* 0x80 bit is error flag */
if ((data[i] & 0x80) == 0) { if ((data[i] & 0x80) == 0) {
/* no error on any byte */ /* no error on any byte */
i++; i++;
for (x = 1; x < len ; ++x) for (x = 1; x < len ; ++x)
tty_insert_flip_char(&port->port, tty_insert_flip_char(&port->port,
data[i++], 0); data[i++], 0);
} else { } else {
/* /*
* some bytes had errors, every byte has status * some bytes had errors, every byte has status
*/ */
for (x = 0; x + 1 < len; x += 2) { for (x = 0; x + 1 < len; x += 2) {
int stat = data[i], flag = 0; int stat = data[i], flag = 0;
if (stat & RXERROR_OVERRUN)
flag |= TTY_OVERRUN; if (stat & RXERROR_OVERRUN)
if (stat & RXERROR_FRAMING) flag |= TTY_OVERRUN;
flag |= TTY_FRAME; if (stat & RXERROR_FRAMING)
if (stat & RXERROR_PARITY) flag |= TTY_FRAME;
flag |= TTY_PARITY; if (stat & RXERROR_PARITY)
/* XXX should handle break (0x10) */ flag |= TTY_PARITY;
tty_insert_flip_char(&port->port, /* XXX should handle break (0x10) */
data[i+1], flag); tty_insert_flip_char(&port->port, data[i+1],
i += 2; flag);
} i += 2;
} }
tty_flip_buffer_push(&port->port);
} }
tty_flip_buffer_push(&port->port);
} }
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
......
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