[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <baf1d437-917b-4fe6-bab8-65dfb3ac1e6a@bootlin.com>
Date: Fri, 10 Jan 2025 09:13:07 +0100
From: Richard GENOUD <richard.genoud@...tlin.com>
To: "Rob Herring (Arm)" <robh@...nel.org>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 Jiri Slaby <jirislaby@...nel.org>,
 Nicolas Ferre <nicolas.ferre@...rochip.com>,
 Alexandre Belloni <alexandre.belloni@...tlin.com>,
 Claudiu Beznea <claudiu.beznea@...on.dev>
Cc: linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] tty: atmel_serial: Use of_property_present() for
 non-boolean properties
Le 09/01/2025 à 19:20, Rob Herring (Arm) a écrit :
> The use of of_property_read_bool() for non-boolean properties is
> deprecated in favor of of_property_present() when testing for property
> presence.
> 
> As of_property_present() returns a boolean, use that directly
> and simplify the code a bit while we're here.
> 
> Signed-off-by: Rob Herring (Arm) <robh@...nel.org>
> ---
>   drivers/tty/serial/atmel_serial.c | 18 ++++--------------
>   1 file changed, 4 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 0cf05ac18993..f44f9d20a974 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -1727,26 +1727,16 @@ static void atmel_init_property(struct atmel_uart_port *atmel_port,
>   
>   	/* DMA/PDC usage specification */
>   	if (of_property_read_bool(np, "atmel,use-dma-rx")) {
> -		if (of_property_read_bool(np, "dmas")) {
> -			atmel_port->use_dma_rx  = true;
> -			atmel_port->use_pdc_rx  = false;
> -		} else {
> -			atmel_port->use_dma_rx  = false;
> -			atmel_port->use_pdc_rx  = true;
> -		}
> +		atmel_port->use_dma_rx = of_property_present(np, "dmas");
> +		atmel_port->use_pdc_rx = !atmel_port->use_dma_rx;
>   	} else {
>   		atmel_port->use_dma_rx  = false;
>   		atmel_port->use_pdc_rx  = false;
>   	}
>   
>   	if (of_property_read_bool(np, "atmel,use-dma-tx")) {
> -		if (of_property_read_bool(np, "dmas")) {
> -			atmel_port->use_dma_tx  = true;
> -			atmel_port->use_pdc_tx  = false;
> -		} else {
> -			atmel_port->use_dma_tx  = false;
> -			atmel_port->use_pdc_tx  = true;
> -		}
> +		atmel_port->use_dma_tx = of_property_present(np, "dmas");
> +		atmel_port->use_pdc_tx = !atmel_port->use_dma_tx;
>   	} else {
>   		atmel_port->use_dma_tx  = false;
>   		atmel_port->use_pdc_tx  = false;
Acked-by: Richard Genoud <richard.genoud@...tlin.com>
The code is indeed nicer like that!
Thanks!
Regards,
Richard
Powered by blists - more mailing lists
 
