Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] HID: use IS_REACHABLE(CONFIG_HID_KUNIT_TEST) for inlined KUnit tests
@ 2026-12-04  2:05 Pengpeng Hou
  2026-12-04  2:31 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-12-04  2:05 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: linux-input, Pengpeng Hou

The HID input and UC-Logic KUnit sources are included by their
respective drivers. With HID, UC-Logic and the test option modular, the
ordinary ifdefs omit the embedded suites from those modules.

Select the includes using IS_REACHABLE. This changes inclusion in the
existing hosts; it does not introduce a separate test module for a
built-in host.

The issue was found by our static-analysis tool and manually reviewed.

Fixes: a64cbf3ce631 ("HID: uclogic: Refactor UGEE v2 string descriptor parsing")
Fixes: a251d6576d2a ("HID: uclogic: Handle wireless device reconnection")
Fixes: a608dc1c0639 ("HID: input: map battery system charging")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
The original patch was prepared with Gemini. Codex assisted with this
review and revision (Assisted-by: gpt 5).
Built hid-input.o, hid-uclogic-core.o, hid-uclogic-params.o on x86-64
with GCC 11.4 and W=1 (CONFIG_HID=m, CONFIG_HID_UCLOGIC=m,
CONFIG_HID_KUNIT_TEST=m, CONFIG_KUNIT=m). With the same configuration
the 3 affected suite symbols were absent before the change and present
afterwards. The suites were not run.

 drivers/hid/hid-input.c          | 2 +-
 drivers/hid/hid-uclogic-core.c   | 2 +-
 drivers/hid/hid-uclogic-params.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index a4d3536c7af29ad8613be998ba31788992090ca2..c97490fa3f8c9b5142a6e402f9c807f80d245289 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -2478,6 +2478,6 @@ void hidinput_reset_resume(struct hid_device *hid)
 }
 EXPORT_SYMBOL_GPL(hidinput_reset_resume);
 
-#ifdef CONFIG_HID_KUNIT_TEST
+#if IS_REACHABLE(CONFIG_HID_KUNIT_TEST)
 #include "hid-input-test.c"
 #endif
diff --git a/drivers/hid/hid-uclogic-core.c b/drivers/hid/hid-uclogic-core.c
index eea4238b9421384b2eb4cb455b79a9ab3076efbb..821cc4a72d84809dd258b22d88fa5db966a4369a 100644
--- a/drivers/hid/hid-uclogic-core.c
+++ b/drivers/hid/hid-uclogic-core.c
@@ -657,6 +657,6 @@ MODULE_DESCRIPTION("HID driver for UC-Logic devices not fully compliant with HID
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("HID driver for UC-Logic devices not fully compliant with HID standard");
 
-#ifdef CONFIG_HID_KUNIT_TEST
+#if IS_REACHABLE(CONFIG_HID_KUNIT_TEST)
 #include "hid-uclogic-core-test.c"
 #endif
diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c
index ed16f50f21edc8f7fc16f1144eee21253247d402..8c5617bca7a17ec5255faaf5869f697135d3736f 100644
--- a/drivers/hid/hid-uclogic-params.c
+++ b/drivers/hid/hid-uclogic-params.c
@@ -2019,6 +2019,6 @@ cleanup:
 	return rc;
 }
 
-#ifdef CONFIG_HID_KUNIT_TEST
+#if IS_REACHABLE(CONFIG_HID_KUNIT_TEST)
 #include "hid-uclogic-params-test.c"
 #endif

base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04  2:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  2:05 [PATCH] HID: use IS_REACHABLE(CONFIG_HID_KUNIT_TEST) for inlined KUnit tests Pengpeng Hou
2026-12-04  2:31 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox