aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-05-08 11:21:59 -0400
committerJean Delvare <khali@hyperion.delvare>2007-05-08 11:21:59 -0400
commit8a665a0552c414af88788cc0e2cf0e4626182c20 (patch)
tree52b23555f5e240d81180cf4aab82b90bca804d1b
parent94e183fd0425a917d9c1453041ef88f3610c0f01 (diff)
hwmon: Only call vid_which_vrm() when needed
Some hardware monitoring drivers create the VID/VRM interface files conditionally depending on the chip model or configuration. We should only call vid_which_vrm() when we are actually going to create the files. Not only it is more logical and efficient that way, but it also prevents printing unnecessary warnings such as the one reported here: http://lists.lm-sensors.org/pipermail/lm-sensors/2007-February/018954.html Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r--drivers/hwmon/lm87.c2
-rw-r--r--drivers/hwmon/w83627hf.c9
2 files changed, 6 insertions, 5 deletions
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
index 3ce825489e34..988ae1c4aada 100644
--- a/drivers/hwmon/lm87.c
+++ b/drivers/hwmon/lm87.c
@@ -747,6 +747,7 @@ static int lm87_detect(struct i2c_adapter *adapter, int address, int kind)
747 } 747 }
748 748
749 if (!(data->channel & CHAN_NO_VID)) { 749 if (!(data->channel & CHAN_NO_VID)) {
750 data->vrm = vid_which_vrm();
750 if ((err = device_create_file(&new_client->dev, 751 if ((err = device_create_file(&new_client->dev,
751 &dev_attr_cpu0_vid)) 752 &dev_attr_cpu0_vid))
752 || (err = device_create_file(&new_client->dev, 753 || (err = device_create_file(&new_client->dev,
@@ -779,7 +780,6 @@ static void lm87_init_client(struct i2c_client *client)
779 u8 config; 780 u8 config;
780 781
781 data->channel = lm87_read_value(client, LM87_REG_CHANNEL_MODE); 782 data->channel = lm87_read_value(client, LM87_REG_CHANNEL_MODE);
782 data->vrm = vid_which_vrm();
783 783
784 config = lm87_read_value(client, LM87_REG_CONFIG); 784 config = lm87_read_value(client, LM87_REG_CONFIG);
785 if (!(config & 0x01)) { 785 if (!(config & 0x01)) {
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c
index d7e240635b3b..3ed67a5cd53c 100644
--- a/drivers/hwmon/w83627hf.c
+++ b/drivers/hwmon/w83627hf.c
@@ -1181,12 +1181,16 @@ static int w83627hf_detect(struct i2c_adapter *adapter)
1181 &dev_attr_temp3_type))) 1181 &dev_attr_temp3_type)))
1182 goto ERROR4; 1182 goto ERROR4;
1183 1183
1184 if (kind != w83697hf && data->vid != 0xff) 1184 if (kind != w83697hf && data->vid != 0xff) {
1185 /* Convert VID to voltage based on VRM */
1186 data->vrm = vid_which_vrm();
1187
1185 if ((err = device_create_file(&new_client->dev, 1188 if ((err = device_create_file(&new_client->dev,
1186 &dev_attr_cpu0_vid)) 1189 &dev_attr_cpu0_vid))
1187 || (err = device_create_file(&new_client->dev, 1190 || (err = device_create_file(&new_client->dev,
1188 &dev_attr_vrm))) 1191 &dev_attr_vrm)))
1189 goto ERROR4; 1192 goto ERROR4;
1193 }
1190 1194
1191 if (kind == w83627thf || kind == w83637hf || kind == w83687thf) 1195 if (kind == w83627thf || kind == w83637hf || kind == w83687thf)
1192 if ((err = device_create_file(&new_client->dev, 1196 if ((err = device_create_file(&new_client->dev,
@@ -1420,9 +1424,6 @@ static void w83627hf_init_client(struct i2c_client *client)
1420 w83627hf_read_value(client, W83627THF_REG_VRM_OVT_CFG); 1424 w83627hf_read_value(client, W83627THF_REG_VRM_OVT_CFG);
1421 } 1425 }
1422 1426
1423 /* Convert VID to voltage based on VRM */
1424 data->vrm = vid_which_vrm();
1425
1426 tmp = w83627hf_read_value(client, W83781D_REG_SCFG1); 1427 tmp = w83627hf_read_value(client, W83781D_REG_SCFG1);
1427 for (i = 1; i <= 3; i++) { 1428 for (i = 1; i <= 3; i++) {
1428 if (!(tmp & BIT_SCFG1[i - 1])) { 1429 if (!(tmp & BIT_SCFG1[i - 1])) {