Skip to content

Commit

Permalink
hwmon: (g762) Use of_property_read_u32 at appropriate place
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Axel Lin authored and Guenter Roeck committed Aug 4, 2014
1 parent cc33654 commit fce9626
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/hwmon/g762.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fce9626

Please sign in to comment.