diff options
author | Jean Delvare <khali@linux-fr.org> | 2006-08-28 08:35:46 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-28 18:31:13 -0400 |
commit | 8ab4ec3ef45cc2facbe14c733ef7230e7d94fcf2 (patch) | |
tree | aee9c9ba26cbde2b7c1ffc89821d1d1bb02c959d | |
parent | 3543a53f6c5b58c233218327f671108590151876 (diff) |
it87: Cleanup set_fan_div
it87: Cleanup set_fan_div
We only change one fan clock divider at a time, so there is only one
fan min which needs to be saved and restored.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/hwmon/it87.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index bfad8975d1e5..e9ab8a32903b 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
@@ -564,14 +564,14 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, | |||
564 | struct i2c_client *client = to_i2c_client(dev); | 564 | struct i2c_client *client = to_i2c_client(dev); |
565 | struct it87_data *data = i2c_get_clientdata(client); | 565 | struct it87_data *data = i2c_get_clientdata(client); |
566 | unsigned long val = simple_strtoul(buf, NULL, 10); | 566 | unsigned long val = simple_strtoul(buf, NULL, 10); |
567 | int i, min[3]; | 567 | int min; |
568 | u8 old; | 568 | u8 old; |
569 | 569 | ||
570 | mutex_lock(&data->update_lock); | 570 | mutex_lock(&data->update_lock); |
571 | old = it87_read_value(client, IT87_REG_FAN_DIV); | 571 | old = it87_read_value(client, IT87_REG_FAN_DIV); |
572 | 572 | ||
573 | for (i = 0; i < 3; i++) | 573 | /* Save fan min limit */ |
574 | min[i] = FAN_FROM_REG(data->fan_min[i], DIV_FROM_REG(data->fan_div[i])); | 574 | min = FAN_FROM_REG(data->fan_min[nr], DIV_FROM_REG(data->fan_div[nr])); |
575 | 575 | ||
576 | switch (nr) { | 576 | switch (nr) { |
577 | case 0: | 577 | case 0: |
@@ -591,10 +591,10 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, | |||
591 | val |= 0x1 << 6; | 591 | val |= 0x1 << 6; |
592 | it87_write_value(client, IT87_REG_FAN_DIV, val); | 592 | it87_write_value(client, IT87_REG_FAN_DIV, val); |
593 | 593 | ||
594 | for (i = 0; i < 3; i++) { | 594 | /* Restore fan min limit */ |
595 | data->fan_min[i]=FAN_TO_REG(min[i], DIV_FROM_REG(data->fan_div[i])); | 595 | data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); |
596 | it87_write_value(client, IT87_REG_FAN_MIN(i), data->fan_min[i]); | 596 | it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]); |
597 | } | 597 | |
598 | mutex_unlock(&data->update_lock); | 598 | mutex_unlock(&data->update_lock); |
599 | return count; | 599 | return count; |
600 | } | 600 | } |