Skip to content

Commit

Permalink
hwmon/f71882fg: Break out test for auto pwm's controlled by digital r…
Browse files Browse the repository at this point in the history
…eadings

Putting this check in its own switch case rather then in the switch case
for adding pwm auto point sysfs attr is cleaner. This is a preparation patch
for adding support for more different models.

Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
  • Loading branch information
jwrdegoede authored and Guenter Roeck committed Mar 15, 2011
1 parent 78aa4f7 commit e48a7f1
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions drivers/hwmon/f71882fg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,27 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
goto exit_unregister_sysfs;
}

switch (data->type) {
case f71889fg:
for (i = 0; i < nr_fans; i++) {
data->pwm_auto_point_mapping[i] =
f71882fg_read8(data,
F71882FG_REG_POINT_MAPPING(i));
if (data->pwm_auto_point_mapping[i] & 0x80)
break;
}
if (i != nr_fans) {
dev_warn(&pdev->dev,
"Auto pwm controlled by raw digital "
"data, disabling pwm auto_point "
"sysfs attributes\n");
goto no_pwm_auto_point;
}
break;
default:
break;
}

switch (data->type) {
case f71862fg:
err = f71882fg_create_sysfs_files(pdev,
Expand All @@ -2090,30 +2111,15 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
f8000_auto_pwm_attr,
ARRAY_SIZE(f8000_auto_pwm_attr));
break;
case f71889fg:
for (i = 0; i < nr_fans; i++) {
data->pwm_auto_point_mapping[i] =
f71882fg_read8(data,
F71882FG_REG_POINT_MAPPING(i));
if (data->pwm_auto_point_mapping[i] & 0x80)
break;
}
if (i != nr_fans) {
dev_warn(&pdev->dev,
"Auto pwm controlled by raw digital "
"data, disabling pwm auto_point "
"sysfs attributes\n");
break;
}
/* fall through */
default: /* f71858fg / f71882fg */
default:
err = f71882fg_create_sysfs_files(pdev,
&fxxxx_auto_pwm_attr[0][0],
ARRAY_SIZE(fxxxx_auto_pwm_attr[0]) * nr_fans);
}
if (err)
goto exit_unregister_sysfs;

no_pwm_auto_point:
for (i = 0; i < nr_fans; i++)
dev_info(&pdev->dev, "Fan: %d is in %s mode\n", i + 1,
(data->pwm_enable & (1 << 2 * i)) ?
Expand Down

0 comments on commit e48a7f1

Please sign in to comment.