Re: [PATCH] net: Use of_property_read_bool() for boolean properties

From: Nicolas Ferre
Date: Mon Mar 13 2023 - 05:10:54 EST


On 10/03/2023 at 15:47, Rob Herring wrote:
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

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: Rob Herring <robh@xxxxxxxxxx>
---
drivers/net/can/cc770/cc770_platform.c | 12 ++++++------
drivers/net/ethernet/cadence/macb_main.c | 2 +-

Acked-by: Nicolas Ferre <nicolas.ferre@xxxxxxxxxxxxx>

drivers/net/ethernet/davicom/dm9000.c | 4 ++--

[..]

--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4990,7 +4990,7 @@ static int macb_probe(struct platform_device *pdev)
bp->jumbo_max_len = macb_config->jumbo_max_len;

bp->wol = 0;
- if (of_get_property(np, "magic-packet", NULL))
+ if (of_property_read_bool(np, "magic-packet"))
bp->wol |= MACB_WOL_HAS_MAGIC_PACKET;
device_set_wakeup_capable(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET);

[..]

--
Nicolas Ferre