aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2014-04-04 12:01:34 -0400
committerJean Delvare <jdelvare@suse.de>2014-04-04 12:01:34 -0400
commit742192f546ae710dd9bc8ddea2354636eac33b57 (patch)
tree767cf4f03199901863ba427937b3ff5bc7457550
parent6cf0a91ebe11cee1df871619af4eb58c9af32666 (diff)
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>
-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 = {
1057 .attrs = lm90_attributes, 1057 .attrs = lm90_attributes,
1058}; 1058};
1059 1059
1060static struct attribute *lm90_temp2_offset_attributes[] = {
1061 &sensor_dev_attr_temp2_offset.dev_attr.attr,
1062 NULL
1063};
1064
1065static const struct attribute_group lm90_temp2_offset_group = {
1066 .attrs = lm90_temp2_offset_attributes,
1067};
1068
1060/* 1069/*
1061 * Additional attributes for devices with emergency sensors 1070 * Additional attributes for devices with emergency sensors
1062 */ 1071 */
@@ -1404,7 +1413,7 @@ static void lm90_remove_files(struct i2c_client *client, struct lm90_data *data)
1404 if (data->flags & LM90_HAVE_EMERGENCY) 1413 if (data->flags & LM90_HAVE_EMERGENCY)
1405 sysfs_remove_group(&dev->kobj, &lm90_emergency_group); 1414 sysfs_remove_group(&dev->kobj, &lm90_emergency_group);
1406 if (data->flags & LM90_HAVE_OFFSET) 1415 if (data->flags & LM90_HAVE_OFFSET)
1407 device_remove_file(dev, &sensor_dev_attr_temp2_offset.dev_attr); 1416 sysfs_remove_group(&dev->kobj, &lm90_temp2_offset_group);
1408 device_remove_file(dev, &dev_attr_pec); 1417 device_remove_file(dev, &dev_attr_pec);
1409 sysfs_remove_group(&dev->kobj, &lm90_group); 1418 sysfs_remove_group(&dev->kobj, &lm90_group);
1410} 1419}
@@ -1574,8 +1583,7 @@ static int lm90_probe(struct i2c_client *client,
1574 goto exit_remove_files; 1583 goto exit_remove_files;
1575 } 1584 }
1576 if (data->flags & LM90_HAVE_OFFSET) { 1585 if (data->flags & LM90_HAVE_OFFSET) {
1577 err = device_create_file(dev, 1586 err = sysfs_create_group(&dev->kobj, &lm90_temp2_offset_group);
1578 &sensor_dev_attr_temp2_offset.dev_attr);
1579 if (err) 1587 if (err)
1580 goto exit_remove_files; 1588 goto exit_remove_files;
1581 } 1589 }