]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
HID: asus: do not try to initialize the backlight if the enpoint doesn't support it
authorDenis Benato <denis.benato@linux.dev>
Sat, 28 Feb 2026 19:10:10 +0000 (20:10 +0100)
committerJiri Kosina <jkosina@suse.com>
Tue, 10 Mar 2026 17:01:19 +0000 (18:01 +0100)
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: 0919db9f3583 ("HID: asus: always fully initialize devices")
Signed-off-by: Denis Benato <denis.benato@linux.dev>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/hid-asus.c

index 26047ccc8e7dac8be9894aaed36cd79111b51617..9fccfbe187cd56f65534e6795d74423a98b12e09 100644 (file)
@@ -738,10 +738,6 @@ static int asus_kbd_register_leds(struct hid_device *hdev)
        unsigned char kbd_func;
        int ret;
 
-       /* Laptops keyboard backlight is always at 0x5a */
-       if (asus_has_report_id(hdev, FEATURE_KBD_REPORT_ID))
-               return -ENODEV;
-
        /* Get keyboard functions */
        ret = asus_kbd_get_functions(hdev, &kbd_func, FEATURE_KBD_REPORT_ID);
        if (ret < 0)
@@ -1307,8 +1303,10 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
                }
        }
 
+       /* Laptops keyboard backlight is always at 0x5a */
        if (is_vendor && (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) &&
-           asus_kbd_register_leds(hdev))
+           (asus_has_report_id(hdev, FEATURE_KBD_REPORT_ID)) &&
+               (asus_kbd_register_leds(hdev)))
                hid_warn(hdev, "Failed to initialize backlight.\n");
 
        /*