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,9 +202,9 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus) ...@@ -202,9 +202,9 @@ 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;
...@@ -213,8 +213,7 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus) ...@@ -213,8 +213,7 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus)
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))
...@@ -228,8 +227,7 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus) ...@@ -228,8 +227,7 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus)
*/ */
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); spin_lock(&port->lock);
continue; continue;
} }
...@@ -253,7 +251,6 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus) ...@@ -253,7 +251,6 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus)
data, status); data, status);
} }
tty_flip_buffer_push(&port->state->port); tty_flip_buffer_push(&port->state->port);
}
} }
/** /**
...@@ -1429,8 +1426,10 @@ static int cdns_uart_probe(struct platform_device *pdev) ...@@ -1429,8 +1426,10 @@ 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.
/*
* Register the port.
* This function also registers this device with the tty layer * This function also registers this device with the tty layer
* and triggers invocation of the config_port() entry point. * and triggers invocation of the config_port() entry point.
*/ */
...@@ -1441,14 +1440,15 @@ static int cdns_uart_probe(struct platform_device *pdev) ...@@ -1441,14 +1440,15 @@ static int cdns_uart_probe(struct platform_device *pdev)
port->private_data = cdns_uart_data; port->private_data = cdns_uart_data;
cdns_uart_data->port = port; cdns_uart_data->port = port;
platform_set_drvdata(pdev, port); platform_set_drvdata(pdev, port);
rc = uart_add_one_port(&cdns_uart_uart_driver, port); rc = uart_add_one_port(&cdns_uart_uart_driver, port);
if (rc) { if (rc) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"uart_add_one_port() failed; err=%i\n", rc); "uart_add_one_port() failed; err=%i\n", rc);
goto err_out_notif_unreg; goto err_out_notif_unreg;
} }
return 0; return 0;
}
err_out_notif_unreg: err_out_notif_unreg:
#ifdef CONFIG_COMMON_CLK #ifdef CONFIG_COMMON_CLK
......
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