Skip to content

Commit 66b1c55

Browse files
committed
USB: serial: belkin_sa: clean up tiocmset()
Clean up the tiocmset() implementation by dropping the dtr and rts flags to make the logic a little easier to follow. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
1 parent d432df7 commit 66b1c55

1 file changed

Lines changed: 6 additions & 16 deletions

File tree

drivers/usb/serial/belkin_sa.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -436,33 +436,23 @@ static int belkin_sa_tiocmset(struct tty_struct *tty,
436436
unsigned long control_state;
437437
unsigned long flags;
438438
int retval = 0;
439-
int rts = 0;
440-
int dtr = 0;
441439

442440
spin_lock_irqsave(&priv->lock, flags);
443441
control_state = priv->control_state;
444442

445-
if (set & TIOCM_RTS) {
443+
if (set & TIOCM_RTS)
446444
control_state |= TIOCM_RTS;
447-
rts = 1;
448-
}
449-
if (set & TIOCM_DTR) {
445+
if (set & TIOCM_DTR)
450446
control_state |= TIOCM_DTR;
451-
dtr = 1;
452-
}
453-
if (clear & TIOCM_RTS) {
447+
if (clear & TIOCM_RTS)
454448
control_state &= ~TIOCM_RTS;
455-
rts = 1;
456-
}
457-
if (clear & TIOCM_DTR) {
449+
if (clear & TIOCM_DTR)
458450
control_state &= ~TIOCM_DTR;
459-
dtr = 1;
460-
}
461451

462452
priv->control_state = control_state;
463453
spin_unlock_irqrestore(&priv->lock, flags);
464454

465-
if (rts) {
455+
if ((set | clear) & TIOCM_RTS) {
466456
retval = BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST,
467457
!!(control_state & TIOCM_RTS));
468458
if (retval < 0) {
@@ -471,7 +461,7 @@ static int belkin_sa_tiocmset(struct tty_struct *tty,
471461
}
472462
}
473463

474-
if (dtr) {
464+
if ((set | clear) & TIOCM_DTR) {
475465
retval = BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST,
476466
!!(control_state & TIOCM_DTR));
477467
if (retval < 0) {

0 commit comments

Comments
 (0)