linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Ferre <nicolas.ferre@microchip.com>
To: "Rob Herring (Arm)" <robh@kernel.org>,
	Richard Genoud <richard.genoud@bootlin.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: <linux-kernel@vger.kernel.org>, <linux-serial@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] tty: atmel_serial: Use of_property_present() for non-boolean properties
Date: Fri, 10 Jan 2025 10:32:46 +0100	[thread overview]
Message-ID: <d6449ca2-8d68-4007-805d-0f71d2cea681@microchip.com> (raw)
In-Reply-To: <20250109182053.3970547-1-robh@kernel.org>

On 09/01/2025 at 19:20, Rob Herring (Arm) wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> 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.

Indeed! Thanks Rob.

Reviewed-by: Nicolas Ferre <nicolas.ferre@microchip.com>


> Signed-off-by: Rob Herring (Arm) <robh@kernel.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;
> --
> 2.45.2
> 



      parent reply	other threads:[~2025-01-10  9:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 18:20 [PATCH] tty: atmel_serial: Use of_property_present() for non-boolean properties Rob Herring (Arm)
2025-01-10  8:13 ` Richard GENOUD
2025-01-10  9:32 ` Nicolas Ferre [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6449ca2-8d68-4007-805d-0f71d2cea681@microchip.com \
    --to=nicolas.ferre@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=richard.genoud@bootlin.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).