summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2009-06-15 18:39:51 +0200
committerJean Delvare <khali@linux-fr.org>2009-06-15 18:39:51 +0200
commit996cadb2bf3787adcf4e164e1b351966c9e787f6 (patch)
treeee8fb6f578d80bf85f6dfd05459a5bdd88c8a6e5 /drivers/hwmon
parent3fc7838a20cdd9aab0077f355b8c44135cd4b6bd (diff)
downloadblackbird-op-linux-996cadb2bf3787adcf4e164e1b351966c9e787f6.tar.gz
blackbird-op-linux-996cadb2bf3787adcf4e164e1b351966c9e787f6.zip
hwmon: (f71882fg) Sanity check f8000 pwm settings
We depend up on the pwm_enable register (0x96) not containing any reserved settings in various places. We were already checking to make sure there were no reserved settings in the register for the f71862fg, this patch adds the same checking for the f8000, while at it it also moves the code to a more apropriate place so we don't need to check if the fan/pwm part of the IC is enabled twice. 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.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index eb324e604105..a65eac836174 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -1735,19 +1735,6 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
goto exit_free;
}
- data->pwm_enable = f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
- /* If it is a 71862 and the fan / pwm part is enabled sanity check
- the pwm settings */
- if (data->type == f71862fg && (start_reg & 0x02)) {
- if ((data->pwm_enable & 0x15) != 0x15) {
- dev_err(&pdev->dev,
- "Invalid (reserved) pwm settings: 0x%02x\n",
- (unsigned int)data->pwm_enable);
- err = -ENODEV;
- goto exit_free;
- }
- }
-
/* Register sysfs interface files */
err = device_create_file(&pdev->dev, &dev_attr_name);
if (err)
@@ -1778,6 +1765,29 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
}
if (start_reg & 0x02) {
+ data->pwm_enable =
+ f71882fg_read8(data, F71882FG_REG_PWM_ENABLE);
+
+ /* Sanity check the pwm settings */
+ switch (data->type) {
+ case f71862fg:
+ err = (data->pwm_enable & 0x15) != 0x15;
+ break;
+ case f71882fg:
+ err = 0;
+ break;
+ case f8000:
+ err = data->pwm_enable & 0x20;
+ break;
+ }
+ if (err) {
+ dev_err(&pdev->dev,
+ "Invalid (reserved) pwm settings: 0x%02x\n",
+ (unsigned int)data->pwm_enable);
+ err = -ENODEV;
+ goto exit_unregister_sysfs;
+ }
+
err = f71882fg_create_sysfs_files(pdev, fxxxx_fan_attr,
ARRAY_SIZE(fxxxx_fan_attr));
if (err)
OpenPOWER on IntegriCloud