]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tty: atmel_serial: Use of_property_present() for non-boolean properties
authorRob Herring (Arm) <robh@kernel.org>
Thu, 9 Jan 2025 18:20:52 +0000 (12:20 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Jan 2025 15:07:50 +0000 (16:07 +0100)
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@kernel.org>
Acked-by: Richard Genoud <richard.genoud@bootlin.com>
Reviewed-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Link: https://lore.kernel.org/r/20250109182053.3970547-1-robh@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/atmel_serial.c

index 0cf05ac189938306f0374bb650ca8d3d45d4913d..f44f9d20a97440c9aea41e9ebe34c34d4dfa0a1c 100644 (file)
@@ -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;