Message ID | 40403d07-293a-62a1-e0e9-ad6a2ba84844@gmail.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Andy Shevchenko |
Headers | show |
Series | Support of ASUS TUF Gaming series laptops | expand |
On Tue, May 14, 2019 at 12:51 PM Yurii Pavlovskyi <yurii.pavlovskyi@gmail.com> wrote: > > 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>
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 62567766bdfb..84d7fc6f941c 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;
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> --- drivers/platform/x86/asus-wmi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)