Commit 28a7ec8c authored by Théo Lebrun's avatar Théo Lebrun Committed by Greg Kroah-Hartman

tty: serial: amba-pl011: fix formatting of conditions

Fix the following checkpatch warnings & checks:

	$ ./scripts/checkpatch.pl --strict --file \
        drivers/tty/serial/amba-pl011.c

    CHECK: Unbalanced braces around else statement
    CHECK: Unnecessary parentheses around '[...]'
    CHECK: braces {} should be used on all arms of this statement
    CHECK: Comparison to NULL could be written "[...]"
    WARNING: Comparisons should place the constant on the right side of the test
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarThéo Lebrun <theo.lebrun@bootlin.com>
Link: https://lore.kernel.org/r/20231207-mbly-uart-v6-5-e384afa5e78c@bootlin.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fd64ff09
...@@ -330,10 +330,11 @@ static int pl011_fifo_to_tty(struct uart_amba_port *uap) ...@@ -330,10 +330,11 @@ static int pl011_fifo_to_tty(struct uart_amba_port *uap)
uap->port.icount.brk++; uap->port.icount.brk++;
if (uart_handle_break(&uap->port)) if (uart_handle_break(&uap->port))
continue; continue;
} else if (ch & UART011_DR_PE) } else if (ch & UART011_DR_PE) {
uap->port.icount.parity++; uap->port.icount.parity++;
else if (ch & UART011_DR_FE) } else if (ch & UART011_DR_FE) {
uap->port.icount.frame++; uap->port.icount.frame++;
}
if (ch & UART011_DR_OE) if (ch & UART011_DR_OE)
uap->port.icount.overrun++; uap->port.icount.overrun++;
...@@ -464,7 +465,7 @@ static void pl011_dma_probe(struct uart_amba_port *uap) ...@@ -464,7 +465,7 @@ static void pl011_dma_probe(struct uart_amba_port *uap)
* If the controller does, check for suitable residue processing * If the controller does, check for suitable residue processing
* otherwise assime all is well. * otherwise assime all is well.
*/ */
if (0 == dma_get_slave_caps(chan, &caps)) { if (dma_get_slave_caps(chan, &caps) == 0) {
if (caps.residue_granularity == if (caps.residue_granularity ==
DMA_RESIDUE_GRANULARITY_DESCRIPTOR) { DMA_RESIDUE_GRANULARITY_DESCRIPTOR) {
dma_release_channel(chan); dma_release_channel(chan);
...@@ -503,11 +504,11 @@ static void pl011_dma_probe(struct uart_amba_port *uap) ...@@ -503,11 +504,11 @@ static void pl011_dma_probe(struct uart_amba_port *uap)
if (uap->dmarx.auto_poll_rate) { if (uap->dmarx.auto_poll_rate) {
u32 x; u32 x;
if (0 == of_property_read_u32(dev->of_node, "poll-rate-ms", &x)) if (of_property_read_u32(dev->of_node, "poll-rate-ms", &x) == 0)
uap->dmarx.poll_rate = x; uap->dmarx.poll_rate = x;
else else
uap->dmarx.poll_rate = 100; uap->dmarx.poll_rate = 100;
if (0 == of_property_read_u32(dev->of_node, "poll-timeout-ms", &x)) if (of_property_read_u32(dev->of_node, "poll-timeout-ms", &x) == 0)
uap->dmarx.poll_timeout = x; uap->dmarx.poll_timeout = x;
else else
uap->dmarx.poll_timeout = 3000; uap->dmarx.poll_timeout = 3000;
...@@ -615,9 +616,9 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap) ...@@ -615,9 +616,9 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
if (count > PL011_DMA_BUFFER_SIZE) if (count > PL011_DMA_BUFFER_SIZE)
count = PL011_DMA_BUFFER_SIZE; count = PL011_DMA_BUFFER_SIZE;
if (xmit->tail < xmit->head) if (xmit->tail < xmit->head) {
memcpy(&dmatx->buf[0], &xmit->buf[xmit->tail], count); memcpy(&dmatx->buf[0], &xmit->buf[xmit->tail], count);
else { } else {
size_t first = UART_XMIT_SIZE - xmit->tail; size_t first = UART_XMIT_SIZE - xmit->tail;
size_t second; size_t second;
...@@ -751,8 +752,9 @@ static inline bool pl011_dma_tx_start(struct uart_amba_port *uap) ...@@ -751,8 +752,9 @@ static inline bool pl011_dma_tx_start(struct uart_amba_port *uap)
if (pl011_dma_tx_refill(uap) > 0) { if (pl011_dma_tx_refill(uap) > 0) {
uap->im &= ~UART011_TXIM; uap->im &= ~UART011_TXIM;
pl011_write(uap->im, uap, REG_IMSC); pl011_write(uap->im, uap, REG_IMSC);
} else } else {
ret = false; ret = false;
}
} else if (!(uap->dmacr & UART011_TXDMAE)) { } else if (!(uap->dmacr & UART011_TXDMAE)) {
uap->dmacr |= UART011_TXDMAE; uap->dmacr |= UART011_TXDMAE;
pl011_write(uap->dmacr, uap, REG_DMACR); pl011_write(uap->dmacr, uap, REG_DMACR);
...@@ -2139,9 +2141,9 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -2139,9 +2141,9 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,
* else we see data corruption. * else we see data corruption.
*/ */
if (uap->vendor->oversampling) { if (uap->vendor->oversampling) {
if ((baud >= 3000000) && (baud < 3250000) && (quot > 1)) if (baud >= 3000000 && baud < 3250000 && quot > 1)
quot -= 1; quot -= 1;
else if ((baud > 3250000) && (quot > 2)) else if (baud > 3250000 && quot > 2)
quot -= 2; quot -= 2;
} }
/* Set baud rate */ /* Set baud rate */
...@@ -2668,7 +2670,7 @@ static int pl011_probe_dt_alias(int index, struct device *dev) ...@@ -2668,7 +2670,7 @@ static int pl011_probe_dt_alias(int index, struct device *dev)
ret = index; ret = index;
} else { } else {
seen_dev_with_alias = true; seen_dev_with_alias = true;
if (ret >= ARRAY_SIZE(amba_ports) || amba_ports[ret] != NULL) { if (ret >= ARRAY_SIZE(amba_ports) || amba_ports[ret]) {
dev_warn(dev, "requested serial port %d not available.\n", ret); dev_warn(dev, "requested serial port %d not available.\n", ret);
ret = index; ret = index;
} }
...@@ -2702,7 +2704,7 @@ static int pl011_find_free_port(void) ...@@ -2702,7 +2704,7 @@ static int pl011_find_free_port(void)
int i; int i;
for (i = 0; i < ARRAY_SIZE(amba_ports); i++) for (i = 0; i < ARRAY_SIZE(amba_ports); i++)
if (amba_ports[i] == NULL) if (!amba_ports[i])
return i; return i;
return -EBUSY; return -EBUSY;
......
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