From nobody Tue Dec 16 23:57:31 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0962AC10DC3 for ; Thu, 7 Dec 2023 17:56:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443660AbjLGR4i (ORCPT ); Thu, 7 Dec 2023 12:56:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443596AbjLGR42 (ORCPT ); Thu, 7 Dec 2023 12:56:28 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B1E81712; Thu, 7 Dec 2023 09:56:33 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 658EBE000C; Thu, 7 Dec 2023 17:56:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701971791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cdalrHLUQP6uwbcSVcLW5+uO51pc2/mjYf1/i0LTryE=; b=p7KtFQYr1rF6N0LroqJ2zR+gxG6uEp5obi12Yn3TfptVF91M3etUe4qgCM094mQcdgAwW4 NBTGAUu0jsuTegOmjJJXBkG3i0lCiIKyAXMxOOCkZmf75gwE5bYfAahuZaWjdM71XV6bVE CEZJGrgWFekjXCYzB/wZQnSHL35NXV+HPAsJq3m/dCU/tLsrwK6p7RcZEl0Qa9lalFLqGQ J7WV5yjagT89BzjH1UTGajL4iShmqnm6gWYFkjL+7Uq8F0Lty8MPEhH/PHecxdqnzhhIGS fR2wyexsnH2JLRZRbdvhuMl6wwDZOYrHGARtUBmH18PdIIYYHVCfahGyG2WNGw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Thu, 07 Dec 2023 18:56:10 +0100 Subject: [PATCH v6 5/8] tty: serial: amba-pl011: fix formatting of conditions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20231207-mbly-uart-v6-5-e384afa5e78c@bootlin.com> References: <20231207-mbly-uart-v6-0-e384afa5e78c@bootlin.com> In-Reply-To: <20231207-mbly-uart-v6-0-e384afa5e78c@bootlin.com> To: Russell King , Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Linus Walleij , =?utf-8?q?Gr=C3=A9gory_Clement?= , Alexandre Belloni , Thomas Petazzoni , Vladimir Kondratiev , Tawfik Bayouk , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.12.4 X-GND-Sasl: theo.lebrun@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Linus Walleij Signed-off-by: Th=C3=A9o Lebrun --- drivers/tty/serial/amba-pl011.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl01= 1.c index be8888db1a37..3c657bac2359 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -330,10 +330,11 @@ static int pl011_fifo_to_tty(struct uart_amba_port *u= ap) uap->port.icount.brk++; if (uart_handle_break(&uap->port)) continue; - } else if (ch & UART011_DR_PE) + } else if (ch & UART011_DR_PE) { uap->port.icount.parity++; - else if (ch & UART011_DR_FE) + } else if (ch & UART011_DR_FE) { uap->port.icount.frame++; + } if (ch & UART011_DR_OE) uap->port.icount.overrun++; =20 @@ -464,7 +465,7 @@ static void pl011_dma_probe(struct uart_amba_port *uap) * If the controller does, check for suitable residue processing * otherwise assime all is well. */ - if (0 =3D=3D dma_get_slave_caps(chan, &caps)) { + if (dma_get_slave_caps(chan, &caps) =3D=3D 0) { if (caps.residue_granularity =3D=3D DMA_RESIDUE_GRANULARITY_DESCRIPTOR) { dma_release_channel(chan); @@ -503,11 +504,11 @@ static void pl011_dma_probe(struct uart_amba_port *ua= p) if (uap->dmarx.auto_poll_rate) { u32 x; =20 - if (0 =3D=3D of_property_read_u32(dev->of_node, "poll-rate-ms", &x)) + if (of_property_read_u32(dev->of_node, "poll-rate-ms", &x) =3D=3D 0) uap->dmarx.poll_rate =3D x; else uap->dmarx.poll_rate =3D 100; - if (0 =3D=3D of_property_read_u32(dev->of_node, "poll-timeout-ms", &x)) + if (of_property_read_u32(dev->of_node, "poll-timeout-ms", &x) =3D=3D 0) uap->dmarx.poll_timeout =3D x; else uap->dmarx.poll_timeout =3D 3000; @@ -615,9 +616,9 @@ static int pl011_dma_tx_refill(struct uart_amba_port *u= ap) if (count > PL011_DMA_BUFFER_SIZE) count =3D PL011_DMA_BUFFER_SIZE; =20 - if (xmit->tail < xmit->head) + if (xmit->tail < xmit->head) { memcpy(&dmatx->buf[0], &xmit->buf[xmit->tail], count); - else { + } else { size_t first =3D UART_XMIT_SIZE - xmit->tail; size_t second; =20 @@ -751,8 +752,9 @@ static inline bool pl011_dma_tx_start(struct uart_amba_= port *uap) if (pl011_dma_tx_refill(uap) > 0) { uap->im &=3D ~UART011_TXIM; pl011_write(uap->im, uap, REG_IMSC); - } else + } else { ret =3D false; + } } else if (!(uap->dmacr & UART011_TXDMAE)) { uap->dmacr |=3D UART011_TXDMAE; pl011_write(uap->dmacr, uap, REG_DMACR); @@ -2139,9 +2141,9 @@ pl011_set_termios(struct uart_port *port, struct kter= mios *termios, * else we see data corruption. */ if (uap->vendor->oversampling) { - if ((baud >=3D 3000000) && (baud < 3250000) && (quot > 1)) + if (baud >=3D 3000000 && baud < 3250000 && quot > 1) quot -=3D 1; - else if ((baud > 3250000) && (quot > 2)) + else if (baud > 3250000 && quot > 2) quot -=3D 2; } /* Set baud rate */ @@ -2668,7 +2670,7 @@ static int pl011_probe_dt_alias(int index, struct dev= ice *dev) ret =3D index; } else { seen_dev_with_alias =3D true; - if (ret >=3D ARRAY_SIZE(amba_ports) || amba_ports[ret] !=3D NULL) { + if (ret >=3D ARRAY_SIZE(amba_ports) || amba_ports[ret]) { dev_warn(dev, "requested serial port %d not available.\n", ret); ret =3D index; } @@ -2702,7 +2704,7 @@ static int pl011_find_free_port(void) int i; =20 for (i =3D 0; i < ARRAY_SIZE(amba_ports); i++) - if (amba_ports[i] =3D=3D NULL) + if (!amba_ports[i]) return i; =20 return -EBUSY; --=20 2.43.0