/[linux-patches]/genpatches-2.6/tags/2.6.14-6/1023_3_hwmon-it87-fan-speed-limits.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.14-6/1023_3_hwmon-it87-fan-speed-limits.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 233 - (hide annotations) (download)
Thu Dec 15 16:43:31 2005 UTC (12 years, 9 months ago) by dsd
File size: 1686 byte(s)
2.6.14-6 release
1 dsd 214 From khali@linux-fr.org Mon Nov 21 10:05:47 2005
2     Date: Mon, 21 Nov 2005 19:22:16 +0100
3     From: Jean Delvare <khali@linux-fr.org>
4     To: Greg KH <greg@kroah.com>
5     Cc: Nicolas Mailhot <nicolas.mailhot@laposte.net>
6     Subject: hwmon: Fix missing it87 fan div init
7     Message-Id: <20051121192216.3a72d4c4.khali@linux-fr.org>
8    
9     Fix a bug where setting the low fan speed limits will not work if no
10     data was ever read through the sysfs interface and the fan clock
11     dividers have not been explicitely set yet either. The reason is that
12     data->fan_div[nr] may currently be used before it is initialized from
13     the chip register values. The fix is to explicitely initialize
14     data->fan_div[nr] before using it.
15    
16     Bug reported, and fix tested, by Nicolas Mailhot.
17    
18     Signed-off-by: Jean Delvare <khali@linux-fr.org>
19     Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
20     Signed-off-by: Chris Wright <chrisw@osdl.org>
21     ---
22     drivers/hwmon/it87.c | 7 +++++++
23     1 file changed, 7 insertions(+)
24    
25     --- linux-2.6.14.2.orig/drivers/hwmon/it87.c
26     +++ linux-2.6.14.2/drivers/hwmon/it87.c
27     @@ -522,8 +522,15 @@ static ssize_t set_fan_min(struct device
28     struct i2c_client *client = to_i2c_client(dev);
29     struct it87_data *data = i2c_get_clientdata(client);
30     int val = simple_strtol(buf, NULL, 10);
31     + u8 reg = it87_read_value(client, IT87_REG_FAN_DIV);
32    
33     down(&data->update_lock);
34     + switch (nr) {
35     + case 0: data->fan_div[nr] = reg & 0x07; break;
36     + case 1: data->fan_div[nr] = (reg >> 3) & 0x07; break;
37     + case 2: data->fan_div[nr] = (reg & 0x40) ? 3 : 1; break;
38     + }
39     +
40     data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
41     it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]);
42     up(&data->update_lock);

  ViewVC Help
Powered by ViewVC 1.1.20