The keyboard backlight is disabled when module is unloaded as it is
exposed as LED device. Change this behavior to ignore setting 0 brightness
when the ledclass device is unloading.

Signed-off-by: Yurii Pavlovskyi <yurii.pavlovs...@gmail.com>
---
 drivers/platform/x86/asus-wmi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 941c628945ac..a0ffdd99eae2 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -475,6 +475,10 @@ static void do_kbd_led_set(struct led_classdev *led_cdev, 
int value)
 static void 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;
+
        do_kbd_led_set(led_cdev, value);
 }
 
-- 
2.17.1

Reply via email to