platform/x86: asus-wmi: Fix preserving keyboard backlight intensity on load
authorYurii Pavlovskyi <yurii.pavlovskyi@gmail.com>
Tue, 14 May 2019 18:51:25 +0000 (20:51 +0200)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 17 Jun 2019 12:22:47 +0000 (15:22 +0300)
The error code and return value are mixed up. The intensity is always set
to 0 on load as kbd_led_read returns either 0 or negative value. To
reproduce set backlight to maximum, reload driver and try to increase it
using keyboard hotkey, the intensity will drop as a result. Correct the
implementation.

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

index 6a590ec4c4ef9a1ebb08b3e1ebcf3b52fea02417..b536e757df17645d52eede747b2081abdd16c411 100644 (file)
@@ -595,8 +595,7 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
                        goto error;
        }
 
-       led_val = kbd_led_read(asus, NULL, NULL);
-       if (led_val >= 0) {
+       if (!kbd_led_read(asus, &led_val, NULL)) {
                asus->kbd_led_wk = led_val;
                asus->kbd_led.name = "asus::kbd_backlight";
                asus->kbd_led.flags = LED_BRIGHT_HW_CHANGED;