Commit fce9626c authored by Axel Lin's avatar Axel Lin Committed by Guenter Roeck

hwmon: (g762) Use of_property_read_u32 at appropriate place

Simplify the code a bit and also improve readability.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent cc336546
...@@ -649,15 +649,12 @@ static int g762_of_prop_import_one(struct i2c_client *client, ...@@ -649,15 +649,12 @@ static int g762_of_prop_import_one(struct i2c_client *client,
int (*psetter)(struct device *dev, int (*psetter)(struct device *dev,
unsigned long val)) unsigned long val))
{ {
const __be32 *prop; int ret;
int len, ret;
u32 pval; u32 pval;
prop = of_get_property(client->dev.of_node, pname, &len); if (of_property_read_u32(client->dev.of_node, pname, &pval))
if (!prop || len != sizeof(u32))
return 0; return 0;
pval = be32_to_cpu(prop[0]);
dev_dbg(&client->dev, "found %s (%d)\n", pname, pval); dev_dbg(&client->dev, "found %s (%d)\n", pname, pval);
ret = (*psetter)(&client->dev, pval); ret = (*psetter)(&client->dev, pval);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment