platform/x86: asus-wmi: Do not disable keyboard backlight on unloading
authorYurii Pavlovskyi <yurii.pavlovskyi@gmail.com>
Tue, 14 May 2019 19:07:46 +0000 (21:07 +0200)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 17 Jun 2019 12:22:47 +0000 (15:22 +0300)
The keyboard backlight is automatically disabled when the module is
unloaded as it is exposed as a ledclass device. Change this behavior to
ignore setting brightness when the device is in unloading state.

Signed-off-by: Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/platform/x86/asus-wmi.c

index 5712bc56fa106176366ac8f2c11d6f7328f935cf..508e6ad4779310fac66bef2f19a92978b13ed049 100644 (file)
@@ -471,6 +471,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);
 }