Skip to contentSkip to conversation

hwmon: (g762) Use of_property_read_u32 at appropriate place

PATCH Applied Axel Lin 2 participants 2 messages Aug 1, 2014 – Aug 4, 2014 Hardware monitoring

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 hwmon: (g762) Use of_property_read_u32 at appropriate place

Simplify the code a bit and also improve readability.

---
 drivers/hwmon/g762.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/hwmon/g762.c +2 -5
index 7dbc8c9..6aac695 100644
@@ -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)
Signature · 9 lines
1.9.1




_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors