i2c: Use of_property_read_bool() for boolean properties
authorRob Herring <robh@kernel.org>
Fri, 10 Mar 2023 14:47:07 +0000 (08:47 -0600)
committerWolfram Sang <wsa@kernel.org>
Thu, 16 Mar 2023 19:20:00 +0000 (20:20 +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>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-mpc.c
drivers/i2c/busses/i2c-pxa.c
drivers/i2c/i2c-core-of.c

index 81ac92bb4f6f1956d7651a7cf16edf2010d95047..bec0c5dc20d163c06453181e7d9a70ddae2bc3cb 100644 (file)
@@ -842,7 +842,7 @@ static int fsl_i2c_probe(struct platform_device *op)
                data->setup(op->dev.of_node, i2c, clock);
        } else {
                /* Backwards compatibility */
-               if (of_get_property(op->dev.of_node, "dfsrr", NULL))
+               if (of_property_read_bool(op->dev.of_node, "dfsrr"))
                        mpc_i2c_setup_8xxx(op->dev.of_node, i2c, clock);
        }
 
index b605b6e43cb90f360955ba331b316533c54fd954..f9fa5308556b77f4b89e8e31d8c5af5519b2ee1d 100644 (file)
@@ -1261,10 +1261,8 @@ static int i2c_pxa_probe_dt(struct platform_device *pdev, struct pxa_i2c *i2c,
        /* For device tree we always use the dynamic or alias-assigned ID */
        i2c->adap.nr = -1;
 
-       if (of_get_property(np, "mrvl,i2c-polling", NULL))
-               i2c->use_pio = 1;
-       if (of_get_property(np, "mrvl,i2c-fast-mode", NULL))
-               i2c->fast_mode = 1;
+       i2c->use_pio = of_property_read_bool(np, "mrvl,i2c-polling");
+       i2c->fast_mode = of_property_read_bool(np, "mrvl,i2c-fast-mode");
 
        *i2c_types = (enum pxa_i2c_types)(of_id->data);
 
index bce6b796e04c2ca0523bf1fc83117b13b4bc2c43..aa93467784c29c895c598edc25bf26ea255a605d 100644 (file)
@@ -55,7 +55,7 @@ int of_i2c_get_board_info(struct device *dev, struct device_node *node,
        if (of_property_read_bool(node, "host-notify"))
                info->flags |= I2C_CLIENT_HOST_NOTIFY;
 
-       if (of_get_property(node, "wakeup-source", NULL))
+       if (of_property_read_bool(node, "wakeup-source"))
                info->flags |= I2C_CLIENT_WAKE;
 
        return 0;