* [PATCH] platform/x86: asus-wmi: use brightness_set_blocking() for kbd led
@ 2025-11-29 4:02 Anton Khirnov
2025-11-29 8:24 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Anton Khirnov @ 2025-11-29 4:02 UTC (permalink / raw)
To: Corentin Chary, Luke D. Jones, Denis Benato, Hans de Goede,
Ilpo Järvinen, Andy Shevchenko, Jian-Hong Pan
Cc: platform-driver-x86, linux-kernel
kbd_led_set() can sleep, and so may not be used as the brightness_set()
callback.
Fixes "BUG: scheduling while atomic" when using this led with a trigger.
Fixes: 9fe44fc98ce4 ("platform/x86: asus-wmi: Simplify the keyboard brightness updating process")
Signed-off-by: Anton Khirnov <anton@khirnov.net>
---
drivers/platform/x86/asus-wmi.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index e72a2b5d158e..638ff56e50a3 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1619,14 +1619,15 @@ static void do_kbd_led_set(struct led_classdev *led_cdev, int value)
kbd_led_update(asus);
}
-static void kbd_led_set(struct led_classdev *led_cdev,
- enum led_brightness value)
+static int kbd_led_set(struct led_classdev *led_cdev,
+ enum led_brightness value)
{
/* Prevent disabling keyboard backlight on module unregister */
if (led_cdev->flags & LED_UNREGISTERING)
- return;
+ return 0;
do_kbd_led_set(led_cdev, value);
+ return 0;
}
static void kbd_led_set_by_kbd(struct asus_wmi *asus, enum led_brightness value)
@@ -1802,7 +1803,7 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
asus->kbd_led_wk = led_val;
asus->kbd_led.name = "asus::kbd_backlight";
asus->kbd_led.flags = LED_BRIGHT_HW_CHANGED;
- asus->kbd_led.brightness_set = kbd_led_set;
+ asus->kbd_led.brightness_set_blocking = kbd_led_set;
asus->kbd_led.brightness_get = kbd_led_get;
asus->kbd_led.max_brightness = 3;
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] platform/x86: asus-wmi: use brightness_set_blocking() for kbd led
2025-11-29 4:02 [PATCH] platform/x86: asus-wmi: use brightness_set_blocking() for kbd led Anton Khirnov
@ 2025-11-29 8:24 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2025-11-29 8:24 UTC (permalink / raw)
To: Anton Khirnov
Cc: Corentin Chary, Luke D. Jones, Denis Benato, Hans de Goede,
Ilpo Järvinen, Jian-Hong Pan, platform-driver-x86,
linux-kernel
On Sat, Nov 29, 2025 at 05:02:46AM +0100, Anton Khirnov wrote:
> kbd_led_set() can sleep, and so may not be used as the brightness_set()
> callback.
> Fixes "BUG: scheduling while atomic" when using this led with a trigger.
It might be a bit confusing with (misspelled) Fixes tag, also it would be
better to provide a few (usually ~3-5) lines of the actual traceback.
...
> -static void kbd_led_set(struct led_classdev *led_cdev,
> - enum led_brightness value)
> +static int kbd_led_set(struct led_classdev *led_cdev,
> + enum led_brightness value)
Now it's exactly 80 characters if located on a single line.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-29 8:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-29 4:02 [PATCH] platform/x86: asus-wmi: use brightness_set_blocking() for kbd led Anton Khirnov
2025-11-29 8:24 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox