]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/hwmon/w83627hf.c
hwmon: Only call vid_which_vrm() when needed
[linux-2.6-omap-h63xx.git] / drivers / hwmon / w83627hf.c
index dfdc29c77123a7e0530984f5251f229f000a9f89..3ed67a5cd53c216f94e4c291606b201e47db3bb3 100644 (file)
@@ -286,9 +286,8 @@ static inline u8 DIV_TO_REG(long val)
        return ((u8) i);
 }
 
-/* For each registered chip, we need to keep some data in memory. That
-   data is pointed to by w83627hf_list[NR]->data. The structure itself is
-   dynamically allocated, at the same time when a new client is allocated. */
+/* For each registered chip, we need to keep some data in memory.
+   The structure is dynamically allocated. */
 struct w83627hf_data {
        struct i2c_client client;
        struct class_device *class_dev;
@@ -1182,12 +1181,16 @@ static int w83627hf_detect(struct i2c_adapter *adapter)
                                        &dev_attr_temp3_type)))
                        goto ERROR4;
 
-       if (kind != w83697hf && data->vid != 0xff)
+       if (kind != w83697hf && data->vid != 0xff) {
+               /* Convert VID to voltage based on VRM */
+               data->vrm = vid_which_vrm();
+
                if ((err = device_create_file(&new_client->dev,
                                        &dev_attr_cpu0_vid))
                 || (err = device_create_file(&new_client->dev,
                                        &dev_attr_vrm)))
                        goto ERROR4;
+       }
 
        if (kind == w83627thf || kind == w83637hf || kind == w83687thf)
                if ((err = device_create_file(&new_client->dev,
@@ -1421,9 +1424,6 @@ static void w83627hf_init_client(struct i2c_client *client)
                        w83627hf_read_value(client, W83627THF_REG_VRM_OVT_CFG);
        }
 
-       /* Convert VID to voltage based on VRM */
-       data->vrm = vid_which_vrm();
-
        tmp = w83627hf_read_value(client, W83781D_REG_SCFG1);
        for (i = 1; i <= 3; i++) {
                if (!(tmp & BIT_SCFG1[i - 1])) {