Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

HID: asus: simplify RGB init sequence

Currently, RGB initialization forks depending on whether a device is
NKEY. However, in reality both initialization forks are the same, other
than the NKEY initialization initializing the LED_REPORT_ID1,
LED_REPORT_ID2 endpoints, and the non-NKEY initialization having a
functionality check which is skipped for the NKEY path.

Therefore, merge the if blocks, gate the ID1/ID2 initializations
behind the NKEY quirk instead, and introduce the functionality check
for NKEY devices (it is supported by them).

There should be no functional change with this patch.

Acked-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
Link: https://patch.msgid.link/20260122075044.5070-2-lkml@antheas.dev
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Antheas Kapenekakis and committed by
Ilpo Järvinen
56d1b33e 8f0b4cce

+22 -30
+22 -30
drivers/hid/hid-asus.c
··· 639 639 unsigned char kbd_func; 640 640 int ret; 641 641 642 - if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) { 643 - /* Initialize keyboard */ 644 - ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID); 645 - if (ret < 0) 646 - return ret; 642 + ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID); 643 + if (ret < 0) 644 + return ret; 647 645 648 - /* The LED endpoint is initialised in two HID */ 646 + /* Get keyboard functions */ 647 + ret = asus_kbd_get_functions(hdev, &kbd_func, FEATURE_KBD_REPORT_ID); 648 + if (ret < 0) 649 + return ret; 650 + 651 + /* Check for backlight support */ 652 + if (!(kbd_func & SUPPORT_KBD_BACKLIGHT)) 653 + return -ENODEV; 654 + 655 + if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) { 649 656 ret = asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID1); 650 657 if (ret < 0) 651 658 return ret; ··· 660 653 ret = asus_kbd_init(hdev, FEATURE_KBD_LED_REPORT_ID2); 661 654 if (ret < 0) 662 655 return ret; 656 + } 663 657 664 - if (dmi_match(DMI_PRODUCT_FAMILY, "ProArt P16")) { 665 - ret = asus_kbd_disable_oobe(hdev); 666 - if (ret < 0) 667 - return ret; 668 - } 669 - 670 - if (drvdata->quirks & QUIRK_ROG_ALLY_XPAD) { 671 - intf = to_usb_interface(hdev->dev.parent); 672 - udev = interface_to_usbdev(intf); 673 - validate_mcu_fw_version(hdev, 674 - le16_to_cpu(udev->descriptor.idProduct)); 675 - } 676 - 677 - } else { 678 - /* Initialize keyboard */ 679 - ret = asus_kbd_init(hdev, FEATURE_KBD_REPORT_ID); 658 + if (dmi_match(DMI_PRODUCT_FAMILY, "ProArt P16")) { 659 + ret = asus_kbd_disable_oobe(hdev); 680 660 if (ret < 0) 681 661 return ret; 662 + } 682 663 683 - /* Get keyboard functions */ 684 - ret = asus_kbd_get_functions(hdev, &kbd_func, FEATURE_KBD_REPORT_ID); 685 - if (ret < 0) 686 - return ret; 687 - 688 - /* Check for backlight support */ 689 - if (!(kbd_func & SUPPORT_KBD_BACKLIGHT)) 690 - return -ENODEV; 664 + if (drvdata->quirks & QUIRK_ROG_ALLY_XPAD) { 665 + intf = to_usb_interface(hdev->dev.parent); 666 + udev = interface_to_usbdev(intf); 667 + validate_mcu_fw_version(hdev, 668 + le16_to_cpu(udev->descriptor.idProduct)); 691 669 } 692 670 693 671 drvdata->kbd_backlight = devm_kzalloc(&hdev->dev,