Skip to content

Commit ac753e1

Browse files
robherringgregkh
authored andcommitted
tty: atmel_serial: Use of_property_present() for non-boolean properties
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) <[email protected]> Acked-by: Richard Genoud <[email protected]> Reviewed-by: Nicolas Ferre <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 104c1b9 commit ac753e1

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

drivers/tty/serial/atmel_serial.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,26 +1727,16 @@ static void atmel_init_property(struct atmel_uart_port *atmel_port,
17271727

17281728
/* DMA/PDC usage specification */
17291729
if (of_property_read_bool(np, "atmel,use-dma-rx")) {
1730-
if (of_property_read_bool(np, "dmas")) {
1731-
atmel_port->use_dma_rx = true;
1732-
atmel_port->use_pdc_rx = false;
1733-
} else {
1734-
atmel_port->use_dma_rx = false;
1735-
atmel_port->use_pdc_rx = true;
1736-
}
1730+
atmel_port->use_dma_rx = of_property_present(np, "dmas");
1731+
atmel_port->use_pdc_rx = !atmel_port->use_dma_rx;
17371732
} else {
17381733
atmel_port->use_dma_rx = false;
17391734
atmel_port->use_pdc_rx = false;
17401735
}
17411736

17421737
if (of_property_read_bool(np, "atmel,use-dma-tx")) {
1743-
if (of_property_read_bool(np, "dmas")) {
1744-
atmel_port->use_dma_tx = true;
1745-
atmel_port->use_pdc_tx = false;
1746-
} else {
1747-
atmel_port->use_dma_tx = false;
1748-
atmel_port->use_pdc_tx = true;
1749-
}
1738+
atmel_port->use_dma_tx = of_property_present(np, "dmas");
1739+
atmel_port->use_pdc_tx = !atmel_port->use_dma_tx;
17501740
} else {
17511741
atmel_port->use_dma_tx = false;
17521742
atmel_port->use_pdc_tx = false;

0 commit comments

Comments
 (0)