Commit 354fb1a7 authored by Soren Brinkmann's avatar Soren Brinkmann Committed by Greg Kroah-Hartman

tty: xuartps: Cleanup: Reformat if-else

Convert an if-else into the more common early return on error, reducing
the indent level of the happy path.
Signed-off-by: default avatarSoren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 373e882f
...@@ -202,58 +202,55 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus) ...@@ -202,58 +202,55 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus)
isrstatus &= port->read_status_mask; isrstatus &= port->read_status_mask;
isrstatus &= ~port->ignore_status_mask; isrstatus &= ~port->ignore_status_mask;
if ((isrstatus & CDNS_UART_IXR_TOUT) || if (!(isrstatus & (CDNS_UART_IXR_TOUT | CDNS_UART_IXR_RXTRIG)))
(isrstatus & CDNS_UART_IXR_RXTRIG)) { return;
/* Receive Timeout Interrupt */
while (!(readl(port->membase + CDNS_UART_SR_OFFSET) & while (!(readl(port->membase + CDNS_UART_SR_OFFSET) &
CDNS_UART_SR_RXEMPTY)) { CDNS_UART_SR_RXEMPTY)) {
u32 data; u32 data;
char status = TTY_NORMAL; char status = TTY_NORMAL;
data = readl(port->membase + CDNS_UART_FIFO_OFFSET); data = readl(port->membase + CDNS_UART_FIFO_OFFSET);
/* Non-NULL byte after BREAK is garbage (99%) */ /* Non-NULL byte after BREAK is garbage (99%) */
if (data && (port->read_status_mask & if (data && (port->read_status_mask & CDNS_UART_IXR_BRK)) {
CDNS_UART_IXR_BRK)) { port->read_status_mask &= ~CDNS_UART_IXR_BRK;
port->read_status_mask &= ~CDNS_UART_IXR_BRK; port->icount.brk++;
port->icount.brk++; if (uart_handle_break(port))
if (uart_handle_break(port)) continue;
continue; }
}
#ifdef SUPPORT_SYSRQ #ifdef SUPPORT_SYSRQ
/* /*
* uart_handle_sysrq_char() doesn't work if * uart_handle_sysrq_char() doesn't work if
* spinlocked, for some reason * spinlocked, for some reason
*/ */
if (port->sysrq) { if (port->sysrq) {
spin_unlock(&port->lock); spin_unlock(&port->lock);
if (uart_handle_sysrq_char(port, if (uart_handle_sysrq_char(port, data)) {
(unsigned char)data)) {
spin_lock(&port->lock);
continue;
}
spin_lock(&port->lock); spin_lock(&port->lock);
continue;
} }
spin_lock(&port->lock);
}
#endif #endif
port->icount.rx++; port->icount.rx++;
if (isrstatus & CDNS_UART_IXR_PARITY) {
port->icount.parity++;
status = TTY_PARITY;
} else if (isrstatus & CDNS_UART_IXR_FRAMING) {
port->icount.frame++;
status = TTY_FRAME;
} else if (isrstatus & CDNS_UART_IXR_OVERRUN) {
port->icount.overrun++;
}
uart_insert_char(port, isrstatus, CDNS_UART_IXR_OVERRUN, if (isrstatus & CDNS_UART_IXR_PARITY) {
data, status); port->icount.parity++;
status = TTY_PARITY;
} else if (isrstatus & CDNS_UART_IXR_FRAMING) {
port->icount.frame++;
status = TTY_FRAME;
} else if (isrstatus & CDNS_UART_IXR_OVERRUN) {
port->icount.overrun++;
} }
tty_flip_buffer_push(&port->state->port);
uart_insert_char(port, isrstatus, CDNS_UART_IXR_OVERRUN,
data, status);
} }
tty_flip_buffer_push(&port->state->port);
} }
/** /**
...@@ -1429,27 +1426,30 @@ static int cdns_uart_probe(struct platform_device *pdev) ...@@ -1429,27 +1426,30 @@ static int cdns_uart_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Cannot get uart_port structure\n"); dev_err(&pdev->dev, "Cannot get uart_port structure\n");
rc = -ENODEV; rc = -ENODEV;
goto err_out_notif_unreg; goto err_out_notif_unreg;
} else {
/* Register the port.
* This function also registers this device with the tty layer
* and triggers invocation of the config_port() entry point.
*/
port->mapbase = res->start;
port->irq = irq;
port->dev = &pdev->dev;
port->uartclk = clk_get_rate(cdns_uart_data->uartclk);
port->private_data = cdns_uart_data;
cdns_uart_data->port = port;
platform_set_drvdata(pdev, port);
rc = uart_add_one_port(&cdns_uart_uart_driver, port);
if (rc) {
dev_err(&pdev->dev,
"uart_add_one_port() failed; err=%i\n", rc);
goto err_out_notif_unreg;
}
return 0;
} }
/*
* Register the port.
* This function also registers this device with the tty layer
* and triggers invocation of the config_port() entry point.
*/
port->mapbase = res->start;
port->irq = irq;
port->dev = &pdev->dev;
port->uartclk = clk_get_rate(cdns_uart_data->uartclk);
port->private_data = cdns_uart_data;
cdns_uart_data->port = port;
platform_set_drvdata(pdev, port);
rc = uart_add_one_port(&cdns_uart_uart_driver, port);
if (rc) {
dev_err(&pdev->dev,
"uart_add_one_port() failed; err=%i\n", rc);
goto err_out_notif_unreg;
}
return 0;
err_out_notif_unreg: err_out_notif_unreg:
#ifdef CONFIG_COMMON_CLK #ifdef CONFIG_COMMON_CLK
clk_notifier_unregister(cdns_uart_data->uartclk, clk_notifier_unregister(cdns_uart_data->uartclk,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment