Commit 9d091446 authored by Jean Delvare's avatar Jean Delvare

hwmon: (dme1737) No vid attributes for SCH311x

The SCH311x chips do not have VID inputs, so the cpu0_vid and vrm
attributes shouldn't be created for them.

This fixes lm-sensors ticket #2353:
http://www.lm-sensors.org/ticket/2353Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Tested-by: default avatarUdo van den Heuvel <udovdh@xs4all.nl>
Cc: Juerg Haefliger <juergh@gmail.com>
parent c7702c31
...@@ -572,7 +572,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev) ...@@ -572,7 +572,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
/* Sample register contents every 1 sec */ /* Sample register contents every 1 sec */
if (time_after(jiffies, data->last_update + HZ) || !data->valid) { if (time_after(jiffies, data->last_update + HZ) || !data->valid) {
if (data->type != sch5027) { if (data->type == dme1737) {
data->vid = dme1737_read(data, DME1737_REG_VID) & data->vid = dme1737_read(data, DME1737_REG_VID) &
0x3f; 0x3f;
} }
...@@ -1621,9 +1621,6 @@ static struct attribute *dme1737_misc_attr[] = { ...@@ -1621,9 +1621,6 @@ static struct attribute *dme1737_misc_attr[] = {
&sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr, &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr,
&sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr, &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr,
&sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr, &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr,
/* Misc */
&dev_attr_vrm.attr,
&dev_attr_cpu0_vid.attr,
NULL NULL
}; };
...@@ -1631,6 +1628,18 @@ static const struct attribute_group dme1737_misc_group = { ...@@ -1631,6 +1628,18 @@ static const struct attribute_group dme1737_misc_group = {
.attrs = dme1737_misc_attr, .attrs = dme1737_misc_attr,
}; };
/* The following struct holds VID-related attributes. Their creation
depends on the chip type which is determined during module load. */
static struct attribute *dme1737_vid_attr[] = {
&dev_attr_vrm.attr,
&dev_attr_cpu0_vid.attr,
NULL
};
static const struct attribute_group dme1737_vid_group = {
.attrs = dme1737_vid_attr,
};
/* The following structs hold the PWM attributes, some of which are optional. /* The following structs hold the PWM attributes, some of which are optional.
* Their creation depends on the chip configuration which is determined during * Their creation depends on the chip configuration which is determined during
* module load. */ * module load. */
...@@ -1902,6 +1911,9 @@ static void dme1737_remove_files(struct device *dev) ...@@ -1902,6 +1911,9 @@ static void dme1737_remove_files(struct device *dev)
if (data->type != sch5027) { if (data->type != sch5027) {
sysfs_remove_group(&dev->kobj, &dme1737_misc_group); sysfs_remove_group(&dev->kobj, &dme1737_misc_group);
} }
if (data->type == dme1737) {
sysfs_remove_group(&dev->kobj, &dme1737_vid_group);
}
sysfs_remove_group(&dev->kobj, &dme1737_group); sysfs_remove_group(&dev->kobj, &dme1737_group);
...@@ -1933,6 +1945,13 @@ static int dme1737_create_files(struct device *dev) ...@@ -1933,6 +1945,13 @@ static int dme1737_create_files(struct device *dev)
goto exit_remove; goto exit_remove;
} }
/* Create VID-related sysfs attributes */
if ((data->type == dme1737) &&
(err = sysfs_create_group(&dev->kobj,
&dme1737_vid_group))) {
goto exit_remove;
}
/* Create fan sysfs attributes */ /* Create fan sysfs attributes */
for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) { for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) {
if (data->has_fan & (1 << ix)) { if (data->has_fan & (1 << ix)) {
...@@ -2127,7 +2146,7 @@ static int dme1737_init_device(struct device *dev) ...@@ -2127,7 +2146,7 @@ static int dme1737_init_device(struct device *dev)
data->pwm_acz[2] = 4; /* pwm3 -> zone3 */ data->pwm_acz[2] = 4; /* pwm3 -> zone3 */
/* Set VRM */ /* Set VRM */
if (data->type != sch5027) { if (data->type == dme1737) {
data->vrm = vid_which_vrm(); data->vrm = vid_which_vrm();
} }
......
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