Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=158ce07564b68d4215b9560213a089d6f7c5a4ea
Commit:     158ce07564b68d4215b9560213a089d6f7c5a4ea
Parent:     e432dc811bfb6b3d3ad618d99bd8d58132fec316
Author:     Jean Delvare <[EMAIL PROTECTED]>
AuthorDate: Sun Jun 17 16:09:12 2007 +0200
Committer:  Mark M. Hoffman <[EMAIL PROTECTED]>
CommitDate: Thu Jul 19 14:22:15 2007 -0400

    hwmon/w83627ehf: Preserve speed reading when changing fan min
    
    The w83627ehf driver changes the fan clock divider automatically when
    a new min fan speed is set. It is supposed to preserve the fan speed
    reading while doing so, bug doesn't really. Fix it.
    
    Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
    Signed-off-by: Mark M. Hoffman <[EMAIL PROTECTED]>
---
 drivers/hwmon/w83627ehf.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index 30a7640..f4d850c 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -716,10 +716,15 @@ store_fan_min(struct device *dev, struct device_attribute 
*attr,
        /* Write both the fan clock divider (if it changed) and the new
           fan min (unconditionally) */
        if (new_div != data->fan_div[nr]) {
-               if (new_div > data->fan_div[nr])
-                       data->fan[nr] >>= (data->fan_div[nr] - new_div);
-               else
-                       data->fan[nr] <<= (new_div - data->fan_div[nr]);
+               /* Preserve the fan speed reading */
+               if (data->fan[nr] != 0xff) {
+                       if (new_div > data->fan_div[nr])
+                               data->fan[nr] >>= new_div - data->fan_div[nr];
+                       else if (data->fan[nr] & 0x80)
+                               data->fan[nr] = 0xff;
+                       else
+                               data->fan[nr] <<= data->fan_div[nr] - new_div;
+               }
 
                dev_dbg(dev, "fan%u clock divider changed from %u to %u\n",
                        nr + 1, div_from_reg(data->fan_div[nr]),
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to