]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
added 3 hwmon patches
authorGreg Kroah-Hartman <gregkh@suse.de>
Tue, 22 Nov 2005 18:30:14 +0000 (10:30 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 22 Nov 2005 18:30:14 +0000 (10:30 -0800)
queue/hwmon-fix-missing-it87-fan-div-init.patch [new file with mode: 0644]
queue/hwmon-lm78-fix-vid.patch [new file with mode: 0644]
queue/hwmon-w83627hf-missing-in0-limit-check.patch [new file with mode: 0644]
queue/series

diff --git a/queue/hwmon-fix-missing-it87-fan-div-init.patch b/queue/hwmon-fix-missing-it87-fan-div-init.patch
new file mode 100644 (file)
index 0000000..124c51b
--- /dev/null
@@ -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(+)
+
+--- linux-2.6.14.2.orig/drivers/hwmon/it87.c
++++ linux-2.6.14.2/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);
diff --git a/queue/hwmon-lm78-fix-vid.patch b/queue/hwmon-lm78-fix-vid.patch
new file mode 100644 (file)
index 0000000..c46f72c
--- /dev/null
@@ -0,0 +1,31 @@
+From khali@linux-fr.org Mon Nov 14 14:00:46 2005
+Date: Mon, 14 Nov 2005 23:11:45 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Subject: hwmon: Fix lm78 VID conversion
+Message-Id: <20051114231145.670478d0.khali@linux-fr.org>
+Content-Disposition: inline; filename=hwmon-lm78-fix-vid.patch
+
+Fix the lm78 VID reading, which I accidentally broke while making
+this driver use the common vid_from_reg function rather than
+reimplementing its own in 2.6.14-rc1.
+
+I'm not proud of it, trust me.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/hwmon/lm78.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- linux-2.6.14.2.orig/drivers/hwmon/lm78.c
++++ linux-2.6.14.2/drivers/hwmon/lm78.c
+@@ -451,7 +451,7 @@ static DEVICE_ATTR(fan3_div, S_IRUGO, sh
+ static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
+ {
+       struct lm78_data *data = lm78_update_device(dev);
+-      return sprintf(buf, "%d\n", vid_from_reg(82, data->vid));
++      return sprintf(buf, "%d\n", vid_from_reg(data->vid, 82));
+ }
+ static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
diff --git a/queue/hwmon-w83627hf-missing-in0-limit-check.patch b/queue/hwmon-w83627hf-missing-in0-limit-check.patch
new file mode 100644 (file)
index 0000000..bb1c486
--- /dev/null
@@ -0,0 +1,44 @@
+From khali@linux-fr.org Mon Nov 14 13:55:35 2005
+Date: Mon, 14 Nov 2005 23:08:38 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Yuan Mu <Ymu@winbond.com.tw>
+Subject: [PATCH] hwmon: Fix missing boundary check when setting W83627THF in0 limits
+Message-Id: <20051114230838.37a9f2d8.khali@linux-fr.org>
+Content-Disposition: inline; filename=hwmon-w83627hf-missing-in0-limit-check.patch
+
+From: Yuan Mu <Ymu@winbond.com.tw>
+
+Add SENSORS_LIMIT in store VCore limit functions. This fixes a potential
+u8 overflow on out-of-range user input.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/hwmon/w83627hf.c |    8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- linux-2.6.14.2.orig/drivers/hwmon/w83627hf.c
++++ linux-2.6.14.2/drivers/hwmon/w83627hf.c
+@@ -454,7 +454,9 @@ static ssize_t store_regs_in_min0(struct
+               (w83627thf == data->type || w83637hf == data->type))
+               /* use VRM9 calculation */
+-              data->in_min[0] = (u8)(((val * 100) - 70000 + 244) / 488);
++              data->in_min[0] =
++                      SENSORS_LIMIT(((val * 100) - 70000 + 244) / 488, 0,
++                                      255);
+       else
+               /* use VRM8 (standard) calculation */
+               data->in_min[0] = IN_TO_REG(val);
+@@ -479,7 +481,9 @@ static ssize_t store_regs_in_max0(struct
+               (w83627thf == data->type || w83637hf == data->type))
+               
+               /* use VRM9 calculation */
+-              data->in_max[0] = (u8)(((val * 100) - 70000 + 244) / 488);
++              data->in_max[0] =
++                      SENSORS_LIMIT(((val * 100) - 70000 + 244) / 488, 0,
++                                      255);
+       else
+               /* use VRM8 (standard) calculation */
+               data->in_max[0] = IN_TO_REG(val);
index 7d51e3b8557ebc1efc9d5b59c131c057d6b5fdfb..89b08cecc943b99df0dd492b1f7eeb9ec2ee2f49 100644 (file)
@@ -19,3 +19,7 @@ fix-sending-extension-headers-before.patch
 4GB-memory-intel-dual-core.patch
 acpi-fix-null-deref-in-video-lcd-brightness.patch
 drivers-isdn-hardware-eicon-os_4bri.c-correct-the-xdiloadfile-signature.patch
+hwmon-w83627hf-missing-in0-limit-check.patch
+hwmon-lm78-fix-vid.patch
+hwmon-fix-missing-it87-fan-div-init.patch
+