diff options
-rw-r--r-- | drivers/hwmon/lm85.c | 48 |
1 files changed, 37 insertions, 11 deletions
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 111c2c800100..6229e7d488cb 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
@@ -595,6 +595,9 @@ show_in_reg(1); | |||
595 | show_in_reg(2); | 595 | show_in_reg(2); |
596 | show_in_reg(3); | 596 | show_in_reg(3); |
597 | show_in_reg(4); | 597 | show_in_reg(4); |
598 | show_in_reg(5); | ||
599 | show_in_reg(6); | ||
600 | show_in_reg(7); | ||
598 | 601 | ||
599 | /* Temps */ | 602 | /* Temps */ |
600 | 603 | ||
@@ -1030,15 +1033,32 @@ static const struct attribute_group lm85_group = { | |||
1030 | .attrs = lm85_attributes, | 1033 | .attrs = lm85_attributes, |
1031 | }; | 1034 | }; |
1032 | 1035 | ||
1033 | static struct attribute *lm85_attributes_opt[] = { | 1036 | static struct attribute *lm85_attributes_in4[] = { |
1034 | &sensor_dev_attr_in4_input.dev_attr.attr, | 1037 | &sensor_dev_attr_in4_input.dev_attr.attr, |
1035 | &sensor_dev_attr_in4_min.dev_attr.attr, | 1038 | &sensor_dev_attr_in4_min.dev_attr.attr, |
1036 | &sensor_dev_attr_in4_max.dev_attr.attr, | 1039 | &sensor_dev_attr_in4_max.dev_attr.attr, |
1037 | NULL | 1040 | NULL |
1038 | }; | 1041 | }; |
1039 | 1042 | ||
1040 | static const struct attribute_group lm85_group_opt = { | 1043 | static const struct attribute_group lm85_group_in4 = { |
1041 | .attrs = lm85_attributes_opt, | 1044 | .attrs = lm85_attributes_in4, |
1045 | }; | ||
1046 | |||
1047 | static struct attribute *lm85_attributes_in567[] = { | ||
1048 | &sensor_dev_attr_in5_input.dev_attr.attr, | ||
1049 | &sensor_dev_attr_in6_input.dev_attr.attr, | ||
1050 | &sensor_dev_attr_in7_input.dev_attr.attr, | ||
1051 | &sensor_dev_attr_in5_min.dev_attr.attr, | ||
1052 | &sensor_dev_attr_in6_min.dev_attr.attr, | ||
1053 | &sensor_dev_attr_in7_min.dev_attr.attr, | ||
1054 | &sensor_dev_attr_in5_max.dev_attr.attr, | ||
1055 | &sensor_dev_attr_in6_max.dev_attr.attr, | ||
1056 | &sensor_dev_attr_in7_max.dev_attr.attr, | ||
1057 | NULL | ||
1058 | }; | ||
1059 | |||
1060 | static const struct attribute_group lm85_group_in567 = { | ||
1061 | .attrs = lm85_attributes_in567, | ||
1042 | }; | 1062 | }; |
1043 | 1063 | ||
1044 | static int lm85_detect(struct i2c_adapter *adapter, int address, | 1064 | static int lm85_detect(struct i2c_adapter *adapter, int address, |
@@ -1186,12 +1206,14 @@ static int lm85_detect(struct i2c_adapter *adapter, int address, | |||
1186 | as a sixth digital VID input rather than an analog input. */ | 1206 | as a sixth digital VID input rather than an analog input. */ |
1187 | data->vid = lm85_read_value(new_client, LM85_REG_VID); | 1207 | data->vid = lm85_read_value(new_client, LM85_REG_VID); |
1188 | if (!(kind == adt7463 && (data->vid & 0x80))) | 1208 | if (!(kind == adt7463 && (data->vid & 0x80))) |
1189 | if ((err = device_create_file(&new_client->dev, | 1209 | if ((err = sysfs_create_group(&new_client->dev.kobj, |
1190 | &sensor_dev_attr_in4_input.dev_attr)) | 1210 | &lm85_group_in4))) |
1191 | || (err = device_create_file(&new_client->dev, | 1211 | goto ERROR3; |
1192 | &sensor_dev_attr_in4_min.dev_attr)) | 1212 | |
1193 | || (err = device_create_file(&new_client->dev, | 1213 | /* The EMC6D100 has 3 additional voltage inputs */ |
1194 | &sensor_dev_attr_in4_max.dev_attr))) | 1214 | if (kind == emc6d100) |
1215 | if ((err = sysfs_create_group(&new_client->dev.kobj, | ||
1216 | &lm85_group_in567))) | ||
1195 | goto ERROR3; | 1217 | goto ERROR3; |
1196 | 1218 | ||
1197 | data->hwmon_dev = hwmon_device_register(&new_client->dev); | 1219 | data->hwmon_dev = hwmon_device_register(&new_client->dev); |
@@ -1205,7 +1227,9 @@ static int lm85_detect(struct i2c_adapter *adapter, int address, | |||
1205 | /* Error out and cleanup code */ | 1227 | /* Error out and cleanup code */ |
1206 | ERROR3: | 1228 | ERROR3: |
1207 | sysfs_remove_group(&new_client->dev.kobj, &lm85_group); | 1229 | sysfs_remove_group(&new_client->dev.kobj, &lm85_group); |
1208 | sysfs_remove_group(&new_client->dev.kobj, &lm85_group_opt); | 1230 | sysfs_remove_group(&new_client->dev.kobj, &lm85_group_in4); |
1231 | if (kind == emc6d100) | ||
1232 | sysfs_remove_group(&new_client->dev.kobj, &lm85_group_in567); | ||
1209 | ERROR2: | 1233 | ERROR2: |
1210 | i2c_detach_client(new_client); | 1234 | i2c_detach_client(new_client); |
1211 | ERROR1: | 1235 | ERROR1: |
@@ -1219,7 +1243,9 @@ static int lm85_detach_client(struct i2c_client *client) | |||
1219 | struct lm85_data *data = i2c_get_clientdata(client); | 1243 | struct lm85_data *data = i2c_get_clientdata(client); |
1220 | hwmon_device_unregister(data->hwmon_dev); | 1244 | hwmon_device_unregister(data->hwmon_dev); |
1221 | sysfs_remove_group(&client->dev.kobj, &lm85_group); | 1245 | sysfs_remove_group(&client->dev.kobj, &lm85_group); |
1222 | sysfs_remove_group(&client->dev.kobj, &lm85_group_opt); | 1246 | sysfs_remove_group(&client->dev.kobj, &lm85_group_in4); |
1247 | if (data->type == emc6d100) | ||
1248 | sysfs_remove_group(&client->dev.kobj, &lm85_group_in567); | ||
1223 | i2c_detach_client(client); | 1249 | i2c_detach_client(client); |
1224 | kfree(data); | 1250 | kfree(data); |
1225 | return 0; | 1251 | return 0; |