From: Pengpeng Hou <hppiscas@163.com>
To: Jiri Kosina <jikos@kernel.org>, Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org, Pengpeng Hou <hppiscas@163.com>
Subject: [PATCH] HID: use IS_REACHABLE(CONFIG_HID_KUNIT_TEST) for inlined KUnit tests
Date: Fri, 4 Dec 2026 10:05:58 +0800 [thread overview]
Message-ID: <179634995880.74470.16564934617135542670@163.com> (raw)
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
next reply other threads:[~2026-12-04 2:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 2:05 Pengpeng Hou [this message]
2026-12-04 2:31 ` [PATCH] HID: use IS_REACHABLE(CONFIG_HID_KUNIT_TEST) for inlined KUnit tests sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179634995880.74470.16564934617135542670@163.com \
--to=hppiscas@163.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox