mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: matan@svgalib.org
Cc: hansg@kernel.org, ilpo.jarvinen@linux.intel.com,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, daxter1992@gmail.com
Subject: [PATCH 1/2] platform/x86: lg-laptop: Fix possible LED deadlock
Date: Sat, 21 Nov 2026 15:12:01 +0100	[thread overview]
Message-ID: <20261121141221.19245-1-W_Armin@gmx.de> (raw)

Calling ACPI control methods inside the .brightness_set callback
of a LED class device can cause deadlocks because this callback
must not sleep. Use .brightness_set_blocking instead.

Fixes: dbf0c5a6b1f8 ("platform/x86: Add LG Gram laptop special features driver")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
 drivers/platform/x86/lg-laptop.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
index 36ad1e269443..a784071de8b3 100644
--- a/drivers/platform/x86/lg-laptop.c
+++ b/drivers/platform/x86/lg-laptop.c
@@ -32,7 +32,7 @@
 #define LED_DEVICE(_name, max, flag) struct led_classdev _name = { \
 	.name           = __stringify(_name),   \
 	.max_brightness = max,                  \
-	.brightness_set = _name##_set,          \
+	.brightness_set_blocking = _name##_set, \
 	.brightness_get = _name##_get,          \
 	.flags = flag,                          \
 }
@@ -599,10 +599,9 @@ static const struct attribute_group dev_attribute_group = {
 	.attrs = dev_attributes,
 };
 
-static void tpad_led_set(struct led_classdev *cdev,
-			 enum led_brightness brightness)
+static int tpad_led_set(struct led_classdev *cdev, enum led_brightness brightness)
 {
-	lg_wmab_set(cdev->dev->parent, WM_TLED, brightness > LED_OFF);
+	return lg_wmab_set(cdev->dev->parent, WM_TLED, brightness > LED_OFF);
 }
 
 static enum led_brightness tpad_led_get(struct led_classdev *cdev)
@@ -612,8 +611,7 @@ static enum led_brightness tpad_led_get(struct led_classdev *cdev)
 
 static LED_DEVICE(tpad_led, 1, 0);
 
-static void kbd_backlight_set(struct led_classdev *cdev,
-			      enum led_brightness brightness)
+static int kbd_backlight_set(struct led_classdev *cdev, enum led_brightness brightness)
 {
 	/* Must always be written */
 	u32 value = KBD_LED_STATUS;
@@ -633,7 +631,7 @@ static void kbd_backlight_set(struct led_classdev *cdev,
 	value |= FIELD_PREP(KBD_LED_BRIGHTNESS_MASK, bright);
 	value |= FIELD_PREP(KBD_LED_MODE_MASK, mode);
 
-	lg_wmab_set(cdev->dev->parent, WM_KEY_LIGHT, value);
+	return lg_wmab_set(cdev->dev->parent, WM_KEY_LIGHT, value);
 }
 
 static enum led_brightness get_kbd_backlight_level(struct device *dev)
-- 
2.56.1


             reply	other threads:[~2026-11-21 14:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21 14:12 Armin Wolf [this message]
2026-11-21 14:12 ` [PATCH 2/2] platform/x86: lg-laptop: Improve keyboard backlight detection Armin Wolf

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=20261121141221.19245-1-W_Armin@gmx.de \
    --to=w_armin@gmx.de \
    --cc=daxter1992@gmail.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --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®