Skip to content

Commit c89046d

Browse files
NeroReflexJiri Kosina
authored andcommitted
HID: asus: do not try to initialize the backlight if the enpoint doesn't support it
Avoid possibly printing a warning about the inability to initialize the backlight if the hid endpoint doesn't support it. Also fix and move an incorrect check in asus_kbd_register_leds(): that same check is now used as a precondition to call that function. Fixes: 0919db9 ("HID: asus: always fully initialize devices") Signed-off-by: Denis Benato <denis.benato@linux.dev> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 7253091 commit c89046d

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

drivers/hid/hid-asus.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,6 @@ static int asus_kbd_register_leds(struct hid_device *hdev)
738738
unsigned char kbd_func;
739739
int ret;
740740

741-
/* Laptops keyboard backlight is always at 0x5a */
742-
if (asus_has_report_id(hdev, FEATURE_KBD_REPORT_ID))
743-
return -ENODEV;
744-
745741
/* Get keyboard functions */
746742
ret = asus_kbd_get_functions(hdev, &kbd_func, FEATURE_KBD_REPORT_ID);
747743
if (ret < 0)
@@ -1307,8 +1303,10 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
13071303
}
13081304
}
13091305

1306+
/* Laptops keyboard backlight is always at 0x5a */
13101307
if (is_vendor && (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) &&
1311-
asus_kbd_register_leds(hdev))
1308+
(asus_has_report_id(hdev, FEATURE_KBD_REPORT_ID)) &&
1309+
(asus_kbd_register_leds(hdev)))
13121310
hid_warn(hdev, "Failed to initialize backlight.\n");
13131311

13141312
/*

0 commit comments

Comments
 (0)