提交 8ab4ec3e 编写于 作者: J Jean Delvare 提交者: Greg Kroah-Hartman

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: NJean Delvare <khali@linux-fr.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 3543a53f
...@@ -564,14 +564,14 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, ...@@ -564,14 +564,14 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct it87_data *data = i2c_get_clientdata(client); struct it87_data *data = i2c_get_clientdata(client);
unsigned long val = simple_strtoul(buf, NULL, 10); unsigned long val = simple_strtoul(buf, NULL, 10);
int i, min[3]; int min;
u8 old; u8 old;
mutex_lock(&data->update_lock); mutex_lock(&data->update_lock);
old = it87_read_value(client, IT87_REG_FAN_DIV); old = it87_read_value(client, IT87_REG_FAN_DIV);
for (i = 0; i < 3; i++) /* Save fan min limit */
min[i] = FAN_FROM_REG(data->fan_min[i], DIV_FROM_REG(data->fan_div[i])); min = FAN_FROM_REG(data->fan_min[nr], DIV_FROM_REG(data->fan_div[nr]));
switch (nr) { switch (nr) {
case 0: case 0:
...@@ -591,10 +591,10 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, ...@@ -591,10 +591,10 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
val |= 0x1 << 6; val |= 0x1 << 6;
it87_write_value(client, IT87_REG_FAN_DIV, val); it87_write_value(client, IT87_REG_FAN_DIV, val);
for (i = 0; i < 3; i++) { /* Restore fan min limit */
data->fan_min[i]=FAN_TO_REG(min[i], DIV_FROM_REG(data->fan_div[i])); data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));
it87_write_value(client, IT87_REG_FAN_MIN(i), data->fan_min[i]); it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]);
}
mutex_unlock(&data->update_lock); mutex_unlock(&data->update_lock);
return count; return count;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册