Re: [PATCH v2 2/5] tty: serial: amba: Use BIT() macro for constant declarations

From: Ilpo Järvinen
Date: Thu Nov 16 2023 - 06:55:33 EST


On Thu, 16 Nov 2023, Théo Lebrun wrote:

> The driver uses bit shifts and hexadecimal expressions to declare
> constants. Replace that with the BIT() macro that clarifies intent.
>
> Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> Signed-off-by: Théo Lebrun <theo.lebrun@xxxxxxxxxxx>

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>

> ---
> include/linux/amba/serial.h | 183 ++++++++++++++++++++++----------------------
> 1 file changed, 92 insertions(+), 91 deletions(-)
>
> diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
> index 27003ec52114..a1f966fcb9c5 100644
> --- a/include/linux/amba/serial.h
> +++ b/include/linux/amba/serial.h
> @@ -10,6 +10,7 @@

> #define ST_UART011_DMAWM_RX_1 (0 << 3)
> #define ST_UART011_DMAWM_RX_2 (1 << 3)

Just noting a potential futurework item, these (and alike) could be
changed to:

#define ST_UART011_DMAWM_RX GENMASK(5, 3)
#define ST_UART011_DMAWM_TX GENMASK(2, 0)

#define ST_UART011_DMAWM_RX_1 FIELD_PREP(ST_UART011_DMAWM_RX, 0)
#define ST_UART011_DMAWM_RX_2 FIELD_PREP(ST_UART011_DMAWM_RX, 1)
...


--
i.