aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/platform/x86/asus-wmi.c8
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
969static mode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj, 969static 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;