asus-wmi: check for temp1 presence
Signed-off-by: Corentin Chary <corentin.chary@gmail.com> Signed-off-by: Matthew Garrett <mjg@redhat.com>
This commit is contained in:
committed by
Matthew Garrett
parent
6118b8adb5
commit
e02431d6f5
@@ -978,6 +978,8 @@ static mode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
|
|||||||
|
|
||||||
if (attr == &sensor_dev_attr_pwm1.dev_attr.attr)
|
if (attr == &sensor_dev_attr_pwm1.dev_attr.attr)
|
||||||
dev_id = ASUS_WMI_DEVID_FAN_CTRL;
|
dev_id = ASUS_WMI_DEVID_FAN_CTRL;
|
||||||
|
else if (attr == &sensor_dev_attr_temp1_input.dev_attr.attr)
|
||||||
|
dev_id = ASUS_WMI_DEVID_THERMAL_CTRL;
|
||||||
|
|
||||||
if (dev_id != -1) {
|
if (dev_id != -1) {
|
||||||
int err = asus_wmi_get_devstate(asus, dev_id, &value);
|
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,
|
|||||||
if (value == ASUS_WMI_UNSUPPORTED_METHOD || value & 0xFFF80000
|
if (value == ASUS_WMI_UNSUPPORTED_METHOD || value & 0xFFF80000
|
||||||
|| (!asus->sfun && !(value & ASUS_WMI_DSTS_PRESENCE_BIT)))
|
|| (!asus->sfun && !(value & ASUS_WMI_DSTS_PRESENCE_BIT)))
|
||||||
ok = false;
|
ok = false;
|
||||||
|
} else if (dev_id == ASUS_WMI_DEVID_THERMAL_CTRL) {
|
||||||
|
/* If value is zero, something is clearly wrong */
|
||||||
|
if (value == 0)
|
||||||
|
ok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok ? attr->mode : 0;
|
return ok ? attr->mode : 0;
|
||||||
|
Reference in New Issue
Block a user