aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/it87.c14
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}