diff mbox series

[11/11] HID: asus: add support for the asus-wmi brightness handler

Message ID 20250319191320.10092-12-lkml@antheas.dev (mailing list archive)
State New
Delegated to: Jiri Kosina
Headers show
Series HID: asus: hid-asus and asus-wmi backlight unification, Z13 QOL improvements | expand

Commit Message

Antheas Kapenekakis March 19, 2025, 7:13 p.m. UTC
If the asus-wmi brightness handler is available, send the
keyboard brightness events to it instead of passing them
to userspace. If it is not, fall back to sending them to it.

Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
---
 drivers/hid/hid-asus.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

kernel test robot March 20, 2025, 10:18 a.m. UTC | #1
Hi Antheas,

kernel test robot noticed the following build errors:

[auto build test ERROR on 4701f33a10702d5fc577c32434eb62adde0a1ae1]

url:    https://github.com/intel-lab-lkp/linux/commits/Antheas-Kapenekakis/HID-asus-refactor-init-sequence-per-spec/20250320-031740
base:   4701f33a10702d5fc577c32434eb62adde0a1ae1
patch link:    https://lore.kernel.org/r/20250319191320.10092-12-lkml%40antheas.dev
patch subject: [PATCH 11/11] HID: asus: add support for the asus-wmi brightness handler
config: s390-randconfig-002-20250320 (https://download.01.org/0day-ci/archive/20250320/202503201739.4NJJCyeZ-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250320/202503201739.4NJJCyeZ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503201739.4NJJCyeZ-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/hid/hid-asus.c: In function 'asus_event':
>> drivers/hid/hid-asus.c:325:11: error: invalid use of void expression
       return !asus_brt_event(ASUS_BRT_UP);
              ^
   drivers/hid/hid-asus.c:327:11: error: invalid use of void expression
       return !asus_brt_event(ASUS_BRT_DOWN);
              ^
   drivers/hid/hid-asus.c:329:11: error: invalid use of void expression
       return !asus_brt_event(ASUS_BRT_TOGGLE);
              ^


vim +325 drivers/hid/hid-asus.c

   311	
   312	static int asus_event(struct hid_device *hdev, struct hid_field *field,
   313			      struct hid_usage *usage, __s32 value)
   314	{
   315		if ((usage->hid & HID_USAGE_PAGE) == 0xff310000 &&
   316		    (usage->hid & HID_USAGE) != 0x00 &&
   317		    (usage->hid & HID_USAGE) != 0xff && !usage->type) {
   318			hid_warn(hdev, "Unmapped Asus vendor usagepage code 0x%02x\n",
   319				 usage->hid & HID_USAGE);
   320		}
   321	
   322		if (usage->type == EV_KEY && value) {
   323			switch (usage->code) {
   324			case KEY_KBDILLUMUP:
 > 325				return !asus_brt_event(ASUS_BRT_UP);
   326			case KEY_KBDILLUMDOWN:
   327				return !asus_brt_event(ASUS_BRT_DOWN);
   328			case KEY_KBDILLUMTOGGLE:
   329				return !asus_brt_event(ASUS_BRT_TOGGLE);
   330			}
   331		}
   332	
   333		return 0;
   334	}
   335
diff mbox series

Patch

diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
index 5aae4466c0d63..b1ae0716005d2 100644
--- a/drivers/hid/hid-asus.c
+++ b/drivers/hid/hid-asus.c
@@ -319,6 +319,17 @@  static int asus_event(struct hid_device *hdev, struct hid_field *field,
 			 usage->hid & HID_USAGE);
 	}
 
+	if (usage->type == EV_KEY && value) {
+		switch (usage->code) {
+		case KEY_KBDILLUMUP:
+			return !asus_brt_event(ASUS_BRT_UP);
+		case KEY_KBDILLUMDOWN:
+			return !asus_brt_event(ASUS_BRT_DOWN);
+		case KEY_KBDILLUMTOGGLE:
+			return !asus_brt_event(ASUS_BRT_TOGGLE);
+		}
+	}
+
 	return 0;
 }