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

From
Nicolas Ferre <nicolas.ferre@microchip.com>
Date
2023-03-13 09:10:54
Also in
linux-arm-kernel, linux-can, linux-omap, linux-wireless, linuxppc-dev, lkml, netdev
Reply to
Rob Herring, 2023-03-10
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@kernel.org>
---
  drivers/net/can/cc770/cc770_platform.c          | 12 ++++++------
  drivers/net/ethernet/cadence/macb_main.c        |  2 +-
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
  drivers/net/ethernet/davicom/dm9000.c           |  4 ++--
[..]
quoted hunk ↗ jump to hunk
--- 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
Thread (8 messages) 8 messages, 6 authors, last reply 2023-03-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help