mfd: various: Use of_property_read_bool() for boolean properties
authorRob Herring <robh@kernel.org>
Fri, 10 Mar 2023 14:47:12 +0000 (08:47 -0600)
committerLee Jones <lee@kernel.org>
Wed, 26 Apr 2023 10:40:32 +0000 (11:40 +0100)
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>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230310144712.1543449-1-robh@kernel.org
drivers/mfd/88pm860x-core.c
drivers/mfd/wm8994-core.c

index 3c57e537d57fb80d88f56075560e8e19b5d482df..aabac37c35025688993fc4886a88164a122f7b14 100644 (file)
@@ -1117,8 +1117,7 @@ static int pm860x_dt_init(struct device_node *np,
 {
        int ret;
 
-       if (of_get_property(np, "marvell,88pm860x-irq-read-clr", NULL))
-               pdata->irq_mode = 1;
+       pdata->irq_mode = of_property_read_bool(np, "marvell,88pm860x-irq-read-clr");
        ret = of_property_read_u32(np, "marvell,88pm860x-slave-addr",
                                   &pdata->companion_addr);
        if (ret) {
index a89221bffde5a877275c6a0418d9bebfe218a16f..c419ab0c0eae75e9e4105b609d9ce82c7a7b313f 100644 (file)
@@ -279,20 +279,11 @@ static int wm8994_set_pdata_from_of(struct wm8994 *wm8994)
        of_property_read_u32_array(np, "wlf,micbias-cfg", pdata->micbias,
                                   ARRAY_SIZE(pdata->micbias));
 
-       pdata->lineout1_diff = true;
-       pdata->lineout2_diff = true;
-       if (of_find_property(np, "wlf,lineout1-se", NULL))
-               pdata->lineout1_diff = false;
-       if (of_find_property(np, "wlf,lineout2-se", NULL))
-               pdata->lineout2_diff = false;
-
-       if (of_find_property(np, "wlf,lineout1-feedback", NULL))
-               pdata->lineout1fb = true;
-       if (of_find_property(np, "wlf,lineout2-feedback", NULL))
-               pdata->lineout2fb = true;
-
-       if (of_find_property(np, "wlf,ldoena-always-driven", NULL))
-               pdata->lineout2fb = true;
+       pdata->lineout1_diff = !of_property_read_bool(np, "wlf,lineout1-se");
+       pdata->lineout2_diff = !of_property_read_bool(np, "wlf,lineout2-se");
+       pdata->lineout1fb = of_property_read_bool(np, "wlf,lineout1-feedback");
+       pdata->lineout2fb = of_property_read_bool(np, "wlf,lineout2-feedback") ||
+               of_property_read_bool(np, "wlf,ldoena-always-driven");
 
        pdata->spkmode_pu = of_property_read_bool(np, "wlf,spkmode-pu");