aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2009-12-09 14:35:59 -0500
committerJean Delvare <khali@linux-fr.org>2009-12-09 14:35:59 -0500
commit66344aa6adc4397f79f134ad122072dbe5abcb48 (patch)
tree82e423401b450f52b657d0bc7d91df6cb5482627 /drivers/hwmon
parentf95f0b4ce8cae533c3731e54a51892921db10ffe (diff)
hwmon: (f71882fg) Cleanup sysfs attr creation 1/2
This patch makes a number of cleanups to the sysfs attr creation in the f71882fg driver, this is a preparation patch for adding f71889fg support: * Add some comments to explain why some models need separate sysfs attr arrays for in / temp / fan / pwm * Rename a number of sysfs attr arrays to make their function clearer * Move the pwm#_auto_channels_temp attribute from the common to all models fan attr array to the per model auto mode pwm attr arrays, so that all the auto mode pwm attr are grouped together, and thus can be left out on models where we don't support auto pwm mode * Put fan_beep attr in their own array, so that only auto mode pwm attr remain in the per model pwm sysfs attr arrays. * Put the 4th special fan input for the f8000 in its own array, so that only auto mode pwm attr remain in the per model pwm sysfs attr arrays. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/f71882fg.c137
1 files changed, 89 insertions, 48 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 4146105f1a57..40dd6cf3e80d 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -258,7 +258,9 @@ static struct platform_driver f71882fg_driver = {
258 258
259static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); 259static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
260 260
261/* Temp and in attr for the f71858fg */ 261/* Temp and in attr for the f71858fg, the f71858fg is special as it
262 has its temperature indexes start at 0 (the others start at 1) and
263 it only has 3 voltage inputs */
262static struct sensor_device_attribute_2 f71858fg_in_temp_attr[] = { 264static struct sensor_device_attribute_2 f71858fg_in_temp_attr[] = {
263 SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0), 265 SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0),
264 SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1), 266 SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1),
@@ -302,8 +304,8 @@ static struct sensor_device_attribute_2 f71858fg_in_temp_attr[] = {
302 SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 2), 304 SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 2),
303}; 305};
304 306
305/* Temp and in attr common to both the f71862fg and f71882fg */ 307/* Temp and in attr common to the f71862fg, f71882fg and f71889fg */
306static struct sensor_device_attribute_2 f718x2fg_in_temp_attr[] = { 308static struct sensor_device_attribute_2 fxxxx_in_temp_attr[] = {
307 SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0), 309 SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0),
308 SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1), 310 SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1),
309 SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2), 311 SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2),
@@ -371,8 +373,8 @@ static struct sensor_device_attribute_2 f718x2fg_in_temp_attr[] = {
371 SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 3), 373 SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 3),
372}; 374};
373 375
374/* Temp and in attr found only on the f71882fg */ 376/* For models with in1 alarm capability */
375static struct sensor_device_attribute_2 f71882fg_in_temp_attr[] = { 377static struct sensor_device_attribute_2 fxxxx_in1_alarm_attr[] = {
376 SENSOR_ATTR_2(in1_max, S_IRUGO|S_IWUSR, show_in_max, store_in_max, 378 SENSOR_ATTR_2(in1_max, S_IRUGO|S_IWUSR, show_in_max, store_in_max,
377 0, 1), 379 0, 1),
378 SENSOR_ATTR_2(in1_beep, S_IRUGO|S_IWUSR, show_in_beep, store_in_beep, 380 SENSOR_ATTR_2(in1_beep, S_IRUGO|S_IWUSR, show_in_beep, store_in_beep,
@@ -383,6 +385,7 @@ static struct sensor_device_attribute_2 f71882fg_in_temp_attr[] = {
383/* Temp and in attr for the f8000 385/* Temp and in attr for the f8000
384 Note on the f8000 temp_ovt (crit) is used as max, and temp_high (max) 386 Note on the f8000 temp_ovt (crit) is used as max, and temp_high (max)
385 is used as hysteresis value to clear alarms 387 is used as hysteresis value to clear alarms
388 Also like the f71858fg its temperature indexes start at 0
386 */ 389 */
387static struct sensor_device_attribute_2 f8000_in_temp_attr[] = { 390static struct sensor_device_attribute_2 f8000_in_temp_attr[] = {
388 SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0), 391 SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0),
@@ -435,39 +438,36 @@ static struct sensor_device_attribute_2 fxxxx_fan_attr[] = {
435 store_pwm_enable, 0, 0), 438 store_pwm_enable, 0, 0),
436 SENSOR_ATTR_2(pwm1_interpolate, S_IRUGO|S_IWUSR, 439 SENSOR_ATTR_2(pwm1_interpolate, S_IRUGO|S_IWUSR,
437 show_pwm_interpolate, store_pwm_interpolate, 0, 0), 440 show_pwm_interpolate, store_pwm_interpolate, 0, 0),
438 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR,
439 show_pwm_auto_point_channel,
440 store_pwm_auto_point_channel, 0, 0),
441 441
442 SENSOR_ATTR_2(pwm2, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 1), 442 SENSOR_ATTR_2(pwm2, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 1),
443 SENSOR_ATTR_2(pwm2_enable, S_IRUGO|S_IWUSR, show_pwm_enable, 443 SENSOR_ATTR_2(pwm2_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
444 store_pwm_enable, 0, 1), 444 store_pwm_enable, 0, 1),
445 SENSOR_ATTR_2(pwm2_interpolate, S_IRUGO|S_IWUSR, 445 SENSOR_ATTR_2(pwm2_interpolate, S_IRUGO|S_IWUSR,
446 show_pwm_interpolate, store_pwm_interpolate, 0, 1), 446 show_pwm_interpolate, store_pwm_interpolate, 0, 1),
447 SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR,
448 show_pwm_auto_point_channel,
449 store_pwm_auto_point_channel, 0, 1),
450 447
451 SENSOR_ATTR_2(pwm3, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 2), 448 SENSOR_ATTR_2(pwm3, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0, 2),
452 SENSOR_ATTR_2(pwm3_enable, S_IRUGO|S_IWUSR, show_pwm_enable, 449 SENSOR_ATTR_2(pwm3_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
453 store_pwm_enable, 0, 2), 450 store_pwm_enable, 0, 2),
454 SENSOR_ATTR_2(pwm3_interpolate, S_IRUGO|S_IWUSR, 451 SENSOR_ATTR_2(pwm3_interpolate, S_IRUGO|S_IWUSR,
455 show_pwm_interpolate, store_pwm_interpolate, 0, 2), 452 show_pwm_interpolate, store_pwm_interpolate, 0, 2),
456 SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR,
457 show_pwm_auto_point_channel,
458 store_pwm_auto_point_channel, 0, 2),
459}; 453};
460 454
461/* Fan / PWM attr for the f71862fg, less pwms and less zones per pwm than the 455/* Attr for models which can beep on Fan alarm */
462 f71882fg */ 456static struct sensor_device_attribute_2 fxxxx_fan_beep_attr[] = {
463static struct sensor_device_attribute_2 f71862fg_fan_attr[] = {
464 SENSOR_ATTR_2(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep, 457 SENSOR_ATTR_2(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep,
465 store_fan_beep, 0, 0), 458 store_fan_beep, 0, 0),
466 SENSOR_ATTR_2(fan2_beep, S_IRUGO|S_IWUSR, show_fan_beep, 459 SENSOR_ATTR_2(fan2_beep, S_IRUGO|S_IWUSR, show_fan_beep,
467 store_fan_beep, 0, 1), 460 store_fan_beep, 0, 1),
468 SENSOR_ATTR_2(fan3_beep, S_IRUGO|S_IWUSR, show_fan_beep, 461 SENSOR_ATTR_2(fan3_beep, S_IRUGO|S_IWUSR, show_fan_beep,
469 store_fan_beep, 0, 2), 462 store_fan_beep, 0, 2),
463};
470 464
465/* PWM attr for the f71862fg, fewer pwms and fewer zones per pwm than the
466 f71858fg / f71882fg / f71889fg */
467static struct sensor_device_attribute_2 f71862fg_auto_pwm_attr[] = {
468 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR,
469 show_pwm_auto_point_channel,
470 store_pwm_auto_point_channel, 0, 0),
471 SENSOR_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO|S_IWUSR, 471 SENSOR_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO|S_IWUSR,
472 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, 472 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
473 1, 0), 473 1, 0),
@@ -487,6 +487,9 @@ static struct sensor_device_attribute_2 f71862fg_fan_attr[] = {
487 SENSOR_ATTR_2(pwm1_auto_point2_temp_hyst, S_IRUGO, 487 SENSOR_ATTR_2(pwm1_auto_point2_temp_hyst, S_IRUGO,
488 show_pwm_auto_point_temp_hyst, NULL, 3, 0), 488 show_pwm_auto_point_temp_hyst, NULL, 3, 0),
489 489
490 SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR,
491 show_pwm_auto_point_channel,
492 store_pwm_auto_point_channel, 0, 1),
490 SENSOR_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO|S_IWUSR, 493 SENSOR_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO|S_IWUSR,
491 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, 494 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
492 1, 1), 495 1, 1),
@@ -506,6 +509,9 @@ static struct sensor_device_attribute_2 f71862fg_fan_attr[] = {
506 SENSOR_ATTR_2(pwm2_auto_point2_temp_hyst, S_IRUGO, 509 SENSOR_ATTR_2(pwm2_auto_point2_temp_hyst, S_IRUGO,
507 show_pwm_auto_point_temp_hyst, NULL, 3, 1), 510 show_pwm_auto_point_temp_hyst, NULL, 3, 1),
508 511
512 SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR,
513 show_pwm_auto_point_channel,
514 store_pwm_auto_point_channel, 0, 2),
509 SENSOR_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO|S_IWUSR, 515 SENSOR_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO|S_IWUSR,
510 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, 516 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
511 1, 2), 517 1, 2),
@@ -526,8 +532,11 @@ static struct sensor_device_attribute_2 f71862fg_fan_attr[] = {
526 show_pwm_auto_point_temp_hyst, NULL, 3, 2), 532 show_pwm_auto_point_temp_hyst, NULL, 3, 2),
527}; 533};
528 534
529/* Fan / PWM attr common to both the f71882fg and f71858fg */ 535/* PWM attr common to the f71858fg, f71882fg and f71889fg */
530static struct sensor_device_attribute_2 f71882fg_f71858fg_fan_attr[] = { 536static struct sensor_device_attribute_2 fxxxx_auto_pwm_attr[] = {
537 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR,
538 show_pwm_auto_point_channel,
539 store_pwm_auto_point_channel, 0, 0),
531 SENSOR_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO|S_IWUSR, 540 SENSOR_ATTR_2(pwm1_auto_point1_pwm, S_IRUGO|S_IWUSR,
532 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, 541 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
533 0, 0), 542 0, 0),
@@ -566,6 +575,9 @@ static struct sensor_device_attribute_2 f71882fg_f71858fg_fan_attr[] = {
566 SENSOR_ATTR_2(pwm1_auto_point4_temp_hyst, S_IRUGO, 575 SENSOR_ATTR_2(pwm1_auto_point4_temp_hyst, S_IRUGO,
567 show_pwm_auto_point_temp_hyst, NULL, 3, 0), 576 show_pwm_auto_point_temp_hyst, NULL, 3, 0),
568 577
578 SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR,
579 show_pwm_auto_point_channel,
580 store_pwm_auto_point_channel, 0, 1),
569 SENSOR_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO|S_IWUSR, 581 SENSOR_ATTR_2(pwm2_auto_point1_pwm, S_IRUGO|S_IWUSR,
570 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, 582 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
571 0, 1), 583 0, 1),
@@ -604,6 +616,9 @@ static struct sensor_device_attribute_2 f71882fg_f71858fg_fan_attr[] = {
604 SENSOR_ATTR_2(pwm2_auto_point4_temp_hyst, S_IRUGO, 616 SENSOR_ATTR_2(pwm2_auto_point4_temp_hyst, S_IRUGO,
605 show_pwm_auto_point_temp_hyst, NULL, 3, 1), 617 show_pwm_auto_point_temp_hyst, NULL, 3, 1),
606 618
619 SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR,
620 show_pwm_auto_point_channel,
621 store_pwm_auto_point_channel, 0, 2),
607 SENSOR_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO|S_IWUSR, 622 SENSOR_ATTR_2(pwm3_auto_point1_pwm, S_IRUGO|S_IWUSR,
608 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, 623 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
609 0, 2), 624 0, 2),
@@ -644,14 +659,7 @@ static struct sensor_device_attribute_2 f71882fg_f71858fg_fan_attr[] = {
644}; 659};
645 660
646/* Fan / PWM attr found on the f71882fg but not on the f71858fg */ 661/* Fan / PWM attr found on the f71882fg but not on the f71858fg */
647static struct sensor_device_attribute_2 f71882fg_fan_attr[] = { 662static struct sensor_device_attribute_2 f71882fg_auto_pwm_attr[] = {
648 SENSOR_ATTR_2(fan1_beep, S_IRUGO|S_IWUSR, show_fan_beep,
649 store_fan_beep, 0, 0),
650 SENSOR_ATTR_2(fan2_beep, S_IRUGO|S_IWUSR, show_fan_beep,
651 store_fan_beep, 0, 1),
652 SENSOR_ATTR_2(fan3_beep, S_IRUGO|S_IWUSR, show_fan_beep,
653 store_fan_beep, 0, 2),
654
655 SENSOR_ATTR_2(fan4_input, S_IRUGO, show_fan, NULL, 0, 3), 663 SENSOR_ATTR_2(fan4_input, S_IRUGO, show_fan, NULL, 0, 3),
656 SENSOR_ATTR_2(fan4_full_speed, S_IRUGO|S_IWUSR, 664 SENSOR_ATTR_2(fan4_full_speed, S_IRUGO|S_IWUSR,
657 show_fan_full_speed, 665 show_fan_full_speed,
@@ -707,12 +715,18 @@ static struct sensor_device_attribute_2 f71882fg_fan_attr[] = {
707 show_pwm_auto_point_temp_hyst, NULL, 3, 3), 715 show_pwm_auto_point_temp_hyst, NULL, 3, 3),
708}; 716};
709 717
710/* Fan / PWM attr for the f8000, zones mapped to temp instead of to pwm! 718/* Fan attr specific to the f8000 (4th fan input can only measure speed) */
711 Also the register block at offset A0 maps to TEMP1 (so our temp2, as the
712 F8000 starts counting temps at 0), B0 maps the TEMP2 and C0 maps to TEMP0 */
713static struct sensor_device_attribute_2 f8000_fan_attr[] = { 719static struct sensor_device_attribute_2 f8000_fan_attr[] = {
714 SENSOR_ATTR_2(fan4_input, S_IRUGO, show_fan, NULL, 0, 3), 720 SENSOR_ATTR_2(fan4_input, S_IRUGO, show_fan, NULL, 0, 3),
721};
715 722
723/* PWM attr for the f8000, zones mapped to temp instead of to pwm!
724 Also the register block at offset A0 maps to TEMP1 (so our temp2, as the
725 F8000 starts counting temps at 0), B0 maps the TEMP2 and C0 maps to TEMP0 */
726static struct sensor_device_attribute_2 f8000_auto_pwm_attr[] = {
727 SENSOR_ATTR_2(pwm1_auto_channels_temp, S_IRUGO|S_IWUSR,
728 show_pwm_auto_point_channel,
729 store_pwm_auto_point_channel, 0, 0),
716 SENSOR_ATTR_2(temp1_auto_point1_pwm, S_IRUGO|S_IWUSR, 730 SENSOR_ATTR_2(temp1_auto_point1_pwm, S_IRUGO|S_IWUSR,
717 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, 731 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
718 0, 2), 732 0, 2),
@@ -751,6 +765,9 @@ static struct sensor_device_attribute_2 f8000_fan_attr[] = {
751 SENSOR_ATTR_2(temp1_auto_point4_temp_hyst, S_IRUGO, 765 SENSOR_ATTR_2(temp1_auto_point4_temp_hyst, S_IRUGO,
752 show_pwm_auto_point_temp_hyst, NULL, 3, 2), 766 show_pwm_auto_point_temp_hyst, NULL, 3, 2),
753 767
768 SENSOR_ATTR_2(pwm2_auto_channels_temp, S_IRUGO|S_IWUSR,
769 show_pwm_auto_point_channel,
770 store_pwm_auto_point_channel, 0, 1),
754 SENSOR_ATTR_2(temp2_auto_point1_pwm, S_IRUGO|S_IWUSR, 771 SENSOR_ATTR_2(temp2_auto_point1_pwm, S_IRUGO|S_IWUSR,
755 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, 772 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
756 0, 0), 773 0, 0),
@@ -789,6 +806,9 @@ static struct sensor_device_attribute_2 f8000_fan_attr[] = {
789 SENSOR_ATTR_2(temp2_auto_point4_temp_hyst, S_IRUGO, 806 SENSOR_ATTR_2(temp2_auto_point4_temp_hyst, S_IRUGO,
790 show_pwm_auto_point_temp_hyst, NULL, 3, 0), 807 show_pwm_auto_point_temp_hyst, NULL, 3, 0),
791 808
809 SENSOR_ATTR_2(pwm3_auto_channels_temp, S_IRUGO|S_IWUSR,
810 show_pwm_auto_point_channel,
811 store_pwm_auto_point_channel, 0, 2),
792 SENSOR_ATTR_2(temp3_auto_point1_pwm, S_IRUGO|S_IWUSR, 812 SENSOR_ATTR_2(temp3_auto_point1_pwm, S_IRUGO|S_IWUSR,
793 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm, 813 show_pwm_auto_point_pwm, store_pwm_auto_point_pwm,
794 0, 1), 814 0, 1),
@@ -1847,15 +1867,15 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
1847 break; 1867 break;
1848 case f71882fg: 1868 case f71882fg:
1849 err = f71882fg_create_sysfs_files(pdev, 1869 err = f71882fg_create_sysfs_files(pdev,
1850 f71882fg_in_temp_attr, 1870 fxxxx_in1_alarm_attr,
1851 ARRAY_SIZE(f71882fg_in_temp_attr)); 1871 ARRAY_SIZE(fxxxx_in1_alarm_attr));
1852 if (err) 1872 if (err)
1853 goto exit_unregister_sysfs; 1873 goto exit_unregister_sysfs;
1854 /* fall through! */ 1874 /* fall through! */
1855 case f71862fg: 1875 case f71862fg:
1856 err = f71882fg_create_sysfs_files(pdev, 1876 err = f71882fg_create_sysfs_files(pdev,
1857 f718x2fg_in_temp_attr, 1877 fxxxx_in_temp_attr,
1858 ARRAY_SIZE(f718x2fg_in_temp_attr)); 1878 ARRAY_SIZE(fxxxx_in_temp_attr));
1859 break; 1879 break;
1860 case f8000: 1880 case f8000:
1861 err = f71882fg_create_sysfs_files(pdev, 1881 err = f71882fg_create_sysfs_files(pdev,
@@ -1905,25 +1925,40 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
1905 switch (data->type) { 1925 switch (data->type) {
1906 case f71862fg: 1926 case f71862fg:
1907 err = f71882fg_create_sysfs_files(pdev, 1927 err = f71882fg_create_sysfs_files(pdev,
1908 f71862fg_fan_attr, 1928 fxxxx_fan_beep_attr,
1909 ARRAY_SIZE(f71862fg_fan_attr)); 1929 ARRAY_SIZE(fxxxx_fan_beep_attr));
1930 if (err)
1931 goto exit_unregister_sysfs;
1932 err = f71882fg_create_sysfs_files(pdev,
1933 f71862fg_auto_pwm_attr,
1934 ARRAY_SIZE(f71862fg_auto_pwm_attr));
1910 break; 1935 break;
1911 case f71882fg: 1936 case f71882fg:
1912 err = f71882fg_create_sysfs_files(pdev, 1937 err = f71882fg_create_sysfs_files(pdev,
1913 f71882fg_fan_attr, 1938 fxxxx_fan_beep_attr,
1914 ARRAY_SIZE(f71882fg_fan_attr)); 1939 ARRAY_SIZE(fxxxx_fan_beep_attr));
1940 if (err)
1941 goto exit_unregister_sysfs;
1942 err = f71882fg_create_sysfs_files(pdev,
1943 f71882fg_auto_pwm_attr,
1944 ARRAY_SIZE(f71882fg_auto_pwm_attr));
1915 if (err) 1945 if (err)
1916 goto exit_unregister_sysfs; 1946 goto exit_unregister_sysfs;
1917 /* fall through! */ 1947 /* fall through! */
1918 case f71858fg: 1948 case f71858fg:
1919 err = f71882fg_create_sysfs_files(pdev, 1949 err = f71882fg_create_sysfs_files(pdev,
1920 f71882fg_f71858fg_fan_attr, 1950 fxxxx_auto_pwm_attr,
1921 ARRAY_SIZE(f71882fg_f71858fg_fan_attr)); 1951 ARRAY_SIZE(fxxxx_auto_pwm_attr));
1922 break; 1952 break;
1923 case f8000: 1953 case f8000:
1924 err = f71882fg_create_sysfs_files(pdev, 1954 err = f71882fg_create_sysfs_files(pdev,
1925 f8000_fan_attr, 1955 f8000_fan_attr,
1926 ARRAY_SIZE(f8000_fan_attr)); 1956 ARRAY_SIZE(f8000_fan_attr));
1957 if (err)
1958 goto exit_unregister_sysfs;
1959 err = f71882fg_create_sysfs_files(pdev,
1960 f8000_auto_pwm_attr,
1961 ARRAY_SIZE(f8000_auto_pwm_attr));
1927 break; 1962 break;
1928 } 1963 }
1929 if (err) 1964 if (err)
@@ -1965,22 +2000,28 @@ static int f71882fg_remove(struct platform_device *pdev)
1965 below are supersets of the ones skipped. */ 2000 below are supersets of the ones skipped. */
1966 device_remove_file(&pdev->dev, &dev_attr_name); 2001 device_remove_file(&pdev->dev, &dev_attr_name);
1967 2002
1968 for (i = 0; i < ARRAY_SIZE(f718x2fg_in_temp_attr); i++) 2003 for (i = 0; i < ARRAY_SIZE(fxxxx_in_temp_attr); i++)
1969 device_remove_file(&pdev->dev, 2004 device_remove_file(&pdev->dev,
1970 &f718x2fg_in_temp_attr[i].dev_attr); 2005 &fxxxx_in_temp_attr[i].dev_attr);
1971 2006
1972 for (i = 0; i < ARRAY_SIZE(f71882fg_in_temp_attr); i++) 2007 for (i = 0; i < ARRAY_SIZE(fxxxx_in1_alarm_attr); i++)
1973 device_remove_file(&pdev->dev, 2008 device_remove_file(&pdev->dev,
1974 &f71882fg_in_temp_attr[i].dev_attr); 2009 &fxxxx_in1_alarm_attr[i].dev_attr);
1975 2010
1976 for (i = 0; i < ARRAY_SIZE(fxxxx_fan_attr); i++) 2011 for (i = 0; i < ARRAY_SIZE(fxxxx_fan_attr); i++)
1977 device_remove_file(&pdev->dev, &fxxxx_fan_attr[i].dev_attr); 2012 device_remove_file(&pdev->dev, &fxxxx_fan_attr[i].dev_attr);
1978 2013
1979 for (i = 0; i < ARRAY_SIZE(f71882fg_fan_attr); i++) 2014 for (i = 0; i < ARRAY_SIZE(fxxxx_fan_beep_attr); i++)
1980 device_remove_file(&pdev->dev, &f71882fg_fan_attr[i].dev_attr); 2015 device_remove_file(&pdev->dev,
2016 &fxxxx_fan_beep_attr[i].dev_attr);
1981 2017
1982 for (i = 0; i < ARRAY_SIZE(f8000_fan_attr); i++) 2018 for (i = 0; i < ARRAY_SIZE(f71882fg_auto_pwm_attr); i++)
1983 device_remove_file(&pdev->dev, &f8000_fan_attr[i].dev_attr); 2019 device_remove_file(&pdev->dev,
2020 &f71882fg_auto_pwm_attr[i].dev_attr);
2021
2022 for (i = 0; i < ARRAY_SIZE(f8000_auto_pwm_attr); i++)
2023 device_remove_file(&pdev->dev,
2024 &f8000_auto_pwm_attr[i].dev_attr);
1984 2025
1985 kfree(data); 2026 kfree(data);
1986 2027