diff options
author | Yuan Mu <ymu@winbond.com.tw> | 2006-01-18 17:11:55 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-23 17:21:51 -0500 |
commit | 1f8dae31fe8d7b1dbeaa2110e063d876be91ed60 (patch) | |
tree | 50f758ba7ecd7f72ca30444f632f51949d3bb71c /drivers | |
parent | 70adca5a9f506942ec88fb2d9d6e71ef271888b7 (diff) |
[PATCH] hwmon: w83792d use arrays of attributes
Use arrays of attributes in the w83792d driver.
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Signed-off-by: Yuan Mu <ymu@winbond.com.tw>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/w83792d.c | 525 |
1 files changed, 241 insertions, 284 deletions
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index a2f6bb676235..c5b57c7a4a75 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c | |||
@@ -382,30 +382,40 @@ static ssize_t store_in_##reg (struct device *dev, \ | |||
382 | store_in_reg(MIN, min); | 382 | store_in_reg(MIN, min); |
383 | store_in_reg(MAX, max); | 383 | store_in_reg(MAX, max); |
384 | 384 | ||
385 | #define sysfs_in_reg(offset) \ | 385 | static struct sensor_device_attribute sda_in_input[] = { |
386 | static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, show_in, \ | 386 | SENSOR_ATTR(in0_input, S_IRUGO, show_in, NULL, 0), |
387 | NULL, offset); \ | 387 | SENSOR_ATTR(in1_input, S_IRUGO, show_in, NULL, 1), |
388 | static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ | 388 | SENSOR_ATTR(in2_input, S_IRUGO, show_in, NULL, 2), |
389 | show_in_min, store_in_min, offset); \ | 389 | SENSOR_ATTR(in3_input, S_IRUGO, show_in, NULL, 3), |
390 | static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ | 390 | SENSOR_ATTR(in4_input, S_IRUGO, show_in, NULL, 4), |
391 | show_in_max, store_in_max, offset); | 391 | SENSOR_ATTR(in5_input, S_IRUGO, show_in, NULL, 5), |
392 | 392 | SENSOR_ATTR(in6_input, S_IRUGO, show_in, NULL, 6), | |
393 | sysfs_in_reg(0); | 393 | SENSOR_ATTR(in7_input, S_IRUGO, show_in, NULL, 7), |
394 | sysfs_in_reg(1); | 394 | SENSOR_ATTR(in8_input, S_IRUGO, show_in, NULL, 8), |
395 | sysfs_in_reg(2); | 395 | }; |
396 | sysfs_in_reg(3); | 396 | static struct sensor_device_attribute sda_in_min[] = { |
397 | sysfs_in_reg(4); | 397 | SENSOR_ATTR(in0_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 0), |
398 | sysfs_in_reg(5); | 398 | SENSOR_ATTR(in1_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 1), |
399 | sysfs_in_reg(6); | 399 | SENSOR_ATTR(in2_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 2), |
400 | sysfs_in_reg(7); | 400 | SENSOR_ATTR(in3_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 3), |
401 | sysfs_in_reg(8); | 401 | SENSOR_ATTR(in4_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 4), |
402 | 402 | SENSOR_ATTR(in5_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 5), | |
403 | #define device_create_file_in(client, offset) \ | 403 | SENSOR_ATTR(in6_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 6), |
404 | do { \ | 404 | SENSOR_ATTR(in7_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 7), |
405 | device_create_file(&client->dev, &sensor_dev_attr_in##offset##_input.dev_attr); \ | 405 | SENSOR_ATTR(in8_min, S_IWUSR | S_IRUGO, show_in_min, store_in_min, 8), |
406 | device_create_file(&client->dev, &sensor_dev_attr_in##offset##_max.dev_attr); \ | 406 | }; |
407 | device_create_file(&client->dev, &sensor_dev_attr_in##offset##_min.dev_attr); \ | 407 | static struct sensor_device_attribute sda_in_max[] = { |
408 | } while (0) | 408 | SENSOR_ATTR(in0_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 0), |
409 | SENSOR_ATTR(in1_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 1), | ||
410 | SENSOR_ATTR(in2_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 2), | ||
411 | SENSOR_ATTR(in3_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 3), | ||
412 | SENSOR_ATTR(in4_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 4), | ||
413 | SENSOR_ATTR(in5_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 5), | ||
414 | SENSOR_ATTR(in6_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 6), | ||
415 | SENSOR_ATTR(in7_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 7), | ||
416 | SENSOR_ATTR(in8_max, S_IWUSR | S_IRUGO, show_in_max, store_in_max, 8), | ||
417 | }; | ||
418 | |||
409 | 419 | ||
410 | #define show_fan_reg(reg) \ | 420 | #define show_fan_reg(reg) \ |
411 | static ssize_t show_##reg (struct device *dev, struct device_attribute *attr, \ | 421 | static ssize_t show_##reg (struct device *dev, struct device_attribute *attr, \ |
@@ -486,28 +496,33 @@ store_fan_div(struct device *dev, struct device_attribute *attr, | |||
486 | return count; | 496 | return count; |
487 | } | 497 | } |
488 | 498 | ||
489 | #define sysfs_fan(offset) \ | 499 | static struct sensor_device_attribute sda_fan_input[] = { |
490 | static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan, NULL, \ | 500 | SENSOR_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 1), |
491 | offset); \ | 501 | SENSOR_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 2), |
492 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ | 502 | SENSOR_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 3), |
493 | show_fan_div, store_fan_div, offset); \ | 503 | SENSOR_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 4), |
494 | static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ | 504 | SENSOR_ATTR(fan5_input, S_IRUGO, show_fan, NULL, 5), |
495 | show_fan_min, store_fan_min, offset); | 505 | SENSOR_ATTR(fan6_input, S_IRUGO, show_fan, NULL, 6), |
496 | 506 | SENSOR_ATTR(fan7_input, S_IRUGO, show_fan, NULL, 7), | |
497 | sysfs_fan(1); | 507 | }; |
498 | sysfs_fan(2); | 508 | static struct sensor_device_attribute sda_fan_min[] = { |
499 | sysfs_fan(3); | 509 | SENSOR_ATTR(fan1_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 1), |
500 | sysfs_fan(4); | 510 | SENSOR_ATTR(fan2_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 2), |
501 | sysfs_fan(5); | 511 | SENSOR_ATTR(fan3_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 3), |
502 | sysfs_fan(6); | 512 | SENSOR_ATTR(fan4_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 4), |
503 | sysfs_fan(7); | 513 | SENSOR_ATTR(fan5_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 5), |
504 | 514 | SENSOR_ATTR(fan6_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 6), | |
505 | #define device_create_file_fan(client, offset) \ | 515 | SENSOR_ATTR(fan7_min, S_IWUSR | S_IRUGO, show_fan_min, store_fan_min, 7), |
506 | do { \ | 516 | }; |
507 | device_create_file(&client->dev, &sensor_dev_attr_fan##offset##_input.dev_attr); \ | 517 | static struct sensor_device_attribute sda_fan_div[] = { |
508 | device_create_file(&client->dev, &sensor_dev_attr_fan##offset##_div.dev_attr); \ | 518 | SENSOR_ATTR(fan1_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 1), |
509 | device_create_file(&client->dev, &sensor_dev_attr_fan##offset##_min.dev_attr); \ | 519 | SENSOR_ATTR(fan2_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 2), |
510 | } while (0) | 520 | SENSOR_ATTR(fan3_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 3), |
521 | SENSOR_ATTR(fan4_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 4), | ||
522 | SENSOR_ATTR(fan5_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 5), | ||
523 | SENSOR_ATTR(fan6_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 6), | ||
524 | SENSOR_ATTR(fan7_div, S_IWUSR | S_IRUGO, show_fan_div, store_fan_div, 7), | ||
525 | }; | ||
511 | 526 | ||
512 | 527 | ||
513 | /* read/write the temperature1, includes measured value and limits */ | 528 | /* read/write the temperature1, includes measured value and limits */ |
@@ -539,21 +554,6 @@ static ssize_t store_temp1(struct device *dev, struct device_attribute *attr, | |||
539 | return count; | 554 | return count; |
540 | } | 555 | } |
541 | 556 | ||
542 | |||
543 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp1, NULL, 0); | ||
544 | static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp1, | ||
545 | store_temp1, 1); | ||
546 | static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR, show_temp1, | ||
547 | store_temp1, 2); | ||
548 | |||
549 | #define device_create_file_temp1(client) \ | ||
550 | do { \ | ||
551 | device_create_file(&client->dev, &sensor_dev_attr_temp1_input.dev_attr); \ | ||
552 | device_create_file(&client->dev, &sensor_dev_attr_temp1_max.dev_attr); \ | ||
553 | device_create_file(&client->dev, &sensor_dev_attr_temp1_max_hyst.dev_attr); \ | ||
554 | } while (0) | ||
555 | |||
556 | |||
557 | /* read/write the temperature2-3, includes measured value and limits */ | 557 | /* read/write the temperature2-3, includes measured value and limits */ |
558 | 558 | ||
559 | static ssize_t show_temp23(struct device *dev, struct device_attribute *attr, | 559 | static ssize_t show_temp23(struct device *dev, struct device_attribute *attr, |
@@ -590,25 +590,23 @@ static ssize_t store_temp23(struct device *dev, struct device_attribute *attr, | |||
590 | return count; | 590 | return count; |
591 | } | 591 | } |
592 | 592 | ||
593 | #define sysfs_temp23(name,idx) \ | 593 | static struct sensor_device_attribute_2 sda_temp_input[] = { |
594 | static SENSOR_DEVICE_ATTR_2(name##_input, S_IRUGO, show_temp23, NULL, \ | 594 | SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp1, NULL, 0, 0), |
595 | idx, 0); \ | 595 | SENSOR_ATTR_2(temp2_input, S_IRUGO, show_temp23, NULL, 0, 0), |
596 | static SENSOR_DEVICE_ATTR_2(name##_max, S_IRUGO | S_IWUSR, \ | 596 | SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp23, NULL, 1, 0), |
597 | show_temp23, store_temp23, idx, 2); \ | 597 | }; |
598 | static SENSOR_DEVICE_ATTR_2(name##_max_hyst, S_IRUGO | S_IWUSR, \ | ||
599 | show_temp23, store_temp23, idx, 4); | ||
600 | |||
601 | sysfs_temp23(temp2,0) | ||
602 | sysfs_temp23(temp3,1) | ||
603 | 598 | ||
604 | #define device_create_file_temp_add(client, offset) \ | 599 | static struct sensor_device_attribute_2 sda_temp_max[] = { |
605 | do { \ | 600 | SENSOR_ATTR_2(temp1_max, S_IRUGO | S_IWUSR, show_temp1, store_temp1, 0, 1), |
606 | device_create_file(&client->dev, &sensor_dev_attr_temp##offset##_input.dev_attr); \ | 601 | SENSOR_ATTR_2(temp2_max, S_IRUGO | S_IWUSR, show_temp23, store_temp23, 0, 2), |
607 | device_create_file(&client->dev, &sensor_dev_attr_temp##offset##_max.dev_attr); \ | 602 | SENSOR_ATTR_2(temp3_max, S_IRUGO | S_IWUSR, show_temp23, store_temp23, 1, 2), |
608 | device_create_file(&client->dev, \ | 603 | }; |
609 | &sensor_dev_attr_temp##offset##_max_hyst.dev_attr); \ | ||
610 | } while (0) | ||
611 | 604 | ||
605 | static struct sensor_device_attribute_2 sda_temp_max_hyst[] = { | ||
606 | SENSOR_ATTR_2(temp1_max_hyst, S_IRUGO | S_IWUSR, show_temp1, store_temp1, 0, 2), | ||
607 | SENSOR_ATTR_2(temp2_max_hyst, S_IRUGO | S_IWUSR, show_temp23, store_temp23, 0, 4), | ||
608 | SENSOR_ATTR_2(temp3_max_hyst, S_IRUGO | S_IWUSR, show_temp23, store_temp23, 1, 4), | ||
609 | }; | ||
612 | 610 | ||
613 | /* get reatime status of all sensors items: voltage, temp, fan */ | 611 | /* get reatime status of all sensors items: voltage, temp, fan */ |
614 | static ssize_t | 612 | static ssize_t |
@@ -620,8 +618,8 @@ show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) | |||
620 | 618 | ||
621 | static | 619 | static |
622 | DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); | 620 | DEVICE_ATTR(alarms, S_IRUGO, show_alarms_reg, NULL); |
623 | #define device_create_file_alarms(client) \ | 621 | #define device_create_file_alarms() \ |
624 | device_create_file(&client->dev, &dev_attr_alarms); | 622 | device_create_file(dev, &dev_attr_alarms); |
625 | 623 | ||
626 | 624 | ||
627 | 625 | ||
@@ -711,26 +709,19 @@ store_pwmenable(struct device *dev, struct device_attribute *attr, | |||
711 | return count; | 709 | return count; |
712 | } | 710 | } |
713 | 711 | ||
714 | #define sysfs_pwm(offset) \ | 712 | static struct sensor_device_attribute sda_pwm[] = { |
715 | static SENSOR_DEVICE_ATTR(pwm##offset, S_IRUGO | S_IWUSR, \ | 713 | SENSOR_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 1), |
716 | show_pwm, store_pwm, offset); \ | 714 | SENSOR_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 2), |
717 | static SENSOR_DEVICE_ATTR(pwm##offset##_enable, S_IRUGO | S_IWUSR, \ | 715 | SENSOR_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, store_pwm, 3), |
718 | show_pwmenable, store_pwmenable, offset); \ | 716 | }; |
719 | 717 | static struct sensor_device_attribute sda_pwm_enable[] = { | |
720 | sysfs_pwm(1); | 718 | SENSOR_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, |
721 | sysfs_pwm(2); | 719 | show_pwmenable, store_pwmenable, 1), |
722 | sysfs_pwm(3); | 720 | SENSOR_ATTR(pwm2_enable, S_IWUSR | S_IRUGO, |
723 | 721 | show_pwmenable, store_pwmenable, 2), | |
724 | 722 | SENSOR_ATTR(pwm3_enable, S_IWUSR | S_IRUGO, | |
725 | #define device_create_file_pwm(client, offset) \ | 723 | show_pwmenable, store_pwmenable, 3), |
726 | do { \ | 724 | }; |
727 | device_create_file(&client->dev, &sensor_dev_attr_pwm##offset.dev_attr); \ | ||
728 | } while (0) | ||
729 | |||
730 | #define device_create_file_pwmenable(client, offset) \ | ||
731 | do { \ | ||
732 | device_create_file(&client->dev, &sensor_dev_attr_pwm##offset##_enable.dev_attr); \ | ||
733 | } while (0) | ||
734 | 725 | ||
735 | 726 | ||
736 | static ssize_t | 727 | static ssize_t |
@@ -764,18 +755,14 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr, | |||
764 | return count; | 755 | return count; |
765 | } | 756 | } |
766 | 757 | ||
767 | #define sysfs_pwm_mode(offset) \ | 758 | static struct sensor_device_attribute sda_pwm_mode[] = { |
768 | static SENSOR_DEVICE_ATTR(pwm##offset##_mode, S_IRUGO | S_IWUSR, \ | 759 | SENSOR_ATTR(pwm1_mode, S_IWUSR | S_IRUGO, |
769 | show_pwm_mode, store_pwm_mode, offset); | 760 | show_pwm_mode, store_pwm_mode, 1), |
770 | 761 | SENSOR_ATTR(pwm2_mode, S_IWUSR | S_IRUGO, | |
771 | sysfs_pwm_mode(1); | 762 | show_pwm_mode, store_pwm_mode, 2), |
772 | sysfs_pwm_mode(2); | 763 | SENSOR_ATTR(pwm3_mode, S_IWUSR | S_IRUGO, |
773 | sysfs_pwm_mode(3); | 764 | show_pwm_mode, store_pwm_mode, 3), |
774 | 765 | }; | |
775 | #define device_create_file_pwm_mode(client, offset) \ | ||
776 | do { \ | ||
777 | device_create_file(&client->dev, &sensor_dev_attr_pwm##offset##_mode.dev_attr); \ | ||
778 | } while (0) | ||
779 | 766 | ||
780 | 767 | ||
781 | static ssize_t | 768 | static ssize_t |
@@ -788,9 +775,9 @@ show_regs_chassis(struct device *dev, struct device_attribute *attr, | |||
788 | 775 | ||
789 | static DEVICE_ATTR(chassis, S_IRUGO, show_regs_chassis, NULL); | 776 | static DEVICE_ATTR(chassis, S_IRUGO, show_regs_chassis, NULL); |
790 | 777 | ||
791 | #define device_create_file_chassis(client) \ | 778 | #define device_create_file_chassis() \ |
792 | do { \ | 779 | do { \ |
793 | device_create_file(&client->dev, &dev_attr_chassis); \ | 780 | device_create_file(dev, &dev_attr_chassis); \ |
794 | } while (0) | 781 | } while (0) |
795 | 782 | ||
796 | 783 | ||
@@ -824,9 +811,9 @@ store_chassis_clear(struct device *dev, struct device_attribute *attr, | |||
824 | static DEVICE_ATTR(chassis_clear, S_IRUGO | S_IWUSR, | 811 | static DEVICE_ATTR(chassis_clear, S_IRUGO | S_IWUSR, |
825 | show_chassis_clear, store_chassis_clear); | 812 | show_chassis_clear, store_chassis_clear); |
826 | 813 | ||
827 | #define device_create_file_chassis_clear(client) \ | 814 | #define device_create_file_chassis_clear() \ |
828 | do { \ | 815 | do { \ |
829 | device_create_file(&client->dev, &dev_attr_chassis_clear); \ | 816 | device_create_file(dev, &dev_attr_chassis_clear); \ |
830 | } while (0) | 817 | } while (0) |
831 | 818 | ||
832 | 819 | ||
@@ -864,20 +851,14 @@ store_thermal_cruise(struct device *dev, struct device_attribute *attr, | |||
864 | return count; | 851 | return count; |
865 | } | 852 | } |
866 | 853 | ||
867 | #define sysfs_thermal_cruise(offset) \ | 854 | static struct sensor_device_attribute sda_thermal_cruise[] = { |
868 | static SENSOR_DEVICE_ATTR(thermal_cruise##offset, S_IRUGO | S_IWUSR, \ | 855 | SENSOR_ATTR(thermal_cruise1, S_IWUSR | S_IRUGO, |
869 | show_thermal_cruise, store_thermal_cruise, offset); | 856 | show_thermal_cruise, store_thermal_cruise, 1), |
870 | 857 | SENSOR_ATTR(thermal_cruise2, S_IWUSR | S_IRUGO, | |
871 | sysfs_thermal_cruise(1); | 858 | show_thermal_cruise, store_thermal_cruise, 2), |
872 | sysfs_thermal_cruise(2); | 859 | SENSOR_ATTR(thermal_cruise3, S_IWUSR | S_IRUGO, |
873 | sysfs_thermal_cruise(3); | 860 | show_thermal_cruise, store_thermal_cruise, 3), |
874 | 861 | }; | |
875 | #define device_create_file_thermal_cruise(client, offset) \ | ||
876 | do { \ | ||
877 | device_create_file(&client->dev, \ | ||
878 | &sensor_dev_attr_thermal_cruise##offset.dev_attr); \ | ||
879 | } while (0) | ||
880 | |||
881 | 862 | ||
882 | /* For Smart Fan I/Thermal Cruise and Smart Fan II */ | 863 | /* For Smart Fan I/Thermal Cruise and Smart Fan II */ |
883 | static ssize_t | 864 | static ssize_t |
@@ -916,19 +897,14 @@ store_tolerance(struct device *dev, struct device_attribute *attr, | |||
916 | return count; | 897 | return count; |
917 | } | 898 | } |
918 | 899 | ||
919 | #define sysfs_tolerance(offset) \ | 900 | static struct sensor_device_attribute sda_tolerance[] = { |
920 | static SENSOR_DEVICE_ATTR(tolerance##offset, S_IRUGO | S_IWUSR, \ | 901 | SENSOR_ATTR(tolerance1, S_IWUSR | S_IRUGO, |
921 | show_tolerance, store_tolerance, offset); | 902 | show_tolerance, store_tolerance, 1), |
922 | 903 | SENSOR_ATTR(tolerance2, S_IWUSR | S_IRUGO, | |
923 | sysfs_tolerance(1); | 904 | show_tolerance, store_tolerance, 2), |
924 | sysfs_tolerance(2); | 905 | SENSOR_ATTR(tolerance3, S_IWUSR | S_IRUGO, |
925 | sysfs_tolerance(3); | 906 | show_tolerance, store_tolerance, 3), |
926 | 907 | }; | |
927 | #define device_create_file_tolerance(client, offset) \ | ||
928 | do { \ | ||
929 | device_create_file(&client->dev, &sensor_dev_attr_tolerance##offset.dev_attr); \ | ||
930 | } while (0) | ||
931 | |||
932 | 908 | ||
933 | /* For Smart Fan II */ | 909 | /* For Smart Fan II */ |
934 | static ssize_t | 910 | static ssize_t |
@@ -964,28 +940,34 @@ store_sf2_point(struct device *dev, struct device_attribute *attr, | |||
964 | return count; | 940 | return count; |
965 | } | 941 | } |
966 | 942 | ||
967 | #define sysfs_sf2_point(offset, index) \ | 943 | static struct sensor_device_attribute_2 sda_sf2_point[] = { |
968 | static SENSOR_DEVICE_ATTR_2(sf2_point##offset##_fan##index, S_IRUGO | S_IWUSR, \ | 944 | SENSOR_ATTR_2(sf2_point1_fan1, S_IRUGO | S_IWUSR, |
969 | show_sf2_point, store_sf2_point, offset, index); | 945 | show_sf2_point, store_sf2_point, 1, 1), |
970 | 946 | SENSOR_ATTR_2(sf2_point2_fan1, S_IRUGO | S_IWUSR, | |
971 | sysfs_sf2_point(1, 1); /* Fan1 */ | 947 | show_sf2_point, store_sf2_point, 2, 1), |
972 | sysfs_sf2_point(2, 1); /* Fan1 */ | 948 | SENSOR_ATTR_2(sf2_point3_fan1, S_IRUGO | S_IWUSR, |
973 | sysfs_sf2_point(3, 1); /* Fan1 */ | 949 | show_sf2_point, store_sf2_point, 3, 1), |
974 | sysfs_sf2_point(4, 1); /* Fan1 */ | 950 | SENSOR_ATTR_2(sf2_point4_fan1, S_IRUGO | S_IWUSR, |
975 | sysfs_sf2_point(1, 2); /* Fan2 */ | 951 | show_sf2_point, store_sf2_point, 4, 1), |
976 | sysfs_sf2_point(2, 2); /* Fan2 */ | 952 | |
977 | sysfs_sf2_point(3, 2); /* Fan2 */ | 953 | SENSOR_ATTR_2(sf2_point1_fan2, S_IRUGO | S_IWUSR, |
978 | sysfs_sf2_point(4, 2); /* Fan2 */ | 954 | show_sf2_point, store_sf2_point, 1, 2), |
979 | sysfs_sf2_point(1, 3); /* Fan3 */ | 955 | SENSOR_ATTR_2(sf2_point2_fan2, S_IRUGO | S_IWUSR, |
980 | sysfs_sf2_point(2, 3); /* Fan3 */ | 956 | show_sf2_point, store_sf2_point, 2, 2), |
981 | sysfs_sf2_point(3, 3); /* Fan3 */ | 957 | SENSOR_ATTR_2(sf2_point3_fan2, S_IRUGO | S_IWUSR, |
982 | sysfs_sf2_point(4, 3); /* Fan3 */ | 958 | show_sf2_point, store_sf2_point, 3, 2), |
983 | 959 | SENSOR_ATTR_2(sf2_point4_fan2, S_IRUGO | S_IWUSR, | |
984 | #define device_create_file_sf2_point(client, offset, index) \ | 960 | show_sf2_point, store_sf2_point, 4, 2), |
985 | do { \ | 961 | |
986 | device_create_file(&client->dev, \ | 962 | SENSOR_ATTR_2(sf2_point1_fan3, S_IRUGO | S_IWUSR, |
987 | &sensor_dev_attr_sf2_point##offset##_fan##index.dev_attr); \ | 963 | show_sf2_point, store_sf2_point, 1, 3), |
988 | } while (0) | 964 | SENSOR_ATTR_2(sf2_point2_fan3, S_IRUGO | S_IWUSR, |
965 | show_sf2_point, store_sf2_point, 2, 3), | ||
966 | SENSOR_ATTR_2(sf2_point3_fan3, S_IRUGO | S_IWUSR, | ||
967 | show_sf2_point, store_sf2_point, 3, 3), | ||
968 | SENSOR_ATTR_2(sf2_point4_fan3, S_IRUGO | S_IWUSR, | ||
969 | show_sf2_point, store_sf2_point, 4, 3), | ||
970 | }; | ||
989 | 971 | ||
990 | 972 | ||
991 | static ssize_t | 973 | static ssize_t |
@@ -1026,26 +1008,28 @@ store_sf2_level(struct device *dev, struct device_attribute *attr, | |||
1026 | return count; | 1008 | return count; |
1027 | } | 1009 | } |
1028 | 1010 | ||
1029 | #define sysfs_sf2_level(offset, index) \ | 1011 | static struct sensor_device_attribute_2 sda_sf2_level[] = { |
1030 | static SENSOR_DEVICE_ATTR_2(sf2_level##offset##_fan##index, S_IRUGO | S_IWUSR, \ | 1012 | SENSOR_ATTR_2(sf2_level1_fan1, S_IRUGO | S_IWUSR, |
1031 | show_sf2_level, store_sf2_level, offset, index); | 1013 | show_sf2_level, store_sf2_level, 1, 1), |
1032 | 1014 | SENSOR_ATTR_2(sf2_level2_fan1, S_IRUGO | S_IWUSR, | |
1033 | sysfs_sf2_level(1, 1); /* Fan1 */ | 1015 | show_sf2_level, store_sf2_level, 2, 1), |
1034 | sysfs_sf2_level(2, 1); /* Fan1 */ | 1016 | SENSOR_ATTR_2(sf2_level3_fan1, S_IRUGO | S_IWUSR, |
1035 | sysfs_sf2_level(3, 1); /* Fan1 */ | 1017 | show_sf2_level, store_sf2_level, 3, 1), |
1036 | sysfs_sf2_level(1, 2); /* Fan2 */ | 1018 | |
1037 | sysfs_sf2_level(2, 2); /* Fan2 */ | 1019 | SENSOR_ATTR_2(sf2_level1_fan2, S_IRUGO | S_IWUSR, |
1038 | sysfs_sf2_level(3, 2); /* Fan2 */ | 1020 | show_sf2_level, store_sf2_level, 1, 2), |
1039 | sysfs_sf2_level(1, 3); /* Fan3 */ | 1021 | SENSOR_ATTR_2(sf2_level2_fan2, S_IRUGO | S_IWUSR, |
1040 | sysfs_sf2_level(2, 3); /* Fan3 */ | 1022 | show_sf2_level, store_sf2_level, 2, 2), |
1041 | sysfs_sf2_level(3, 3); /* Fan3 */ | 1023 | SENSOR_ATTR_2(sf2_level3_fan2, S_IRUGO | S_IWUSR, |
1042 | 1024 | show_sf2_level, store_sf2_level, 3, 2), | |
1043 | #define device_create_file_sf2_level(client, offset, index) \ | 1025 | |
1044 | do { \ | 1026 | SENSOR_ATTR_2(sf2_level1_fan3, S_IRUGO | S_IWUSR, |
1045 | device_create_file(&client->dev, \ | 1027 | show_sf2_level, store_sf2_level, 1, 3), |
1046 | &sensor_dev_attr_sf2_level##offset##_fan##index.dev_attr); \ | 1028 | SENSOR_ATTR_2(sf2_level2_fan3, S_IRUGO | S_IWUSR, |
1047 | } while (0) | 1029 | show_sf2_level, store_sf2_level, 2, 3), |
1048 | 1030 | SENSOR_ATTR_2(sf2_level3_fan3, S_IRUGO | S_IWUSR, | |
1031 | show_sf2_level, store_sf2_level, 3, 3), | ||
1032 | }; | ||
1049 | 1033 | ||
1050 | /* This function is called when: | 1034 | /* This function is called when: |
1051 | * w83792d_driver is inserted (when this module is loaded), for each | 1035 | * w83792d_driver is inserted (when this module is loaded), for each |
@@ -1147,12 +1131,19 @@ ERROR_SC_0: | |||
1147 | return err; | 1131 | return err; |
1148 | } | 1132 | } |
1149 | 1133 | ||
1134 | static void device_create_file_fan(struct device *dev, int i) | ||
1135 | { | ||
1136 | device_create_file(dev, &sda_fan_input[i].dev_attr); | ||
1137 | device_create_file(dev, &sda_fan_div[i].dev_attr); | ||
1138 | device_create_file(dev, &sda_fan_min[i].dev_attr); | ||
1139 | } | ||
1150 | 1140 | ||
1151 | static int | 1141 | static int |
1152 | w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | 1142 | w83792d_detect(struct i2c_adapter *adapter, int address, int kind) |
1153 | { | 1143 | { |
1154 | int i = 0, val1 = 0, val2; | 1144 | int i = 0, val1 = 0, val2; |
1155 | struct i2c_client *new_client; | 1145 | struct i2c_client *client; |
1146 | struct device *dev; | ||
1156 | struct w83792d_data *data; | 1147 | struct w83792d_data *data; |
1157 | int err = 0; | 1148 | int err = 0; |
1158 | const char *client_name = ""; | 1149 | const char *client_name = ""; |
@@ -1170,12 +1161,13 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1170 | goto ERROR0; | 1161 | goto ERROR0; |
1171 | } | 1162 | } |
1172 | 1163 | ||
1173 | new_client = &data->client; | 1164 | client = &data->client; |
1174 | i2c_set_clientdata(new_client, data); | 1165 | dev = &client->dev; |
1175 | new_client->addr = address; | 1166 | i2c_set_clientdata(client, data); |
1176 | new_client->adapter = adapter; | 1167 | client->addr = address; |
1177 | new_client->driver = &w83792d_driver; | 1168 | client->adapter = adapter; |
1178 | new_client->flags = 0; | 1169 | client->driver = &w83792d_driver; |
1170 | client->flags = 0; | ||
1179 | 1171 | ||
1180 | /* Now, we do the remaining detection. */ | 1172 | /* Now, we do the remaining detection. */ |
1181 | 1173 | ||
@@ -1184,13 +1176,12 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1184 | force_*=... parameter, and the Winbond will be reset to the right | 1176 | force_*=... parameter, and the Winbond will be reset to the right |
1185 | bank. */ | 1177 | bank. */ |
1186 | if (kind < 0) { | 1178 | if (kind < 0) { |
1187 | if (w83792d_read_value(new_client, W83792D_REG_CONFIG) & 0x80) { | 1179 | if (w83792d_read_value(client, W83792D_REG_CONFIG) & 0x80) { |
1188 | dev_warn(&new_client->dev, "Detection failed at step " | 1180 | dev_warn(dev, "Detection failed at step 3\n"); |
1189 | "3\n"); | ||
1190 | goto ERROR1; | 1181 | goto ERROR1; |
1191 | } | 1182 | } |
1192 | val1 = w83792d_read_value(new_client, W83792D_REG_BANK); | 1183 | val1 = w83792d_read_value(client, W83792D_REG_BANK); |
1193 | val2 = w83792d_read_value(new_client, W83792D_REG_CHIPMAN); | 1184 | val2 = w83792d_read_value(client, W83792D_REG_CHIPMAN); |
1194 | /* Check for Winbond ID if in bank 0 */ | 1185 | /* Check for Winbond ID if in bank 0 */ |
1195 | if (!(val1 & 0x07)) { /* is Bank0 */ | 1186 | if (!(val1 & 0x07)) { /* is Bank0 */ |
1196 | if (((!(val1 & 0x80)) && (val2 != 0xa3)) || | 1187 | if (((!(val1 & 0x80)) && (val2 != 0xa3)) || |
@@ -1200,34 +1191,33 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1200 | } | 1191 | } |
1201 | /* If Winbond chip, address of chip and W83792D_REG_I2C_ADDR | 1192 | /* If Winbond chip, address of chip and W83792D_REG_I2C_ADDR |
1202 | should match */ | 1193 | should match */ |
1203 | if (w83792d_read_value(new_client, | 1194 | if (w83792d_read_value(client, |
1204 | W83792D_REG_I2C_ADDR) != address) { | 1195 | W83792D_REG_I2C_ADDR) != address) { |
1205 | dev_warn(&new_client->dev, "Detection failed " | 1196 | dev_warn(dev, "Detection failed at step 5\n"); |
1206 | "at step 5\n"); | ||
1207 | goto ERROR1; | 1197 | goto ERROR1; |
1208 | } | 1198 | } |
1209 | } | 1199 | } |
1210 | 1200 | ||
1211 | /* We have either had a force parameter, or we have already detected the | 1201 | /* We have either had a force parameter, or we have already detected the |
1212 | Winbond. Put it now into bank 0 and Vendor ID High Byte */ | 1202 | Winbond. Put it now into bank 0 and Vendor ID High Byte */ |
1213 | w83792d_write_value(new_client, | 1203 | w83792d_write_value(client, |
1214 | W83792D_REG_BANK, | 1204 | W83792D_REG_BANK, |
1215 | (w83792d_read_value(new_client, | 1205 | (w83792d_read_value(client, |
1216 | W83792D_REG_BANK) & 0x78) | 0x80); | 1206 | W83792D_REG_BANK) & 0x78) | 0x80); |
1217 | 1207 | ||
1218 | /* Determine the chip type. */ | 1208 | /* Determine the chip type. */ |
1219 | if (kind <= 0) { | 1209 | if (kind <= 0) { |
1220 | /* get vendor ID */ | 1210 | /* get vendor ID */ |
1221 | val2 = w83792d_read_value(new_client, W83792D_REG_CHIPMAN); | 1211 | val2 = w83792d_read_value(client, W83792D_REG_CHIPMAN); |
1222 | if (val2 != 0x5c) { /* the vendor is NOT Winbond */ | 1212 | if (val2 != 0x5c) { /* the vendor is NOT Winbond */ |
1223 | goto ERROR1; | 1213 | goto ERROR1; |
1224 | } | 1214 | } |
1225 | val1 = w83792d_read_value(new_client, W83792D_REG_WCHIPID); | 1215 | val1 = w83792d_read_value(client, W83792D_REG_WCHIPID); |
1226 | if (val1 == 0x7a) { | 1216 | if (val1 == 0x7a) { |
1227 | kind = w83792d; | 1217 | kind = w83792d; |
1228 | } else { | 1218 | } else { |
1229 | if (kind == 0) | 1219 | if (kind == 0) |
1230 | dev_warn(&new_client->dev, | 1220 | dev_warn(dev, |
1231 | "w83792d: Ignoring 'force' parameter for" | 1221 | "w83792d: Ignoring 'force' parameter for" |
1232 | " unknown chip at adapter %d, address" | 1222 | " unknown chip at adapter %d, address" |
1233 | " 0x%02x\n", i2c_adapter_id(adapter), | 1223 | " 0x%02x\n", i2c_adapter_id(adapter), |
@@ -1239,120 +1229,87 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) | |||
1239 | if (kind == w83792d) { | 1229 | if (kind == w83792d) { |
1240 | client_name = "w83792d"; | 1230 | client_name = "w83792d"; |
1241 | } else { | 1231 | } else { |
1242 | dev_err(&new_client->dev, "w83792d: Internal error: unknown" | 1232 | dev_err(dev, "w83792d: Internal error: unknown" |
1243 | " kind (%d)?!?", kind); | 1233 | " kind (%d)?!?", kind); |
1244 | goto ERROR1; | 1234 | goto ERROR1; |
1245 | } | 1235 | } |
1246 | 1236 | ||
1247 | /* Fill in the remaining client fields and put into the global list */ | 1237 | /* Fill in the remaining client fields and put into the global list */ |
1248 | strlcpy(new_client->name, client_name, I2C_NAME_SIZE); | 1238 | strlcpy(client->name, client_name, I2C_NAME_SIZE); |
1249 | data->type = kind; | 1239 | data->type = kind; |
1250 | 1240 | ||
1251 | data->valid = 0; | 1241 | data->valid = 0; |
1252 | init_MUTEX(&data->update_lock); | 1242 | init_MUTEX(&data->update_lock); |
1253 | 1243 | ||
1254 | /* Tell the I2C layer a new client has arrived */ | 1244 | /* Tell the I2C layer a new client has arrived */ |
1255 | if ((err = i2c_attach_client(new_client))) | 1245 | if ((err = i2c_attach_client(client))) |
1256 | goto ERROR1; | 1246 | goto ERROR1; |
1257 | 1247 | ||
1258 | if ((err = w83792d_detect_subclients(adapter, address, | 1248 | if ((err = w83792d_detect_subclients(adapter, address, |
1259 | kind, new_client))) | 1249 | kind, client))) |
1260 | goto ERROR2; | 1250 | goto ERROR2; |
1261 | 1251 | ||
1262 | /* Initialize the chip */ | 1252 | /* Initialize the chip */ |
1263 | w83792d_init_client(new_client); | 1253 | w83792d_init_client(client); |
1264 | 1254 | ||
1265 | /* A few vars need to be filled upon startup */ | 1255 | /* A few vars need to be filled upon startup */ |
1266 | for (i = 0; i < 7; i++) { | 1256 | for (i = 0; i < 7; i++) { |
1267 | data->fan_min[i] = w83792d_read_value(new_client, | 1257 | data->fan_min[i] = w83792d_read_value(client, |
1268 | W83792D_REG_FAN_MIN[i]); | 1258 | W83792D_REG_FAN_MIN[i]); |
1269 | } | 1259 | } |
1270 | 1260 | ||
1271 | /* Register sysfs hooks */ | 1261 | /* Register sysfs hooks */ |
1272 | data->class_dev = hwmon_device_register(&new_client->dev); | 1262 | data->class_dev = hwmon_device_register(dev); |
1273 | if (IS_ERR(data->class_dev)) { | 1263 | if (IS_ERR(data->class_dev)) { |
1274 | err = PTR_ERR(data->class_dev); | 1264 | err = PTR_ERR(data->class_dev); |
1275 | goto ERROR3; | 1265 | goto ERROR3; |
1276 | } | 1266 | } |
1277 | device_create_file_in(new_client, 0); | 1267 | for (i = 0; i < 9; i++) { |
1278 | device_create_file_in(new_client, 1); | 1268 | device_create_file(dev, &sda_in_input[i].dev_attr); |
1279 | device_create_file_in(new_client, 2); | 1269 | device_create_file(dev, &sda_in_max[i].dev_attr); |
1280 | device_create_file_in(new_client, 3); | 1270 | device_create_file(dev, &sda_in_min[i].dev_attr); |
1281 | device_create_file_in(new_client, 4); | 1271 | } |
1282 | device_create_file_in(new_client, 5); | 1272 | for (i = 0; i < 3; i++) |
1283 | device_create_file_in(new_client, 6); | 1273 | device_create_file_fan(dev, i); |
1284 | device_create_file_in(new_client, 7); | ||
1285 | device_create_file_in(new_client, 8); | ||
1286 | |||
1287 | device_create_file_fan(new_client, 1); | ||
1288 | device_create_file_fan(new_client, 2); | ||
1289 | device_create_file_fan(new_client, 3); | ||
1290 | 1274 | ||
1291 | /* Read GPIO enable register to check if pins for fan 4,5 are used as | 1275 | /* Read GPIO enable register to check if pins for fan 4,5 are used as |
1292 | GPIO */ | 1276 | GPIO */ |
1293 | val1 = w83792d_read_value(new_client, W83792D_REG_GPIO_EN); | 1277 | val1 = w83792d_read_value(client, W83792D_REG_GPIO_EN); |
1294 | if (!(val1 & 0x40)) | 1278 | if (!(val1 & 0x40)) |
1295 | device_create_file_fan(new_client, 4); | 1279 | device_create_file_fan(dev, 3); |
1296 | if (!(val1 & 0x20)) | 1280 | if (!(val1 & 0x20)) |
1297 | device_create_file_fan(new_client, 5); | 1281 | device_create_file_fan(dev, 4); |
1298 | 1282 | ||
1299 | val1 = w83792d_read_value(new_client, W83792D_REG_PIN); | 1283 | val1 = w83792d_read_value(client, W83792D_REG_PIN); |
1300 | if (val1 & 0x40) | 1284 | if (val1 & 0x40) |
1301 | device_create_file_fan(new_client, 6); | 1285 | device_create_file_fan(dev, 5); |
1302 | if (val1 & 0x04) | 1286 | if (val1 & 0x04) |
1303 | device_create_file_fan(new_client, 7); | 1287 | device_create_file_fan(dev, 6); |
1304 | 1288 | ||
1305 | device_create_file_temp1(new_client); /* Temp1 */ | 1289 | for (i = 0; i < 3; i++) { |
1306 | device_create_file_temp_add(new_client, 2); /* Temp2 */ | 1290 | device_create_file(dev, &sda_temp_input[i].dev_attr); |
1307 | device_create_file_temp_add(new_client, 3); /* Temp3 */ | 1291 | device_create_file(dev, &sda_temp_max[i].dev_attr); |
1308 | 1292 | device_create_file(dev, &sda_temp_max_hyst[i].dev_attr); | |
1309 | device_create_file_alarms(new_client); | 1293 | device_create_file(dev, &sda_thermal_cruise[i].dev_attr); |
1310 | 1294 | device_create_file(dev, &sda_tolerance[i].dev_attr); | |
1311 | device_create_file_pwm(new_client, 1); | 1295 | } |
1312 | device_create_file_pwm(new_client, 2); | 1296 | |
1313 | device_create_file_pwm(new_client, 3); | 1297 | device_create_file_alarms(); |
1314 | 1298 | ||
1315 | device_create_file_pwmenable(new_client, 1); | 1299 | for (i = 0; i < ARRAY_SIZE(sda_pwm); i++) { |
1316 | device_create_file_pwmenable(new_client, 2); | 1300 | device_create_file(dev, &sda_pwm[i].dev_attr); |
1317 | device_create_file_pwmenable(new_client, 3); | 1301 | device_create_file(dev, &sda_pwm_enable[i].dev_attr); |
1318 | 1302 | device_create_file(dev, &sda_pwm_mode[i].dev_attr); | |
1319 | device_create_file_pwm_mode(new_client, 1); | 1303 | } |
1320 | device_create_file_pwm_mode(new_client, 2); | 1304 | |
1321 | device_create_file_pwm_mode(new_client, 3); | 1305 | device_create_file_chassis(); |
1322 | 1306 | device_create_file_chassis_clear(); | |
1323 | device_create_file_chassis(new_client); | 1307 | |
1324 | device_create_file_chassis_clear(new_client); | 1308 | for (i = 0; i < ARRAY_SIZE(sda_sf2_point); i++) |
1325 | 1309 | device_create_file(dev, &sda_sf2_point[i].dev_attr); | |
1326 | device_create_file_thermal_cruise(new_client, 1); | 1310 | |
1327 | device_create_file_thermal_cruise(new_client, 2); | 1311 | for (i = 0; i < ARRAY_SIZE(sda_sf2_level); i++) |
1328 | device_create_file_thermal_cruise(new_client, 3); | 1312 | device_create_file(dev, &sda_sf2_level[i].dev_attr); |
1329 | |||
1330 | device_create_file_tolerance(new_client, 1); | ||
1331 | device_create_file_tolerance(new_client, 2); | ||
1332 | device_create_file_tolerance(new_client, 3); | ||
1333 | |||
1334 | device_create_file_sf2_point(new_client, 1, 1); /* Fan1 */ | ||
1335 | device_create_file_sf2_point(new_client, 2, 1); /* Fan1 */ | ||
1336 | device_create_file_sf2_point(new_client, 3, 1); /* Fan1 */ | ||
1337 | device_create_file_sf2_point(new_client, 4, 1); /* Fan1 */ | ||
1338 | device_create_file_sf2_point(new_client, 1, 2); /* Fan2 */ | ||
1339 | device_create_file_sf2_point(new_client, 2, 2); /* Fan2 */ | ||
1340 | device_create_file_sf2_point(new_client, 3, 2); /* Fan2 */ | ||
1341 | device_create_file_sf2_point(new_client, 4, 2); /* Fan2 */ | ||
1342 | device_create_file_sf2_point(new_client, 1, 3); /* Fan3 */ | ||
1343 | device_create_file_sf2_point(new_client, 2, 3); /* Fan3 */ | ||
1344 | device_create_file_sf2_point(new_client, 3, 3); /* Fan3 */ | ||
1345 | device_create_file_sf2_point(new_client, 4, 3); /* Fan3 */ | ||
1346 | |||
1347 | device_create_file_sf2_level(new_client, 1, 1); /* Fan1 */ | ||
1348 | device_create_file_sf2_level(new_client, 2, 1); /* Fan1 */ | ||
1349 | device_create_file_sf2_level(new_client, 3, 1); /* Fan1 */ | ||
1350 | device_create_file_sf2_level(new_client, 1, 2); /* Fan2 */ | ||
1351 | device_create_file_sf2_level(new_client, 2, 2); /* Fan2 */ | ||
1352 | device_create_file_sf2_level(new_client, 3, 2); /* Fan2 */ | ||
1353 | device_create_file_sf2_level(new_client, 1, 3); /* Fan3 */ | ||
1354 | device_create_file_sf2_level(new_client, 2, 3); /* Fan3 */ | ||
1355 | device_create_file_sf2_level(new_client, 3, 3); /* Fan3 */ | ||
1356 | 1313 | ||
1357 | return 0; | 1314 | return 0; |
1358 | 1315 | ||
@@ -1366,7 +1323,7 @@ ERROR3: | |||
1366 | kfree(data->lm75[1]); | 1323 | kfree(data->lm75[1]); |
1367 | } | 1324 | } |
1368 | ERROR2: | 1325 | ERROR2: |
1369 | i2c_detach_client(new_client); | 1326 | i2c_detach_client(client); |
1370 | ERROR1: | 1327 | ERROR1: |
1371 | kfree(data); | 1328 | kfree(data); |
1372 | ERROR0: | 1329 | ERROR0: |