* [PATCH] platform/x86: asus-wmi: Consider device is absent when the read is ~0
@ 2024-03-08 5:32 Kai-Heng Feng
2024-03-08 8:56 ` Ilpo Järvinen
2024-03-11 12:00 ` Ilpo Järvinen
0 siblings, 2 replies; 3+ messages in thread
From: Kai-Heng Feng @ 2024-03-08 5:32 UTC (permalink / raw)
To: corentin.chary, luke, hdegoede, ilpo.jarvinen
Cc: Kai-Heng Feng, platform-driver-x86, linux-kernel
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 <kai.heng.feng@canonical.com>
---
drivers/platform/x86/asus-wmi.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 18be35fdb381..8cb2afafde16 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -489,7 +489,17 @@ static int asus_wmi_evaluate_method_agfn(const struct acpi_buffer args)
static int asus_wmi_get_devstate(struct asus_wmi *asus, u32 dev_id, u32 *retval)
{
- return asus_wmi_evaluate_method(asus->dsts_id, dev_id, 0, retval);
+ int err;
+
+ err = asus_wmi_evaluate_method(asus->dsts_id, dev_id, 0, retval);
+
+ if (err)
+ return err;
+
+ if (*retval == ~0)
+ return -ENODEV;
+
+ return 0;
}
static int asus_wmi_set_devstate(u32 dev_id, u32 ctrl_param,
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: asus-wmi: Consider device is absent when the read is ~0
2024-03-08 5:32 [PATCH] platform/x86: asus-wmi: Consider device is absent when the read is ~0 Kai-Heng Feng
@ 2024-03-08 8:56 ` Ilpo Järvinen
2024-03-11 12:00 ` Ilpo Järvinen
1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2024-03-08 8:56 UTC (permalink / raw)
To: Kai-Heng Feng
Cc: corentin.chary, luke, Hans de Goede, platform-driver-x86, LKML
[-- Attachment #1: Type: text/plain, Size: 583 bytes --]
On Fri, 8 Mar 2024, Kai-Heng Feng wrote:
> 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 <kai.heng.feng@canonical.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/x86: asus-wmi: Consider device is absent when the read is ~0
2024-03-08 5:32 [PATCH] platform/x86: asus-wmi: Consider device is absent when the read is ~0 Kai-Heng Feng
2024-03-08 8:56 ` Ilpo Järvinen
@ 2024-03-11 12:00 ` Ilpo Järvinen
1 sibling, 0 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2024-03-11 12:00 UTC (permalink / raw)
To: corentin.chary, luke, hdegoede, Kai-Heng Feng
Cc: platform-driver-x86, linux-kernel
On Fri, 08 Mar 2024 13:32:55 +0800, Kai-Heng Feng wrote:
> 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.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo branch. Note it will show up in the public
platform-drivers-x86/review-ilpo branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86: asus-wmi: Consider device is absent when the read is ~0
commit: 3f44cda7c36276f75d1ddcd2d52eb2d412e30cd0
--
i.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-11 12:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-08 5:32 [PATCH] platform/x86: asus-wmi: Consider device is absent when the read is ~0 Kai-Heng Feng
2024-03-08 8:56 ` Ilpo Järvinen
2024-03-11 12:00 ` Ilpo Järvinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox