summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2014-04-04 20:01:34 +0400
committerJean Delvare <jdelvare@suse.de>2014-04-04 20:01:34 +0400
commit742192f546ae710dd9bc8ddea2354636eac33b57 (patch)
tree767cf4f03199901863ba427937b3ff5bc7457550 /drivers/hwmon
parent6cf0a91ebe11cee1df871619af4eb58c9af32666 (diff)
downloadlinux-742192f546ae710dd9bc8ddea2354636eac33b57.tar.xz
hwmon: (lm90) Create most optional attributes with sysfs_create_group
With the new hwmon API, all attributes have to be created as groups. Use sysfs_create_group and sysfs_remove_group instead of device_create_file and device_remove_file to prepare for the new API. Exception is the 'pec' attribute which will stay with the i2c device. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jean Delvare <jdelvare@suse.de>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/lm90.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 701e952ae523..733b42e8b2d1 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -1057,6 +1057,15 @@ static const struct attribute_group lm90_group = {
.attrs = lm90_attributes,
};
+static struct attribute *lm90_temp2_offset_attributes[] = {
+ &sensor_dev_attr_temp2_offset.dev_attr.attr,
+ NULL
+};
+
+static const struct attribute_group lm90_temp2_offset_group = {
+ .attrs = lm90_temp2_offset_attributes,
+};
+
/*
* Additional attributes for devices with emergency sensors
*/
@@ -1404,7 +1413,7 @@ static void lm90_remove_files(struct i2c_client *client, struct lm90_data *data)
if (data->flags & LM90_HAVE_EMERGENCY)
sysfs_remove_group(&dev->kobj, &lm90_emergency_group);
if (data->flags & LM90_HAVE_OFFSET)
- device_remove_file(dev, &sensor_dev_attr_temp2_offset.dev_attr);
+ sysfs_remove_group(&dev->kobj, &lm90_temp2_offset_group);
device_remove_file(dev, &dev_attr_pec);
sysfs_remove_group(&dev->kobj, &lm90_group);
}
@@ -1574,8 +1583,7 @@ static int lm90_probe(struct i2c_client *client,
goto exit_remove_files;
}
if (data->flags & LM90_HAVE_OFFSET) {
- err = device_create_file(dev,
- &sensor_dev_attr_temp2_offset.dev_attr);
+ err = sysfs_create_group(&dev->kobj, &lm90_temp2_offset_group);
if (err)
goto exit_remove_files;
}