Skip to content

Commit f7b7066

Browse files
khfengij-intel
authored andcommitted
platform/x86: asus-wmi: Consider device is absent when the read is ~0
AAEON PICO-TGU4 board doesn't have any LED but there are bogus LED controls under /sys/class/leds: $ ls /sys/class/leds asus::kbd_backlight asus::lightbar platform::micmute The reason is that the ~0 read from asus_wmi_get_devstate() is treated as a valid state, in truth it means the device is absent. So filter out ~0 read to prevent bogus LED controls being created. Signed-off-by: Kai-Heng Feng <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent e9df543 commit f7b7066

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/platform/x86/asus-wmi.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,17 @@ static int asus_wmi_evaluate_method_agfn(const struct acpi_buffer args)
481481

482482
static int asus_wmi_get_devstate(struct asus_wmi *asus, u32 dev_id, u32 *retval)
483483
{
484-
return asus_wmi_evaluate_method(asus->dsts_id, dev_id, 0, retval);
484+
int err;
485+
486+
err = asus_wmi_evaluate_method(asus->dsts_id, dev_id, 0, retval);
487+
488+
if (err)
489+
return err;
490+
491+
if (*retval == ~0)
492+
return -ENODEV;
493+
494+
return 0;
485495
}
486496

487497
static int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param,

0 commit comments

Comments
 (0)