mxser: cleanup mxser_dtr_rts
authorJiri Slaby <jslaby@suse.cz>
Fri, 18 Jun 2021 06:15:02 +0000 (08:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Jun 2021 11:10:02 +0000 (13:10 +0200)
mxser_dtr_rts now does all inb, outb, & or | in a single statement.  The
code is hard to follow, so make it more readable by doing one-line =
one-statement.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210618061516.662-57-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/mxser.c

index 5789c43..daf820c 100644 (file)
@@ -428,14 +428,15 @@ static void mxser_dtr_rts(struct tty_port *port, int on)
 {
        struct mxser_port *mp = container_of(port, struct mxser_port, port);
        unsigned long flags;
+       u8 mcr;
 
        spin_lock_irqsave(&mp->slock, flags);
+       mcr = inb(mp->ioaddr + UART_MCR);
        if (on)
-               outb(inb(mp->ioaddr + UART_MCR) |
-                       UART_MCR_DTR | UART_MCR_RTS, mp->ioaddr + UART_MCR);
+               mcr |= UART_MCR_DTR | UART_MCR_RTS;
        else
-               outb(inb(mp->ioaddr + UART_MCR)&~(UART_MCR_DTR | UART_MCR_RTS),
-                       mp->ioaddr + UART_MCR);
+               mcr &= ~(UART_MCR_DTR | UART_MCR_RTS);
+       outb(mcr, mp->ioaddr + UART_MCR);
        spin_unlock_irqrestore(&mp->slock, flags);
 }