diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-08-01 10:07:25 +0800 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2014-08-04 11:35:40 -0700 |
commit | fce9626cd93abaf1ef21b361f8a0fa493cc855b2 (patch) | |
tree | 34287fce2df412676535300c317e62db6204eaeb /drivers/hwmon | |
parent | cc336546ddca8c22de83720632431c16a5f9fe9a (diff) | |
download | linux-fce9626cd93abaf1ef21b361f8a0fa493cc855b2.tar.gz linux-fce9626cd93abaf1ef21b361f8a0fa493cc855b2.tar.bz2 linux-fce9626cd93abaf1ef21b361f8a0fa493cc855b2.zip |
hwmon: (g762) Use of_property_read_u32 at appropriate place
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>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/g762.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/hwmon/g762.c b/drivers/hwmon/g762.c index 7dbc8c988b59..6aac695b1688 100644 --- a/drivers/hwmon/g762.c +++ b/drivers/hwmon/g762.c @@ -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) |