From: Hans de Goede Date: Wed, 7 Jan 2009 15:37:30 +0000 (+0100) Subject: hwmon: (f71882fg) Fix auto_channels_temp temp numbering with f8000 X-Git-Tag: v2.6.29-rc1~190^2~14 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=30453018655a3acd5f59e793da55a2f969ed9c32;p=linux-2.6-omap-h63xx.git hwmon: (f71882fg) Fix auto_channels_temp temp numbering with f8000 Adjust auto_channels_temp show and store functions for different numbering of temps between f8000 and other supported models. Signed-off-by: Hans de Goede Signed-off-by: Jean Delvare --- diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index f4998bf82ca..0ef7265336b 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c @@ -1615,8 +1615,9 @@ static ssize_t show_pwm_auto_point_channel(struct device *dev, int result; struct f71882fg_data *data = f71882fg_update_device(dev); int nr = to_sensor_dev_attr_2(devattr)->index; + int temp_start = (data->type == f8000) ? 0 : 1; - result = 1 << ((data->pwm_auto_point_mapping[nr] & 3) - 1); + result = 1 << ((data->pwm_auto_point_mapping[nr] & 3) - temp_start); return sprintf(buf, "%d\n", result); } @@ -1627,20 +1628,23 @@ static ssize_t store_pwm_auto_point_channel(struct device *dev, { struct f71882fg_data *data = dev_get_drvdata(dev); int nr = to_sensor_dev_attr_2(devattr)->index; + int temp_start = (data->type == f8000) ? 0 : 1; long val = simple_strtol(buf, NULL, 10); + switch (val) { case 1: - val = 1; + val = 0; break; case 2: - val = 2; + val = 1; break; case 4: - val = 3; + val = 2; break; default: return -EINVAL; } + val += temp_start; mutex_lock(&data->update_lock); data->pwm_auto_point_mapping[nr] = f71882fg_read8(data, F71882FG_REG_POINT_MAPPING(nr));