Commit 74d81395 authored by Johan Hovold's avatar Johan Hovold

USB: serial: digi_acceleport: clean up set_termios

Clean up set_termios() by adding missing white space around operators
and making a couple of continuation lines more readable.

Also drop a couple of redundant braces.
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent a7f9f290
...@@ -740,9 +740,9 @@ static void digi_set_termios(struct tty_struct *tty, ...@@ -740,9 +740,9 @@ static void digi_set_termios(struct tty_struct *tty,
/* set parity */ /* set parity */
tty->termios.c_cflag &= ~CMSPAR; tty->termios.c_cflag &= ~CMSPAR;
if ((cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD))) { if ((cflag & (PARENB | PARODD)) != (old_cflag & (PARENB | PARODD))) {
if (cflag&PARENB) { if (cflag & PARENB) {
if (cflag&PARODD) if (cflag & PARODD)
arg = DIGI_PARITY_ODD; arg = DIGI_PARITY_ODD;
else else
arg = DIGI_PARITY_EVEN; arg = DIGI_PARITY_EVEN;
...@@ -755,9 +755,9 @@ static void digi_set_termios(struct tty_struct *tty, ...@@ -755,9 +755,9 @@ static void digi_set_termios(struct tty_struct *tty,
buf[i++] = 0; buf[i++] = 0;
} }
/* set word size */ /* set word size */
if ((cflag&CSIZE) != (old_cflag&CSIZE)) { if ((cflag & CSIZE) != (old_cflag & CSIZE)) {
arg = -1; arg = -1;
switch (cflag&CSIZE) { switch (cflag & CSIZE) {
case CS5: arg = DIGI_WORD_SIZE_5; break; case CS5: arg = DIGI_WORD_SIZE_5; break;
case CS6: arg = DIGI_WORD_SIZE_6; break; case CS6: arg = DIGI_WORD_SIZE_6; break;
case CS7: arg = DIGI_WORD_SIZE_7; break; case CS7: arg = DIGI_WORD_SIZE_7; break;
...@@ -765,7 +765,7 @@ static void digi_set_termios(struct tty_struct *tty, ...@@ -765,7 +765,7 @@ static void digi_set_termios(struct tty_struct *tty,
default: default:
dev_dbg(dev, dev_dbg(dev,
"digi_set_termios: can't handle word size %d\n", "digi_set_termios: can't handle word size %d\n",
(cflag&CSIZE)); cflag & CSIZE);
break; break;
} }
...@@ -779,9 +779,9 @@ static void digi_set_termios(struct tty_struct *tty, ...@@ -779,9 +779,9 @@ static void digi_set_termios(struct tty_struct *tty,
} }
/* set stop bits */ /* set stop bits */
if ((cflag&CSTOPB) != (old_cflag&CSTOPB)) { if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) {
if ((cflag&CSTOPB)) if ((cflag & CSTOPB))
arg = DIGI_STOP_BITS_2; arg = DIGI_STOP_BITS_2;
else else
arg = DIGI_STOP_BITS_1; arg = DIGI_STOP_BITS_1;
...@@ -794,15 +794,15 @@ static void digi_set_termios(struct tty_struct *tty, ...@@ -794,15 +794,15 @@ static void digi_set_termios(struct tty_struct *tty,
} }
/* set input flow control */ /* set input flow control */
if ((iflag&IXOFF) != (old_iflag&IXOFF) if ((iflag & IXOFF) != (old_iflag & IXOFF) ||
|| (cflag&CRTSCTS) != (old_cflag&CRTSCTS)) { (cflag & CRTSCTS) != (old_cflag & CRTSCTS)) {
arg = 0; arg = 0;
if (iflag&IXOFF) if (iflag & IXOFF)
arg |= DIGI_INPUT_FLOW_CONTROL_XON_XOFF; arg |= DIGI_INPUT_FLOW_CONTROL_XON_XOFF;
else else
arg &= ~DIGI_INPUT_FLOW_CONTROL_XON_XOFF; arg &= ~DIGI_INPUT_FLOW_CONTROL_XON_XOFF;
if (cflag&CRTSCTS) { if (cflag & CRTSCTS) {
arg |= DIGI_INPUT_FLOW_CONTROL_RTS; arg |= DIGI_INPUT_FLOW_CONTROL_RTS;
/* On USB-4 it is necessary to assert RTS prior */ /* On USB-4 it is necessary to assert RTS prior */
...@@ -822,19 +822,18 @@ static void digi_set_termios(struct tty_struct *tty, ...@@ -822,19 +822,18 @@ static void digi_set_termios(struct tty_struct *tty,
} }
/* set output flow control */ /* set output flow control */
if ((iflag & IXON) != (old_iflag & IXON) if ((iflag & IXON) != (old_iflag & IXON) ||
|| (cflag & CRTSCTS) != (old_cflag & CRTSCTS)) { (cflag & CRTSCTS) != (old_cflag & CRTSCTS)) {
arg = 0; arg = 0;
if (iflag & IXON) if (iflag & IXON)
arg |= DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; arg |= DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF;
else else
arg &= ~DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; arg &= ~DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF;
if (cflag & CRTSCTS) { if (cflag & CRTSCTS)
arg |= DIGI_OUTPUT_FLOW_CONTROL_CTS; arg |= DIGI_OUTPUT_FLOW_CONTROL_CTS;
} else { else
arg &= ~DIGI_OUTPUT_FLOW_CONTROL_CTS; arg &= ~DIGI_OUTPUT_FLOW_CONTROL_CTS;
}
buf[i++] = DIGI_CMD_SET_OUTPUT_FLOW_CONTROL; buf[i++] = DIGI_CMD_SET_OUTPUT_FLOW_CONTROL;
buf[i++] = priv->dp_port_num; buf[i++] = priv->dp_port_num;
......
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