summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2025-10-22 17:26:35 +0200
committerJohan Hovold <johan@kernel.org>2025-10-27 09:21:55 +0100
commit66b1c554a83dbe30db382c527890fead49e777f5 (patch)
tree697dce8dee8b523f59b846f2af64254c04a71090
parentd432df758f92c4c28aac409bc807fd1716167577 (diff)
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>
-rw-r--r--drivers/usb/serial/belkin_sa.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index aa6b4c4ad5ec..5c41c1c82c3f 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -436,33 +436,23 @@ static int belkin_sa_tiocmset(struct tty_struct *tty,
unsigned long control_state;
unsigned long flags;
int retval = 0;
- int rts = 0;
- int dtr = 0;
spin_lock_irqsave(&priv->lock, flags);
control_state = priv->control_state;
- if (set & TIOCM_RTS) {
+ if (set & TIOCM_RTS)
control_state |= TIOCM_RTS;
- rts = 1;
- }
- if (set & TIOCM_DTR) {
+ if (set & TIOCM_DTR)
control_state |= TIOCM_DTR;
- dtr = 1;
- }
- if (clear & TIOCM_RTS) {
+ if (clear & TIOCM_RTS)
control_state &= ~TIOCM_RTS;
- rts = 1;
- }
- if (clear & TIOCM_DTR) {
+ if (clear & TIOCM_DTR)
control_state &= ~TIOCM_DTR;
- dtr = 1;
- }
priv->control_state = control_state;
spin_unlock_irqrestore(&priv->lock, flags);
- if (rts) {
+ if ((set | clear) & TIOCM_RTS) {
retval = BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST,
!!(control_state & TIOCM_RTS));
if (retval < 0) {
@@ -471,7 +461,7 @@ static int belkin_sa_tiocmset(struct tty_struct *tty,
}
}
- if (dtr) {
+ if ((set | clear) & TIOCM_DTR) {
retval = BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST,
!!(control_state & TIOCM_DTR));
if (retval < 0) {