diff options
author | Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> | 2019-05-14 20:51:25 +0200 |
---|---|---|
committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-06-17 15:22:47 +0300 |
commit | 8853a2f6498b244d0cfff5c11158e2f76e323975 (patch) | |
tree | 31150fc6af932da63a7f1b697a5dcc54e96231d6 /drivers/platform/x86/asus-wmi.c | |
parent | cd10ee006ab504b2b9c5ed992cc06d3e110c6311 (diff) | |
download | linux-8853a2f6498b244d0cfff5c11158e2f76e323975.tar.bz2 |
platform/x86: asus-wmi: Fix preserving keyboard backlight intensity on load
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>
Diffstat (limited to 'drivers/platform/x86/asus-wmi.c')
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 6a590ec4c4ef..b536e757df17 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -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; |