diff options
Diffstat (limited to 'drivers/hwmon/lm78.c')
-rw-r--r-- | drivers/hwmon/lm78.c | 88 |
1 files changed, 51 insertions, 37 deletions
diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index fa1715b9a996..ac1b746df6d0 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c | |||
@@ -482,6 +482,50 @@ static int lm78_isa_attach_adapter(struct i2c_adapter *adapter) | |||
482 | return lm78_detect(adapter, isa_address, -1); | 482 | return lm78_detect(adapter, isa_address, -1); |
483 | } | 483 | } |
484 | 484 | ||
485 | static struct attribute *lm78_attributes[] = { | ||
486 | &dev_attr_in0_input.attr, | ||
487 | &dev_attr_in0_min.attr, | ||
488 | &dev_attr_in0_max.attr, | ||
489 | &dev_attr_in1_input.attr, | ||
490 | &dev_attr_in1_min.attr, | ||
491 | &dev_attr_in1_max.attr, | ||
492 | &dev_attr_in2_input.attr, | ||
493 | &dev_attr_in2_min.attr, | ||
494 | &dev_attr_in2_max.attr, | ||
495 | &dev_attr_in3_input.attr, | ||
496 | &dev_attr_in3_min.attr, | ||
497 | &dev_attr_in3_max.attr, | ||
498 | &dev_attr_in4_input.attr, | ||
499 | &dev_attr_in4_min.attr, | ||
500 | &dev_attr_in4_max.attr, | ||
501 | &dev_attr_in5_input.attr, | ||
502 | &dev_attr_in5_min.attr, | ||
503 | &dev_attr_in5_max.attr, | ||
504 | &dev_attr_in6_input.attr, | ||
505 | &dev_attr_in6_min.attr, | ||
506 | &dev_attr_in6_max.attr, | ||
507 | &dev_attr_temp1_input.attr, | ||
508 | &dev_attr_temp1_max.attr, | ||
509 | &dev_attr_temp1_max_hyst.attr, | ||
510 | &dev_attr_fan1_input.attr, | ||
511 | &dev_attr_fan1_min.attr, | ||
512 | &dev_attr_fan1_div.attr, | ||
513 | &dev_attr_fan2_input.attr, | ||
514 | &dev_attr_fan2_min.attr, | ||
515 | &dev_attr_fan2_div.attr, | ||
516 | &dev_attr_fan3_input.attr, | ||
517 | &dev_attr_fan3_min.attr, | ||
518 | &dev_attr_fan3_div.attr, | ||
519 | &dev_attr_alarms.attr, | ||
520 | &dev_attr_cpu0_vid.attr, | ||
521 | |||
522 | NULL | ||
523 | }; | ||
524 | |||
525 | static const struct attribute_group lm78_group = { | ||
526 | .attrs = lm78_attributes, | ||
527 | }; | ||
528 | |||
485 | /* This function is called by i2c_probe */ | 529 | /* This function is called by i2c_probe */ |
486 | static int lm78_detect(struct i2c_adapter *adapter, int address, int kind) | 530 | static int lm78_detect(struct i2c_adapter *adapter, int address, int kind) |
487 | { | 531 | { |
@@ -616,50 +660,19 @@ static int lm78_detect(struct i2c_adapter *adapter, int address, int kind) | |||
616 | } | 660 | } |
617 | 661 | ||
618 | /* Register sysfs hooks */ | 662 | /* Register sysfs hooks */ |
663 | if ((err = sysfs_create_group(&new_client->dev.kobj, &lm78_group))) | ||
664 | goto ERROR3; | ||
665 | |||
619 | data->class_dev = hwmon_device_register(&new_client->dev); | 666 | data->class_dev = hwmon_device_register(&new_client->dev); |
620 | if (IS_ERR(data->class_dev)) { | 667 | if (IS_ERR(data->class_dev)) { |
621 | err = PTR_ERR(data->class_dev); | 668 | err = PTR_ERR(data->class_dev); |
622 | goto ERROR3; | 669 | goto ERROR4; |
623 | } | 670 | } |
624 | 671 | ||
625 | device_create_file(&new_client->dev, &dev_attr_in0_input); | ||
626 | device_create_file(&new_client->dev, &dev_attr_in0_min); | ||
627 | device_create_file(&new_client->dev, &dev_attr_in0_max); | ||
628 | device_create_file(&new_client->dev, &dev_attr_in1_input); | ||
629 | device_create_file(&new_client->dev, &dev_attr_in1_min); | ||
630 | device_create_file(&new_client->dev, &dev_attr_in1_max); | ||
631 | device_create_file(&new_client->dev, &dev_attr_in2_input); | ||
632 | device_create_file(&new_client->dev, &dev_attr_in2_min); | ||
633 | device_create_file(&new_client->dev, &dev_attr_in2_max); | ||
634 | device_create_file(&new_client->dev, &dev_attr_in3_input); | ||
635 | device_create_file(&new_client->dev, &dev_attr_in3_min); | ||
636 | device_create_file(&new_client->dev, &dev_attr_in3_max); | ||
637 | device_create_file(&new_client->dev, &dev_attr_in4_input); | ||
638 | device_create_file(&new_client->dev, &dev_attr_in4_min); | ||
639 | device_create_file(&new_client->dev, &dev_attr_in4_max); | ||
640 | device_create_file(&new_client->dev, &dev_attr_in5_input); | ||
641 | device_create_file(&new_client->dev, &dev_attr_in5_min); | ||
642 | device_create_file(&new_client->dev, &dev_attr_in5_max); | ||
643 | device_create_file(&new_client->dev, &dev_attr_in6_input); | ||
644 | device_create_file(&new_client->dev, &dev_attr_in6_min); | ||
645 | device_create_file(&new_client->dev, &dev_attr_in6_max); | ||
646 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | ||
647 | device_create_file(&new_client->dev, &dev_attr_temp1_max); | ||
648 | device_create_file(&new_client->dev, &dev_attr_temp1_max_hyst); | ||
649 | device_create_file(&new_client->dev, &dev_attr_fan1_input); | ||
650 | device_create_file(&new_client->dev, &dev_attr_fan1_min); | ||
651 | device_create_file(&new_client->dev, &dev_attr_fan1_div); | ||
652 | device_create_file(&new_client->dev, &dev_attr_fan2_input); | ||
653 | device_create_file(&new_client->dev, &dev_attr_fan2_min); | ||
654 | device_create_file(&new_client->dev, &dev_attr_fan2_div); | ||
655 | device_create_file(&new_client->dev, &dev_attr_fan3_input); | ||
656 | device_create_file(&new_client->dev, &dev_attr_fan3_min); | ||
657 | device_create_file(&new_client->dev, &dev_attr_fan3_div); | ||
658 | device_create_file(&new_client->dev, &dev_attr_alarms); | ||
659 | device_create_file(&new_client->dev, &dev_attr_cpu0_vid); | ||
660 | |||
661 | return 0; | 672 | return 0; |
662 | 673 | ||
674 | ERROR4: | ||
675 | sysfs_remove_group(&new_client->dev.kobj, &lm78_group); | ||
663 | ERROR3: | 676 | ERROR3: |
664 | i2c_detach_client(new_client); | 677 | i2c_detach_client(new_client); |
665 | ERROR2: | 678 | ERROR2: |
@@ -677,6 +690,7 @@ static int lm78_detach_client(struct i2c_client *client) | |||
677 | int err; | 690 | int err; |
678 | 691 | ||
679 | hwmon_device_unregister(data->class_dev); | 692 | hwmon_device_unregister(data->class_dev); |
693 | sysfs_remove_group(&client->dev.kobj, &lm78_group); | ||
680 | 694 | ||
681 | if ((err = i2c_detach_client(client))) | 695 | if ((err = i2c_detach_client(client))) |
682 | return err; | 696 | return err; |