Commit 822a729a authored by Rob Herring's avatar Rob Herring Committed by Greg Kroah-Hartman
Browse files

serial: Use of_property_read_bool() for boolean properties



It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties.
Convert reading boolean properties to to of_property_read_bool().

Signed-off-by: default avatarRob Herring <robh@kernel.org>
Acked-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230310144727.1545699-1-robh@kernel.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ef194140
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -2257,20 +2257,16 @@ static int imx_uart_probe(struct platform_device *pdev)
	}
	sport->port.line = ret;

	if (of_get_property(np, "uart-has-rtscts", NULL) ||
	    of_get_property(np, "fsl,uart-has-rtscts", NULL) /* deprecated */)
		sport->have_rtscts = 1;
	sport->have_rtscts = of_property_read_bool(np, "uart-has-rtscts") ||
		of_property_read_bool(np, "fsl,uart-has-rtscts"); /* deprecated */

	if (of_get_property(np, "fsl,dte-mode", NULL))
		sport->dte_mode = 1;
	sport->dte_mode = of_property_read_bool(np, "fsl,dte-mode");

	sport->have_rtsgpio = of_property_present(np, "rts-gpios");

	if (of_get_property(np, "fsl,inverted-tx", NULL))
		sport->inverted_tx = 1;
	sport->inverted_tx = of_property_read_bool(np, "fsl,inverted-tx");

	if (of_get_property(np, "fsl,inverted-rx", NULL))
		sport->inverted_rx = 1;
	sport->inverted_rx = of_property_read_bool(np, "fsl,inverted-rx");

	if (!of_property_read_u32_array(np, "fsl,dma-info", dma_buf_conf, 2)) {
		sport->rx_period_length = dma_buf_conf[0];
+2 −2
Original line number Diff line number Diff line
@@ -1587,8 +1587,8 @@ static int mxs_auart_probe(struct platform_device *pdev)
	}
	s->port.line = ret;

	if (of_get_property(np, "uart-has-rtscts", NULL) ||
	    of_get_property(np, "fsl,uart-has-rtscts", NULL) /* deprecated */)
	if (of_property_read_bool(np, "uart-has-rtscts") ||
	    of_property_read_bool(np, "fsl,uart-has-rtscts") /* deprecated */)
		set_bit(MXS_AUART_RTSCTS, &s->flags);

	if (s->port.line >= ARRAY_SIZE(auart_port)) {
+1 −1
Original line number Diff line number Diff line
@@ -1179,7 +1179,7 @@ static int soft_uart_init(struct platform_device *ofdev)
	struct qe_firmware_info *qe_fw_info;
	int ret;

	if (of_find_property(np, "soft-uart", NULL)) {
	if (of_property_read_bool(np, "soft-uart")) {
		dev_dbg(&ofdev->dev, "using Soft-UART mode\n");
		soft_uart = 1;
	} else {