diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2005-11-21 14:33:42 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-11-21 14:33:42 -0800 |
commit | 6b66b70e636bfc67946c46b9b2f008100c2275f4 (patch) | |
tree | 9e900e883109145b315f1a85df7b9f1e805873d3 /i2c | |
parent | af1e85a51b90c33285e3487409edc11f3850c735 (diff) | |
download | patches-6b66b70e636bfc67946c46b9b2f008100c2275f4.tar.gz |
usb and i2c patch
Diffstat (limited to 'i2c')
-rw-r--r-- | i2c/hwmon-fix-missing-it87-fan-div-init.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/i2c/hwmon-fix-missing-it87-fan-div-init.patch b/i2c/hwmon-fix-missing-it87-fan-div-init.patch new file mode 100644 index 0000000000000..f9ba85678c192 --- /dev/null +++ b/i2c/hwmon-fix-missing-it87-fan-div-init.patch @@ -0,0 +1,41 @@ +From khali@linux-fr.org Mon Nov 21 10:05:47 2005 +Date: Mon, 21 Nov 2005 19:22:16 +0100 +From: Jean Delvare <khali@linux-fr.org> +To: Greg KH <greg@kroah.com> +Cc: Nicolas Mailhot <nicolas.mailhot@laposte.net> +Subject: hwmon: Fix missing it87 fan div init +Message-Id: <20051121192216.3a72d4c4.khali@linux-fr.org> + +Fix a bug where setting the low fan speed limits will not work if no +data was ever read through the sysfs interface and the fan clock +dividers have not been explicitely set yet either. The reason is that +data->fan_div[nr] may currently be used before it is initialized from +the chip register values. The fix is to explicitely initialize +data->fan_div[nr] before using it. + +Bug reported, and fix tested, by Nicolas Mailhot. + +Signed-off-by: Jean Delvare <khali@linux-fr.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/hwmon/it87.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- gregkh-2.6.orig/drivers/hwmon/it87.c ++++ gregkh-2.6/drivers/hwmon/it87.c +@@ -522,8 +522,15 @@ static ssize_t set_fan_min(struct device + struct i2c_client *client = to_i2c_client(dev); + struct it87_data *data = i2c_get_clientdata(client); + int val = simple_strtol(buf, NULL, 10); ++ u8 reg = it87_read_value(client, IT87_REG_FAN_DIV); + + down(&data->update_lock); ++ switch (nr) { ++ case 0: data->fan_div[nr] = reg & 0x07; break; ++ case 1: data->fan_div[nr] = (reg >> 3) & 0x07; break; ++ case 2: data->fan_div[nr] = (reg & 0x40) ? 3 : 1; break; ++ } ++ + data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); + it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]); + up(&data->update_lock); |