From ef194140308776be60dd4601bd01c00c84fb8b39 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Fri, 10 Mar 2023 08:47:26 -0600 Subject: [PATCH] serial: Use of_property_present() for testing DT property presence MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It is preferred to use typed property access functions (i.e. of_property_read_ functions) rather than low-level of_get_property/of_find_property functions for reading properties. As part of this, convert of_get_property/of_find_property calls to the recently added of_property_present() helper when we just want to test for presence of a property and nothing more. Signed-off-by: Rob Herring Acked-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230310144727.1545630-1-robh@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/imx.c | 3 +-- drivers/tty/serial/sh-sci.c | 2 +- drivers/tty/serial/sunzilog.c | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 84bc0e7..4d389e2 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2264,8 +2264,7 @@ static int imx_uart_probe(struct platform_device *pdev) if (of_get_property(np, "fsl,dte-mode", NULL)) sport->dte_mode = 1; - if (of_get_property(np, "rts-gpios", NULL)) - sport->have_rtsgpio = 1; + sport->have_rtsgpio = of_property_present(np, "rts-gpios"); if (of_get_property(np, "fsl,inverted-tx", NULL)) sport->inverted_tx = 1; diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 7bd0807..a3e12e9 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1573,7 +1573,7 @@ static void sci_request_dma(struct uart_port *port) * Don't request a dma channel if no channel was specified * in the device tree. */ - if (!of_find_property(port->dev->of_node, "dmas", NULL)) + if (!of_property_present(port->dev->of_node, "dmas")) return; chan = sci_request_dma_chan(port, DMA_MEM_TO_DEV); diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index ccb8092..0fbeb3d 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c @@ -1403,7 +1403,7 @@ static int zs_probe(struct platform_device *op) int keyboard_mouse = 0; int err; - if (of_find_property(op->dev.of_node, "keyboard", NULL)) + if (of_property_present(op->dev.of_node, "keyboard")) keyboard_mouse = 1; /* uarts must come before keyboards/mice */ @@ -1553,7 +1553,7 @@ static int __init sunzilog_init(void) for_each_node_by_name(dp, "zs") { num_sunzilog++; - if (of_find_property(dp, "keyboard", NULL)) + if (of_property_present(dp, "keyboard")) num_keybms++; } -- 2.7.4