Skip to content

Commit dc7d366

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
serial: 8250_port: do not use goto for UPQ_NO_TXEN_TEST code flow
This is unnecessary here and makes the code harder to follow. Invert the condition and drop the goto+label. Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6b879bc commit dc7d366

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

drivers/tty/serial/8250/8250_port.c

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,28 +2406,26 @@ int serial8250_do_startup(struct uart_port *port)
24062406
* test if we receive TX irq. This way, we'll never enable
24072407
* UART_BUG_TXEN.
24082408
*/
2409-
if (up->port.quirks & UPQ_NO_TXEN_TEST)
2410-
goto dont_test_tx_en;
2411-
2412-
/*
2413-
* Do a quick test to see if we receive an interrupt when we enable
2414-
* the TX irq.
2415-
*/
2416-
serial_port_out(port, UART_IER, UART_IER_THRI);
2417-
lsr = serial_port_in(port, UART_LSR);
2418-
iir = serial_port_in(port, UART_IIR);
2419-
serial_port_out(port, UART_IER, 0);
2409+
if (!(up->port.quirks & UPQ_NO_TXEN_TEST)) {
2410+
/*
2411+
* Do a quick test to see if we receive an interrupt when we
2412+
* enable the TX irq.
2413+
*/
2414+
serial_port_out(port, UART_IER, UART_IER_THRI);
2415+
lsr = serial_port_in(port, UART_LSR);
2416+
iir = serial_port_in(port, UART_IIR);
2417+
serial_port_out(port, UART_IER, 0);
24202418

2421-
if (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT) {
2422-
if (!(up->bugs & UART_BUG_TXEN)) {
2423-
up->bugs |= UART_BUG_TXEN;
2424-
dev_dbg(port->dev, "enabling bad tx status workarounds\n");
2419+
if (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT) {
2420+
if (!(up->bugs & UART_BUG_TXEN)) {
2421+
up->bugs |= UART_BUG_TXEN;
2422+
dev_dbg(port->dev, "enabling bad tx status workarounds\n");
2423+
}
2424+
} else {
2425+
up->bugs &= ~UART_BUG_TXEN;
24252426
}
2426-
} else {
2427-
up->bugs &= ~UART_BUG_TXEN;
24282427
}
24292428

2430-
dont_test_tx_en:
24312429
uart_port_unlock_irqrestore(port, flags);
24322430

24332431
/*

0 commit comments

Comments
 (0)