Commit d088c14f authored by Jean Delvare's avatar Jean Delvare Committed by Greg Kroah-Hartman

[PATCH] I2C: Chip driver initialization fixes

fixes all chip drivers by moving the initialization before any sysfs
entry is created.
parent d0a2fba8
......@@ -322,6 +322,10 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind)
if ((err = i2c_attach_client(new_client)))
goto error3;
/* Initialize the ADM1021 chip */
adm1021_init_client(new_client);
/* Register sysfs hooks */
device_create_file(&new_client->dev, &dev_attr_temp_max1);
device_create_file(&new_client->dev, &dev_attr_temp_min1);
device_create_file(&new_client->dev, &dev_attr_temp_input1);
......@@ -332,8 +336,6 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind)
if (data->type == adm1021)
device_create_file(&new_client->dev, &dev_attr_die_code);
/* Initialize the ADM1021 chip */
adm1021_init_client(new_client);
return 0;
error3:
......
......@@ -701,7 +701,10 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
if ((err = i2c_attach_client(new_client)))
goto ERROR1;
/* register sysfs hooks */
/* Initialize the IT87 chip */
it87_init_client(new_client, data);
/* Register sysfs hooks */
device_create_file(&new_client->dev, &dev_attr_in_input0);
device_create_file(&new_client->dev, &dev_attr_in_input1);
device_create_file(&new_client->dev, &dev_attr_in_input2);
......@@ -750,8 +753,6 @@ int it87_detect(struct i2c_adapter *adapter, int address, int kind)
device_create_file(&new_client->dev, &dev_attr_fan_div3);
device_create_file(&new_client->dev, &dev_attr_alarm);
/* Initialize the IT87 chip */
it87_init_client(new_client, data);
return 0;
ERROR1:
......
......@@ -204,11 +204,14 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind)
if ((err = i2c_attach_client(new_client)))
goto exit_free;
/* Initialize the LM75 chip */
lm75_init_client(new_client);
/* Register sysfs hooks */
device_create_file(&new_client->dev, &dev_attr_temp_max);
device_create_file(&new_client->dev, &dev_attr_temp_min);
device_create_file(&new_client->dev, &dev_attr_temp_input);
lm75_init_client(new_client);
return 0;
exit_free:
......
......@@ -648,7 +648,10 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
if ((err = i2c_attach_client(new_client)))
goto ERROR2;
/* register sysfs hooks */
/* Initialize the LM78 chip */
lm78_init_client(new_client);
/* Register sysfs hooks */
device_create_file(&new_client->dev, &dev_attr_in_input0);
device_create_file(&new_client->dev, &dev_attr_in_min0);
device_create_file(&new_client->dev, &dev_attr_in_max0);
......@@ -685,8 +688,6 @@ int lm78_detect(struct i2c_adapter *adapter, int address, int kind)
device_create_file(&new_client->dev, &dev_attr_alarms);
device_create_file(&new_client->dev, &dev_attr_vid);
/* Initialize the LM78 chip */
lm78_init_client(new_client);
return 0;
ERROR2:
......
......@@ -888,6 +888,10 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
/* Set the VRM version */
data->vrm = LM85_INIT_VRM ;
/* Initialize the LM85 chip */
lm85_init_client(new_client);
/* Register sysfs hooks */
device_create_file(&new_client->dev, &dev_attr_fan_input1);
device_create_file(&new_client->dev, &dev_attr_fan_input2);
device_create_file(&new_client->dev, &dev_attr_fan_input3);
......@@ -930,8 +934,6 @@ int lm85_detect(struct i2c_adapter *adapter, int address,
device_create_file(&new_client->dev, &dev_attr_vid);
device_create_file(&new_client->dev, &dev_attr_alarms);
/* Initialize the LM85 chip */
lm85_init_client(new_client);
return 0;
/* Error out and cleanup code */
......
......@@ -735,7 +735,10 @@ static int via686a_detect(struct i2c_adapter *adapter, int address, int kind)
if ((err = i2c_attach_client(new_client)))
goto ERROR3;
/* register sysfs hooks */
/* Initialize the VIA686A chip */
via686a_init_client(new_client);
/* Register sysfs hooks */
device_create_file(&new_client->dev, &dev_attr_in_input0);
device_create_file(&new_client->dev, &dev_attr_in_input1);
device_create_file(&new_client->dev, &dev_attr_in_input2);
......@@ -768,8 +771,6 @@ static int via686a_detect(struct i2c_adapter *adapter, int address, int kind)
device_create_file(&new_client->dev, &dev_attr_fan_div2);
device_create_file(&new_client->dev, &dev_attr_alarm);
/* Initialize the VIA686A chip */
via686a_init_client(new_client);
return 0;
ERROR3:
......
......@@ -1346,6 +1346,10 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
data->lm75[1] = NULL;
}
/* Initialize the chip */
w83781d_init_client(new_client);
/* Register sysfs hooks */
device_create_file_in(new_client, 0);
if (kind != w83783s && kind != w83697hf)
device_create_file_in(new_client, 1);
......@@ -1408,8 +1412,6 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
}
#endif
/* Initialize the chip */
w83781d_init_client(new_client);
return 0;
ERROR3:
......
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