[PATCH] I2C: Setting w83627hf fan divisor 128 fails.
authorGrant Coady <grant_lkml@dodo.com.au>
Thu, 12 May 2005 03:41:51 +0000 (13:41 +1000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 22 Jun 2005 04:51:56 +0000 (21:51 -0700)
Jarkko Lavinen provided patch to fix: "couldn't set the divisor 128
through fan1_div sysfs entry even though the chip supports it and
setting divisors 1..64 worked. This was due to POWER_TO_REG() only
checking 2's powers 0 till 5 but not 6."

This patch applies that fix to w83627hf and w83781d drivers.

Signed-off-by: Grant Coady <gcoady@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/i2c/chips/w83627hf.c
drivers/i2c/chips/w83781d.c

index 4f1bff5..bd87a42 100644 (file)
@@ -264,7 +264,7 @@ static inline u8 DIV_TO_REG(long val)
 {
        int i;
        val = SENSORS_LIMIT(val, 1, 128) >> 1;
-       for (i = 0; i < 6; i++) {
+       for (i = 0; i < 7; i++) {
                if (val == 0)
                        break;
                val >>= 1;
index 8912390..f47aee8 100644 (file)
@@ -192,7 +192,7 @@ DIV_TO_REG(long val, enum chips type)
        val = SENSORS_LIMIT(val, 1,
                            ((type == w83781d
                              || type == as99127f) ? 8 : 128)) >> 1;
-       for (i = 0; i < 6; i++) {
+       for (i = 0; i < 7; i++) {
                if (val == 0)
                        break;
                val >>= 1;