From: Jean Delvare <khali@linux-fr.org>
Subject: 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/2353
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Udo van den Heuvel <udovdh@xs4all.n>
Cc: Juerg Haefliger <juergh@gmail.com>
---
drivers/hwmon/dme1737.c | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
|
old
|
new
|
|
| 572 | 572 | |
| 573 | 573 | /* Sample register contents every 1 sec */ |
| 574 | 574 | if (time_after(jiffies, data->last_update + HZ) || !data->valid) { |
| 575 | | if (data->type != sch5027) { |
| | 575 | if (data->type == dme1737) { |
| 576 | 576 | data->vid = dme1737_read(data, DME1737_REG_VID) & |
| 577 | 577 | 0x3f; |
| 578 | 578 | } |
| … |
… |
|
| 1621 | 1621 | &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr, |
| 1622 | 1622 | &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr, |
| 1623 | 1623 | &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr, |
| 1624 | | /* Misc */ |
| 1625 | | &dev_attr_vrm.attr, |
| 1626 | | &dev_attr_cpu0_vid.attr, |
| 1627 | 1624 | NULL |
| 1628 | 1625 | }; |
| 1629 | 1626 | |
| … |
… |
|
| 1631 | 1628 | .attrs = dme1737_misc_attr, |
| 1632 | 1629 | }; |
| 1633 | 1630 | |
| | 1631 | /* The following struct holds VID-related attributes. Their creation |
| | 1632 | depends on the chip type which is determined during module load. */ |
| | 1633 | static struct attribute *dme1737_vid_attr[] = { |
| | 1634 | &dev_attr_vrm.attr, |
| | 1635 | &dev_attr_cpu0_vid.attr, |
| | 1636 | NULL |
| | 1637 | }; |
| | 1638 | |
| | 1639 | static const struct attribute_group dme1737_vid_group = { |
| | 1640 | .attrs = dme1737_vid_attr, |
| | 1641 | }; |
| | 1642 | |
| 1634 | 1643 | /* The following structs hold the PWM attributes, some of which are optional. |
| 1635 | 1644 | * Their creation depends on the chip configuration which is determined during |
| 1636 | 1645 | * module load. */ |
| … |
… |
|
| 1902 | 1911 | if (data->type != sch5027) { |
| 1903 | 1912 | sysfs_remove_group(&dev->kobj, &dme1737_misc_group); |
| 1904 | 1913 | } |
| | 1914 | if (data->type == dme1737) { |
| | 1915 | sysfs_remove_group(&dev->kobj, &dme1737_vid_group); |
| | 1916 | } |
| 1905 | 1917 | |
| 1906 | 1918 | sysfs_remove_group(&dev->kobj, &dme1737_group); |
| 1907 | 1919 | |
| … |
… |
|
| 1933 | 1945 | goto exit_remove; |
| 1934 | 1946 | } |
| 1935 | 1947 | |
| | 1948 | /* Create VID-related sysfs attributes */ |
| | 1949 | if ((data->type == dme1737) && |
| | 1950 | (err = sysfs_create_group(&dev->kobj, |
| | 1951 | &dme1737_vid_group))) { |
| | 1952 | goto exit_remove; |
| | 1953 | } |
| | 1954 | |
| 1936 | 1955 | /* Create fan sysfs attributes */ |
| 1937 | 1956 | for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) { |
| 1938 | 1957 | if (data->has_fan & (1 << ix)) { |
| … |
… |
|
| 2127 | 2146 | data->pwm_acz[2] = 4; /* pwm3 -> zone3 */ |
| 2128 | 2147 | |
| 2129 | 2148 | /* Set VRM */ |
| 2130 | | if (data->type != sch5027) { |
| | 2149 | if (data->type == dme1737) { |
| 2131 | 2150 | data->vrm = vid_which_vrm(); |
| 2132 | 2151 | } |
| 2133 | 2152 | |