[56/70] mxser: cleanup mxser_dtr_rts

Message ID 20210618061516.662-57-jslaby@suse.cz
State New
Headers show
Series
  • mxser: cleanup
Related show

Commit Message

Jiri Slaby June 18, 2021, 6:15 a.m.
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>
---
 drivers/tty/mxser.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Patch

diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index 5789c4343f10..daf820c086f4 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -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);
 }