aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/thmc50.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-09-18 12:44:42 -0400
committerMark M. Hoffman <mhoffman@lightlink.com>2007-10-09 22:56:31 -0400
commit894c00cf3805670faddd41d3d5dcb3c0ab75a39d (patch)
tree44134f7ef6c1a2f9d1740dad29f7c1c4af4a09e2 /drivers/hwmon/thmc50.c
parentc2803b98557c10464f3a1fc65f56d0c8c01991bd (diff)
hwmon: (thmc50) Don't create temp3 if not enabled
Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/hwmon/thmc50.c')
-rw-r--r--drivers/hwmon/thmc50.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/hwmon/thmc50.c b/drivers/hwmon/thmc50.c
index f79c7504204e..fb02834897f3 100644
--- a/drivers/hwmon/thmc50.c
+++ b/drivers/hwmon/thmc50.c
@@ -237,7 +237,7 @@ static const struct attribute_group thmc50_group = {
237}; 237};
238 238
239/* for ADM1022 3rd temperature mode */ 239/* for ADM1022 3rd temperature mode */
240static struct attribute *adm1022_attributes[] = { 240static struct attribute *temp3_attributes[] = {
241 &sensor_dev_attr_temp3_max.dev_attr.attr, 241 &sensor_dev_attr_temp3_max.dev_attr.attr,
242 &sensor_dev_attr_temp3_min.dev_attr.attr, 242 &sensor_dev_attr_temp3_min.dev_attr.attr,
243 &sensor_dev_attr_temp3_input.dev_attr.attr, 243 &sensor_dev_attr_temp3_input.dev_attr.attr,
@@ -246,8 +246,8 @@ static struct attribute *adm1022_attributes[] = {
246 NULL 246 NULL
247}; 247};
248 248
249static const struct attribute_group adm1022_group = { 249static const struct attribute_group temp3_group = {
250 .attrs = adm1022_attributes, 250 .attrs = temp3_attributes,
251}; 251};
252 252
253static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind) 253static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind)
@@ -345,9 +345,9 @@ static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind)
345 goto exit_detach; 345 goto exit_detach;
346 346
347 /* Register ADM1022 sysfs hooks */ 347 /* Register ADM1022 sysfs hooks */
348 if (data->type == adm1022) 348 if (data->has_temp3)
349 if ((err = sysfs_create_group(&client->dev.kobj, 349 if ((err = sysfs_create_group(&client->dev.kobj,
350 &adm1022_group))) 350 &temp3_group)))
351 goto exit_remove_sysfs_thmc50; 351 goto exit_remove_sysfs_thmc50;
352 352
353 /* Register a new directory entry with module sensors */ 353 /* Register a new directory entry with module sensors */
@@ -360,8 +360,8 @@ static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind)
360 return 0; 360 return 0;
361 361
362exit_remove_sysfs: 362exit_remove_sysfs:
363 if (data->type == adm1022) 363 if (data->has_temp3)
364 sysfs_remove_group(&client->dev.kobj, &adm1022_group); 364 sysfs_remove_group(&client->dev.kobj, &temp3_group);
365exit_remove_sysfs_thmc50: 365exit_remove_sysfs_thmc50:
366 sysfs_remove_group(&client->dev.kobj, &thmc50_group); 366 sysfs_remove_group(&client->dev.kobj, &thmc50_group);
367exit_detach: 367exit_detach:
@@ -386,8 +386,8 @@ static int thmc50_detach_client(struct i2c_client *client)
386 386
387 hwmon_device_unregister(data->hwmon_dev); 387 hwmon_device_unregister(data->hwmon_dev);
388 sysfs_remove_group(&client->dev.kobj, &thmc50_group); 388 sysfs_remove_group(&client->dev.kobj, &thmc50_group);
389 if (data->type == adm1022) 389 if (data->has_temp3)
390 sysfs_remove_group(&client->dev.kobj, &adm1022_group); 390 sysfs_remove_group(&client->dev.kobj, &temp3_group);
391 391
392 if ((err = i2c_detach_client(client))) 392 if ((err = i2c_detach_client(client)))
393 return err; 393 return err;