Skip to content

Commit fce9626

Browse files
AxelLingroeck
authored andcommitted
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>
1 parent cc33654 commit fce9626

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎drivers/hwmon/g762.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -649,15 +649,12 @@ static int g762_of_prop_import_one(struct i2c_client *client,
649649
int (*psetter)(struct device *dev,
650650
unsigned long val))
651651
{
652-
const __be32 *prop;
653-
int len, ret;
652+
int ret;
654653
u32 pval;
655654

656-
prop = of_get_property(client->dev.of_node, pname, &len);
657-
if (!prop || len != sizeof(u32))
655+
if (of_property_read_u32(client->dev.of_node, pname, &pval))
658656
return 0;
659657

660-
pval = be32_to_cpu(prop[0]);
661658
dev_dbg(&client->dev, "found %s (%d)\n", pname, pval);
662659
ret = (*psetter)(&client->dev, pval);
663660
if (ret)

0 commit comments

Comments
 (0)