diff options
author | Corentin Chary <corentin.chary@gmail.com> | 2011-07-01 05:34:37 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2011-08-05 14:46:01 -0400 |
commit | e02431d6f5e8f1023ce0cfbaf70ddf4afae924d8 (patch) | |
tree | d4f3ea0ac91106180fdca3a0bececa66a1487f29 | |
parent | 6118b8adb50c23714d5be089965082bbbb48d831 (diff) |
asus-wmi: check for temp1 presence
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index d01f767c7b69..e50872632c5a 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c | |||
@@ -967,7 +967,7 @@ static struct attribute *hwmon_attributes[] = { | |||
967 | }; | 967 | }; |
968 | 968 | ||
969 | static mode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj, | 969 | static mode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj, |
970 | struct attribute *attr, int idx) | 970 | struct attribute *attr, int idx) |
971 | { | 971 | { |
972 | struct device *dev = container_of(kobj, struct device, kobj); | 972 | struct device *dev = container_of(kobj, struct device, kobj); |
973 | struct platform_device *pdev = to_platform_device(dev->parent); | 973 | struct platform_device *pdev = to_platform_device(dev->parent); |
@@ -978,6 +978,8 @@ static mode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj, | |||
978 | 978 | ||
979 | if (attr == &sensor_dev_attr_pwm1.dev_attr.attr) | 979 | if (attr == &sensor_dev_attr_pwm1.dev_attr.attr) |
980 | dev_id = ASUS_WMI_DEVID_FAN_CTRL; | 980 | dev_id = ASUS_WMI_DEVID_FAN_CTRL; |
981 | else if (attr == &sensor_dev_attr_temp1_input.dev_attr.attr) | ||
982 | dev_id = ASUS_WMI_DEVID_THERMAL_CTRL; | ||
981 | 983 | ||
982 | if (dev_id != -1) { | 984 | if (dev_id != -1) { |
983 | int err = asus_wmi_get_devstate(asus, dev_id, &value); | 985 | int err = asus_wmi_get_devstate(asus, dev_id, &value); |
@@ -998,6 +1000,10 @@ static mode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj, | |||
998 | if (value == ASUS_WMI_UNSUPPORTED_METHOD || value & 0xFFF80000 | 1000 | if (value == ASUS_WMI_UNSUPPORTED_METHOD || value & 0xFFF80000 |
999 | || (!asus->sfun && !(value & ASUS_WMI_DSTS_PRESENCE_BIT))) | 1001 | || (!asus->sfun && !(value & ASUS_WMI_DSTS_PRESENCE_BIT))) |
1000 | ok = false; | 1002 | ok = false; |
1003 | } else if (dev_id == ASUS_WMI_DEVID_THERMAL_CTRL) { | ||
1004 | /* If value is zero, something is clearly wrong */ | ||
1005 | if (value == 0) | ||
1006 | ok = false; | ||
1001 | } | 1007 | } |
1002 | 1008 | ||
1003 | return ok ? attr->mode : 0; | 1009 | return ok ? attr->mode : 0; |