From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Armin Wolf <W_Armin@gmx.de>
Cc: matan@svgalib.org, Hans de Goede <hansg@kernel.org>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
daxter1992@gmail.com
Subject: Re: [PATCH 2/2] platform/x86: lg-laptop: Improve keyboard backlight detection
Date: Thu, 26 Nov 2026 00:11:33 +0200 (EET) [thread overview]
Message-ID: <c7675821-77f4-74e1-280a-0b28e3ae485a@linux.intel.com> (raw)
In-Reply-To: <20261121141221.19245-2-W_Armin@gmx.de>
On Sat, 21 Nov 2026, Armin Wolf wrote:
> Not all devices support the keyboard backlight feature, instead they
> will return an error when trying to read/write the backlight level.
>
> Avoid registering the associated LED class device on such devices
> by first verifying that reading of the backlight level works. For
> this the get_kbd_backlight_level() function has to be modified to
> stop hiding any errors coming from the WMAB call.
>
> Reported-by: Carlos Javier Alvarez <daxter1992@gmail.com>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=222275
> Tested-by: Carlos Javier Alvarez <daxter1992@gmail.com>
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
> ---
> drivers/platform/x86/lg-laptop.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
> index a784071de8b3..72955fc868af 100644
> --- a/drivers/platform/x86/lg-laptop.c
> +++ b/drivers/platform/x86/lg-laptop.c
> @@ -641,10 +641,10 @@ static enum led_brightness get_kbd_backlight_level(struct device *dev)
>
> ret = lg_wmab_get(dev, WM_KEY_LIGHT, &value);
> if (ret < 0)
> - return LED_OFF;
> + return ret;
>
> if (FIELD_GET(KBD_LED_MAGIC_MASK, value) != KBD_LED_MAGIC)
> - return LED_OFF;
> + return -EIO;
Please check sashiko's complaint about missing error handling.
--
i.
> if (FIELD_GET(KBD_LED_MODE_MASK, value) == KBD_LED_MODE_OFF)
> return LED_OFF;
> @@ -823,6 +823,21 @@ static int lg_laptop_input_init(struct device *dev, acpi_handle handle)
> return 0;
> }
>
> +static int lg_laptop_kbd_backlight_init(struct device *dev)
> +{
> + int ret;
> +
> + /*
> + * Devices that do not support the keyboard backlight feature
> + * usually return a error when trying to read the backlight level.
> + */
> + ret = get_kbd_backlight_level(dev);
> + if (ret < 0)
> + return ret;
> +
> + return devm_led_classdev_register(dev, &kbd_backlight);
> +}
> +
> static acpi_status lg_laptop_address_space_write(struct device *dev, acpi_physical_address address,
> size_t size, u64 value)
> {
> @@ -1035,7 +1050,7 @@ static int acpi_probe(struct platform_device *pdev)
> battery_limit_use_wmbb = 1;
>
> /* LEDs are optional */
> - ret = devm_led_classdev_register(&pdev->dev, &kbd_backlight);
> + ret = lg_laptop_kbd_backlight_init(&pdev->dev);
> if (ret < 0)
> kbd_backlight_available = false;
> else
>
prev parent reply other threads:[~2026-11-25 22:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 14:12 [PATCH 1/2] platform/x86: lg-laptop: Fix possible LED deadlock Armin Wolf
2026-11-21 14:12 ` [PATCH 2/2] platform/x86: lg-laptop: Improve keyboard backlight detection Armin Wolf
2026-11-25 22:11 ` Ilpo Järvinen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c7675821-77f4-74e1-280a-0b28e3ae485a@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=W_Armin@gmx.de \
--cc=daxter1992@gmail.com \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matan@svgalib.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®