Re: [PATCH RFC v3 11/11] platform/x86: ideapad-laptop: Fully support auto keyboard backlight
[email protected] Sun, 19 Jul 2026 17:13:11 +0000
| Newsgroups | org.kernel.vger.linux-leds |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Unconditional hardware control notifications trigger a WARN_ON backtrace in the LED subsystem if the LED trigger fails to register. -- --- Patch [11]: [PATCH RFC v3 11/11] platform/x86: ideapad-laptop: Fully support auto keyboard backlight --- commit 7889db12361e6ba0be277517fc8919a461f9e5eb Author: Rong Zhang <[email protected]> platform/x86: ideapad-laptop: Fully support auto keyboard backlight This commit introduces support for the auto brightness mode of the keyboard backlight on IdeaPad laptops. It decouples the brightness processing from the LED classdev and adds a private hardware control trigger named ideapad-auto. Registration failures of this new trigger are handled non-fatally. > diff --git a/drivers/platform/x86/lenovo/ideapad-laptop.c b/drivers/platform/x86/lenovo/ideapad-laptop.c > index 66e16abda5e36..253d2962b9276 100644 > --- a/drivers/platform/x86/lenovo/ideapad-laptop.c > +++ b/drivers/platform/x86/lenovo/ideapad-laptop.c [ ... ] > @@ -1714,9 +1714,58 @@ static int ideapad_kbd_bl_led_cdev_brightness_set(struct led_classdev *led_cdev, > +static void ideapad_kbd_bl_notify_hw_control(struct ideapad_private *priv, > + int hw_brightness, int last_hw_brightness) > +{ > + bool hw_control, last_hw_control; > + > + if (priv->kbd_bl.type != KBD_BL_TRISTATE_AUTO) > + return; > + > + hw_control = hw_brightness == KBD_BL_AUTO_MODE_HW_BRIGHTNESS; > + last_hw_control = last_hw_brightness == KBD_BL_AUTO_MODE_HW_BRIGHTNESS; > + > + if (hw_control != last_hw_control) > + led_trigger_notify_hw_control_changed(&priv->kbd_bl.led, hw_control); [Severity: Medium] Will this unconditionally trigger a WARN_ON backtrace in the LED subsystem if the LED trigger fails to register during initialization? Since the driver supports running in a degraded state when trigger registration fails, the LED_TRIG_HW_CHANGED flag is skipped on the LED classdev. However, if the hardware backlight state changes (e.g., via pressing the Fn+Space hotkey), this notification is dispatched without checking if the trigger was successfully registered. Could this be avoided by checking ideapad_kbd_bl_auto_trigger_registered or the LED_TRIG_HW_CHANGED flag before calling led_trigger_notify_hw_control_changed() here in ideapad_kbd_bl_notify_hw_control()? > +} -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=11