diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-10-22 11:46:17 -0400 |
---|---|---|
committer | Mark M. Hoffman <mhoffman@lightlink.com> | 2008-02-07 20:39:41 -0500 |
commit | 5314f5c1abf03a56c6607ddef96b7a5607bee2f8 (patch) | |
tree | 2f9b19bed0f6a55bc34c6220b9366d79f6be23d9 /drivers | |
parent | a5955ed27497385cc491ecbe40af45951e830881 (diff) |
hwmon: (gl518sm) Don't create sysfs files for missing features
The early revisions of the GL518SM do not report voltage values for
the first 3 voltage channels. We should not create sysfs attributes
for these missing features.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/gl518sm.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c index 842252eccdaa..8287a3af6d79 100644 --- a/drivers/hwmon/gl518sm.c +++ b/drivers/hwmon/gl518sm.c | |||
@@ -336,9 +336,6 @@ static DEVICE_ATTR(beep_mask, S_IWUSR|S_IRUGO, | |||
336 | show_beep_mask, set_beep_mask); | 336 | show_beep_mask, set_beep_mask); |
337 | 337 | ||
338 | static struct attribute *gl518_attributes[] = { | 338 | static struct attribute *gl518_attributes[] = { |
339 | &dev_attr_in0_input.attr, | ||
340 | &dev_attr_in1_input.attr, | ||
341 | &dev_attr_in2_input.attr, | ||
342 | &dev_attr_in3_input.attr, | 339 | &dev_attr_in3_input.attr, |
343 | &dev_attr_in0_min.attr, | 340 | &dev_attr_in0_min.attr, |
344 | &dev_attr_in1_min.attr, | 341 | &dev_attr_in1_min.attr, |
@@ -371,6 +368,17 @@ static const struct attribute_group gl518_group = { | |||
371 | .attrs = gl518_attributes, | 368 | .attrs = gl518_attributes, |
372 | }; | 369 | }; |
373 | 370 | ||
371 | static struct attribute *gl518_attributes_r80[] = { | ||
372 | &dev_attr_in0_input.attr, | ||
373 | &dev_attr_in1_input.attr, | ||
374 | &dev_attr_in2_input.attr, | ||
375 | NULL | ||
376 | }; | ||
377 | |||
378 | static const struct attribute_group gl518_group_r80 = { | ||
379 | .attrs = gl518_attributes_r80, | ||
380 | }; | ||
381 | |||
374 | /* | 382 | /* |
375 | * Real code | 383 | * Real code |
376 | */ | 384 | */ |
@@ -445,12 +453,15 @@ static int gl518_detect(struct i2c_adapter *adapter, int address, int kind) | |||
445 | 453 | ||
446 | /* Initialize the GL518SM chip */ | 454 | /* Initialize the GL518SM chip */ |
447 | data->alarm_mask = 0xff; | 455 | data->alarm_mask = 0xff; |
448 | data->voltage_in[0]=data->voltage_in[1]=data->voltage_in[2]=0; | ||
449 | gl518_init_client(client); | 456 | gl518_init_client(client); |
450 | 457 | ||
451 | /* Register sysfs hooks */ | 458 | /* Register sysfs hooks */ |
452 | if ((err = sysfs_create_group(&client->dev.kobj, &gl518_group))) | 459 | if ((err = sysfs_create_group(&client->dev.kobj, &gl518_group))) |
453 | goto exit_detach; | 460 | goto exit_detach; |
461 | if (data->type == gl518sm_r80) | ||
462 | if ((err = sysfs_create_group(&client->dev.kobj, | ||
463 | &gl518_group_r80))) | ||
464 | goto exit_remove_files; | ||
454 | 465 | ||
455 | data->hwmon_dev = hwmon_device_register(&client->dev); | 466 | data->hwmon_dev = hwmon_device_register(&client->dev); |
456 | if (IS_ERR(data->hwmon_dev)) { | 467 | if (IS_ERR(data->hwmon_dev)) { |
@@ -462,6 +473,8 @@ static int gl518_detect(struct i2c_adapter *adapter, int address, int kind) | |||
462 | 473 | ||
463 | exit_remove_files: | 474 | exit_remove_files: |
464 | sysfs_remove_group(&client->dev.kobj, &gl518_group); | 475 | sysfs_remove_group(&client->dev.kobj, &gl518_group); |
476 | if (data->type == gl518sm_r80) | ||
477 | sysfs_remove_group(&client->dev.kobj, &gl518_group_r80); | ||
465 | exit_detach: | 478 | exit_detach: |
466 | i2c_detach_client(client); | 479 | i2c_detach_client(client); |
467 | exit_free: | 480 | exit_free: |
@@ -496,6 +509,8 @@ static int gl518_detach_client(struct i2c_client *client) | |||
496 | 509 | ||
497 | hwmon_device_unregister(data->hwmon_dev); | 510 | hwmon_device_unregister(data->hwmon_dev); |
498 | sysfs_remove_group(&client->dev.kobj, &gl518_group); | 511 | sysfs_remove_group(&client->dev.kobj, &gl518_group); |
512 | if (data->type == gl518sm_r80) | ||
513 | sysfs_remove_group(&client->dev.kobj, &gl518_group_r80); | ||
499 | 514 | ||
500 | if ((err = i2c_detach_client(client))) | 515 | if ((err = i2c_detach_client(client))) |
501 | return err; | 516 | return err; |