Commit 7b218f51 authored by Jean Delvare's avatar Jean Delvare Committed by Patrick Mochel

[PATCH] I2C: initialize fan_mins in w83781d, asb100 and lm78

Quoting myself:

> While testing, I found a corner case that isn't handled properly. It
> doesn't seem to be handled by the lm78 and the asb100 either. Setting
> fanN_div before ever reading from the chip or setting fanN_min will
> make use of fanN_min while it was never initialized.

The following patch addesses the issue. Tested to work on my AS99127F
rev.1 (which means that only the changes to the w83781d driver were
actually tested). Testers welcome.
parent b3da4be8
...@@ -807,6 +807,11 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -807,6 +807,11 @@ static int asb100_detect(struct i2c_adapter *adapter, int address, int kind)
/* Initialize the chip */ /* Initialize the chip */
asb100_init_client(new_client); asb100_init_client(new_client);
/* A few vars need to be filled upon startup */
data->fan_min[0] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(0));
data->fan_min[1] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(1));
data->fan_min[2] = asb100_read_value(new_client, ASB100_REG_FAN_MIN(2));
/* Register sysfs hooks */ /* Register sysfs hooks */
device_create_file_in(new_client, 0); device_create_file_in(new_client, 0);
device_create_file_in(new_client, 1); device_create_file_in(new_client, 1);
......
...@@ -625,6 +625,12 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -625,6 +625,12 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
/* Initialize the LM78 chip */ /* Initialize the LM78 chip */
lm78_init_client(new_client); lm78_init_client(new_client);
/* A few vars need to be filled upon startup */
for (i = 0; i < 3; i++) {
data->fan_min[i] = lm78_read_value(new_client,
LM78_REG_FAN_MIN(i));
}
/* Register sysfs hooks */ /* Register sysfs hooks */
device_create_file(&new_client->dev, &dev_attr_in0_input); device_create_file(&new_client->dev, &dev_attr_in0_input);
device_create_file(&new_client->dev, &dev_attr_in0_min); device_create_file(&new_client->dev, &dev_attr_in0_min);
......
...@@ -1252,6 +1252,12 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind) ...@@ -1252,6 +1252,12 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
/* Initialize the chip */ /* Initialize the chip */
w83781d_init_client(new_client); w83781d_init_client(new_client);
/* A few vars need to be filled upon startup */
for (i = 1; i <= 3; i++) {
data->fan_min[i - 1] = w83781d_read_value(new_client,
W83781D_REG_FAN_MIN(i));
}
/* Register sysfs hooks */ /* Register sysfs hooks */
device_create_file_in(new_client, 0); device_create_file_in(new_client, 0);
if (kind != w83783s && kind != w83697hf) if (kind != w83783s && kind != w83697hf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment