hwmon: (g762) Use of_property_read_u32 at appropriate place
authorAxel Lin <axel.lin@ingics.com>
Fri, 1 Aug 2014 02:07:25 +0000 (10:07 +0800)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 4 Aug 2014 18:35:40 +0000 (11:35 -0700)
Simplify the code a bit and also improve readability.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/g762.c

index 7dbc8c988b59bafcb3dbceb0b53cb3c2662cf92b..6aac695b1688beaf2adc5336bd842bb7993d2d09 100644 (file)
@@ -649,15 +649,12 @@ static int g762_of_prop_import_one(struct i2c_client *client,
                                   int (*psetter)(struct device *dev,
                                                  unsigned long val))
 {
-       const __be32 *prop;
-       int len, ret;
+       int ret;
        u32 pval;
 
-       prop = of_get_property(client->dev.of_node, pname, &len);
-       if (!prop || len != sizeof(u32))
+       if (of_property_read_u32(client->dev.of_node, pname, &pval))
                return 0;
 
-       pval = be32_to_cpu(prop[0]);
        dev_dbg(&client->dev, "found %s (%d)\n", pname, pval);
        ret = (*psetter)(&client->dev, pval);
        if (ret)