aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/f71882fg.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-09-09 06:12:33 -0400
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-10-24 14:09:37 -0400
commit5584014256f704e1031d10d0bd291bc52fab5c40 (patch)
tree9f1f10889e527508d3be7c689958b7befc5cf87e /drivers/hwmon/f71882fg.c
parent3f67f83525d43220e4ea2eb9abee141a4ff97fe7 (diff)
hwmon/f71882fg: Make all fan/pwm attr tables 2 dimensional
This is a preparation patch for not registering fan/pwm attributes for some fans (rather then register them for all or for none). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon/f71882fg.c')
-rw-r--r--drivers/hwmon/f71882fg.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 2d96ed2bf8ed..c0805aab117a 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -605,7 +605,7 @@ static struct sensor_device_attribute_2 fxxxx_fan_beep_attr[] = {
605 605
606/* PWM attr for the f71862fg, fewer pwms and fewer zones per pwm than the 606/* PWM attr for the f71862fg, fewer pwms and fewer zones per pwm than the
607 standard models */ 607 standard models */
608static struct sensor_device_attribute_2 f71862fg_auto_pwm_attr[] = { 608static struct sensor_device_attribute_2 f71862fg_auto_pwm_attr[3][7] = { {
609 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR, 609 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR,
610 show_pwm_auto_point_channel, 610 show_pwm_auto_point_channel,
611 store_pwm_auto_point_channel, 0, 0), 611 store_pwm_auto_point_channel, 0, 0),
@@ -627,7 +627,7 @@ static struct sensor_device_attribute_2 f71862fg_auto_pwm_attr[] = {
627 0, 0), 627 0, 0),
628 SENSOR_ATTR_2(pwm1_auto_point2_temp_hyst, S_IRUGO, 628 SENSOR_ATTR_2(pwm1_auto_point2_temp_hyst, S_IRUGO,
629 show_pwm_auto_point_temp_hyst, NULL, 3, 0), 629 show_pwm_auto_point_temp_hyst, NULL, 3, 0),
630 630}, {
631 SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR, 631 SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR,
632 show_pwm_auto_point_channel, 632 show_pwm_auto_point_channel,
633 store_pwm_auto_point_channel, 0, 1), 633 store_pwm_auto_point_channel, 0, 1),
@@ -649,7 +649,7 @@ static struct sensor_device_attribute_2 f71862fg_auto_pwm_attr[] = {
649 0, 1), 649 0, 1),
650 SENSOR_ATTR_2(pwm2_auto_point2_temp_hyst, S_IRUGO, 650 SENSOR_ATTR_2(pwm2_auto_point2_temp_hyst, S_IRUGO,
651 show_pwm_auto_point_temp_hyst, NULL, 3, 1), 651 show_pwm_auto_point_temp_hyst, NULL, 3, 1),
652 652}, {
653 SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR, 653 SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR,
654 show_pwm_auto_point_channel, 654 show_pwm_auto_point_channel,
655 store_pwm_auto_point_channel, 0, 2), 655 store_pwm_auto_point_channel, 0, 2),
@@ -671,12 +671,12 @@ static struct sensor_device_attribute_2 f71862fg_auto_pwm_attr[] = {
671 0, 2), 671 0, 2),
672 SENSOR_ATTR_2(pwm3_auto_point2_temp_hyst, S_IRUGO, 672 SENSOR_ATTR_2(pwm3_auto_point2_temp_hyst, S_IRUGO,
673 show_pwm_auto_point_temp_hyst, NULL, 3, 2), 673 show_pwm_auto_point_temp_hyst, NULL, 3, 2),
674}; 674} };
675 675
676/* PWM attr for the f71808e/f71869, almost identical to the f71862fg, but the 676/* PWM attr for the f71808e/f71869, almost identical to the f71862fg, but the
677 pwm setting when the temperature is above the pwmX_auto_point1_temp can be 677 pwm setting when the temperature is above the pwmX_auto_point1_temp can be
678 programmed instead of being hardcoded to 0xff */ 678 programmed instead of being hardcoded to 0xff */
679static struct sensor_device_attribute_2 f71869_auto_pwm_attr[] = { 679static struct sensor_device_attribute_2 f71869_auto_pwm_attr[3][8] = { {
680 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR, 680 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR,
681 show_pwm_auto_point_channel, 681 show_pwm_auto_point_channel,
682 store_pwm_auto_point_channel, 0, 0), 682 store_pwm_auto_point_channel, 0, 0),
@@ -701,7 +701,7 @@ static struct sensor_device_attribute_2 f71869_auto_pwm_attr[] = {
701 0, 0), 701 0, 0),
702 SENSOR_ATTR_2(pwm1_auto_point2_temp_hyst, S_IRUGO, 702 SENSOR_ATTR_2(pwm1_auto_point2_temp_hyst, S_IRUGO,
703 show_pwm_auto_point_temp_hyst, NULL, 3, 0), 703 show_pwm_auto_point_temp_hyst, NULL, 3, 0),
704 704}, {
705 SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR, 705 SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR,
706 show_pwm_auto_point_channel, 706 show_pwm_auto_point_channel,
707 store_pwm_auto_point_channel, 0, 1), 707 store_pwm_auto_point_channel, 0, 1),
@@ -726,7 +726,7 @@ static struct sensor_device_attribute_2 f71869_auto_pwm_attr[] = {
726 0, 1), 726 0, 1),
727 SENSOR_ATTR_2(pwm2_auto_point2_temp_hyst, S_IRUGO, 727 SENSOR_ATTR_2(pwm2_auto_point2_temp_hyst, S_IRUGO,
728 show_pwm_auto_point_temp_hyst, NULL, 3, 1), 728 show_pwm_auto_point_temp_hyst, NULL, 3, 1),
729 729}, {
730 SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR, 730 SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR,
731 show_pwm_auto_point_channel, 731 show_pwm_auto_point_channel,
732 store_pwm_auto_point_channel, 0, 2), 732 store_pwm_auto_point_channel, 0, 2),
@@ -751,7 +751,7 @@ static struct sensor_device_attribute_2 f71869_auto_pwm_attr[] = {
751 0, 2), 751 0, 2),
752 SENSOR_ATTR_2(pwm3_auto_point2_temp_hyst, S_IRUGO, 752 SENSOR_ATTR_2(pwm3_auto_point2_temp_hyst, S_IRUGO,
753 show_pwm_auto_point_temp_hyst, NULL, 3, 2), 753 show_pwm_auto_point_temp_hyst, NULL, 3, 2),
754}; 754} };
755 755
756/* PWM attr for the standard models */ 756/* PWM attr for the standard models */
757static struct sensor_device_attribute_2 fxxxx_auto_pwm_attr[4][14] = { { 757static struct sensor_device_attribute_2 fxxxx_auto_pwm_attr[4][14] = { {
@@ -928,7 +928,7 @@ static struct sensor_device_attribute_2 f8000_fan_attr[] = {
928/* PWM attr for the f8000, zones mapped to temp instead of to pwm! 928/* PWM attr for the f8000, zones mapped to temp instead of to pwm!
929 Also the register block at offset A0 maps to TEMP1 (so our temp2, as the 929 Also the register block at offset A0 maps to TEMP1 (so our temp2, as the
930 F8000 starts counting temps at 0), B0 maps the TEMP2 and C0 maps to TEMP0 */ 930 F8000 starts counting temps at 0), B0 maps the TEMP2 and C0 maps to TEMP0 */
931static struct sensor_device_attribute_2 f8000_auto_pwm_attr[] = { 931static struct sensor_device_attribute_2 f8000_auto_pwm_attr[3][14] = { {
932 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR, 932 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR,
933 show_pwm_auto_point_channel, 933 show_pwm_auto_point_channel,
934 store_pwm_auto_point_channel, 0, 0), 934 store_pwm_auto_point_channel, 0, 0),
@@ -969,7 +969,7 @@ static struct sensor_device_attribute_2 f8000_auto_pwm_attr[] = {
969 show_pwm_auto_point_temp_hyst, NULL, 2, 2), 969 show_pwm_auto_point_temp_hyst, NULL, 2, 2),
970 SENSOR_ATTR_2(temp1_auto_point4_temp_hyst, S_IRUGO, 970 SENSOR_ATTR_2(temp1_auto_point4_temp_hyst, S_IRUGO,
971 show_pwm_auto_point_temp_hyst, NULL, 3, 2), 971 show_pwm_auto_point_temp_hyst, NULL, 3, 2),
972 972}, {
973 SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR, 973 SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR,
974 show_pwm_auto_point_channel, 974 show_pwm_auto_point_channel,
975 store_pwm_auto_point_channel, 0, 1), 975 store_pwm_auto_point_channel, 0, 1),
@@ -1010,7 +1010,7 @@ static struct sensor_device_attribute_2 f8000_auto_pwm_attr[] = {
1010 show_pwm_auto_point_temp_hyst, NULL, 2, 0), 1010 show_pwm_auto_point_temp_hyst, NULL, 2, 0),
1011 SENSOR_ATTR_2(temp2_auto_point4_temp_hyst, S_IRUGO, 1011 SENSOR_ATTR_2(temp2_auto_point4_temp_hyst, S_IRUGO,
1012 show_pwm_auto_point_temp_hyst, NULL, 3, 0), 1012 show_pwm_auto_point_temp_hyst, NULL, 3, 0),
1013 1013}, {
1014 SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR, 1014 SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR,
1015 show_pwm_auto_point_channel, 1015 show_pwm_auto_point_channel,
1016 store_pwm_auto_point_channel, 0, 2), 1016 store_pwm_auto_point_channel, 0, 2),
@@ -1051,7 +1051,7 @@ static struct sensor_device_attribute_2 f8000_auto_pwm_attr[] = {
1051 show_pwm_auto_point_temp_hyst, NULL, 2, 1), 1051 show_pwm_auto_point_temp_hyst, NULL, 2, 1),
1052 SENSOR_ATTR_2(temp3_auto_point4_temp_hyst, S_IRUGO, 1052 SENSOR_ATTR_2(temp3_auto_point4_temp_hyst, S_IRUGO,
1053 show_pwm_auto_point_temp_hyst, NULL, 3, 1), 1053 show_pwm_auto_point_temp_hyst, NULL, 3, 1),
1054}; 1054} };
1055 1055
1056/* Super I/O functions */ 1056/* Super I/O functions */
1057static inline int superio_inb(int base, int reg) 1057static inline int superio_inb(int base, int reg)
@@ -2351,14 +2351,15 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2351 break; 2351 break;
2352 case f71862fg: 2352 case f71862fg:
2353 err = f71882fg_create_sysfs_files(pdev, 2353 err = f71882fg_create_sysfs_files(pdev,
2354 f71862fg_auto_pwm_attr, 2354 &f71862fg_auto_pwm_attr[0][0],
2355 ARRAY_SIZE(f71862fg_auto_pwm_attr)); 2355 ARRAY_SIZE(f71862fg_auto_pwm_attr[0]) *
2356 nr_fans);
2356 break; 2357 break;
2357 case f71808e: 2358 case f71808e:
2358 case f71869: 2359 case f71869:
2359 err = f71882fg_create_sysfs_files(pdev, 2360 err = f71882fg_create_sysfs_files(pdev,
2360 f71869_auto_pwm_attr, 2361 &f71869_auto_pwm_attr[0][0],
2361 ARRAY_SIZE(f71869_auto_pwm_attr)); 2362 ARRAY_SIZE(f71869_auto_pwm_attr[0]) * nr_fans);
2362 break; 2363 break;
2363 case f8000: 2364 case f8000:
2364 err = f71882fg_create_sysfs_files(pdev, 2365 err = f71882fg_create_sysfs_files(pdev,
@@ -2367,8 +2368,8 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
2367 if (err) 2368 if (err)
2368 goto exit_unregister_sysfs; 2369 goto exit_unregister_sysfs;
2369 err = f71882fg_create_sysfs_files(pdev, 2370 err = f71882fg_create_sysfs_files(pdev,
2370 f8000_auto_pwm_attr, 2371 &f8000_auto_pwm_attr[0][0],
2371 ARRAY_SIZE(f8000_auto_pwm_attr)); 2372 ARRAY_SIZE(f8000_auto_pwm_attr[0]) * nr_fans);
2372 break; 2373 break;
2373 default: 2374 default:
2374 err = f71882fg_create_sysfs_files(pdev, 2375 err = f71882fg_create_sysfs_files(pdev,
@@ -2476,22 +2477,23 @@ static int f71882fg_remove(struct platform_device *pdev)
2476 break; 2477 break;
2477 case f71862fg: 2478 case f71862fg:
2478 f71882fg_remove_sysfs_files(pdev, 2479 f71882fg_remove_sysfs_files(pdev,
2479 f71862fg_auto_pwm_attr, 2480 &f71862fg_auto_pwm_attr[0][0],
2480 ARRAY_SIZE(f71862fg_auto_pwm_attr)); 2481 ARRAY_SIZE(f71862fg_auto_pwm_attr[0]) *
2482 nr_fans);
2481 break; 2483 break;
2482 case f71808e: 2484 case f71808e:
2483 case f71869: 2485 case f71869:
2484 f71882fg_remove_sysfs_files(pdev, 2486 f71882fg_remove_sysfs_files(pdev,
2485 f71869_auto_pwm_attr, 2487 &f71869_auto_pwm_attr[0][0],
2486 ARRAY_SIZE(f71869_auto_pwm_attr)); 2488 ARRAY_SIZE(f71869_auto_pwm_attr[0]) * nr_fans);
2487 break; 2489 break;
2488 case f8000: 2490 case f8000:
2489 f71882fg_remove_sysfs_files(pdev, 2491 f71882fg_remove_sysfs_files(pdev,
2490 f8000_fan_attr, 2492 f8000_fan_attr,
2491 ARRAY_SIZE(f8000_fan_attr)); 2493 ARRAY_SIZE(f8000_fan_attr));
2492 f71882fg_remove_sysfs_files(pdev, 2494 f71882fg_remove_sysfs_files(pdev,
2493 f8000_auto_pwm_attr, 2495 &f8000_auto_pwm_attr[0][0],
2494 ARRAY_SIZE(f8000_auto_pwm_attr)); 2496 ARRAY_SIZE(f8000_auto_pwm_attr[0]) * nr_fans);
2495 break; 2497 break;
2496 default: 2498 default:
2497 f71882fg_remove_sysfs_files(pdev, 2499 f71882fg_remove_sysfs_files(pdev,