summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-08-01 12:38:47 +0800
committerGuenter Roeck <linux@roeck-us.net>2014-08-04 07:03:05 -0700
commit18d03f3cbd229ad9b03e12335ea066461fc00c73 (patch)
treeb37bbbb3e73aa3b559987c3b557ffe284e738c03 /drivers/hwmon
parent746f68841a530ea0b6fd8f2ec92815ff087b962c (diff)
hwmon: (ibmpowernv) 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> Tested-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/ibmpowernv.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
index e6b652a3581..d2bf2c97ae7 100644
--- a/drivers/hwmon/ibmpowernv.c
+++ b/drivers/hwmon/ibmpowernv.c
@@ -227,7 +227,7 @@ static int __init create_device_attrs(struct platform_device *pdev)
const struct attribute_group **pgroups = pdata->attr_groups;
struct device_node *opal, *np;
struct sensor_data *sdata;
- const __be32 *sensor_id;
+ u32 sensor_id;
enum sensors type;
u32 count = 0;
int err = 0;
@@ -252,15 +252,14 @@ static int __init create_device_attrs(struct platform_device *pdev)
if (type == MAX_SENSOR_TYPE)
continue;
- sensor_id = of_get_property(np, "sensor-id", NULL);
- if (!sensor_id) {
+ if (of_property_read_u32(np, "sensor-id", &sensor_id)) {
dev_info(&pdev->dev,
"'sensor-id' missing in the node '%s'\n",
np->name);
continue;
}
- sdata[count].id = be32_to_cpup(sensor_id);
+ sdata[count].id = sensor_id;
sdata[count].type = type;
err = create_hwmon_attr_name(&pdev->dev, type, np->name,
sdata[count].name);