From: sashiko-bot@kernel.org
To: "Pengpeng Hou" <hppiscas@163.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH] HID: use IS_REACHABLE(CONFIG_HID_KUNIT_TEST) for inlined KUnit tests
Date: Fri, 04 Dec 2026 02:31:24 +0000 [thread overview]
Message-ID: <sashiko-outbox-248977@kernel.org> (raw)
In-Reply-To: <179634995880.74470.16564934617135542670@163.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] HID: IS_REACHABLE() embeds KUnit tests and MODULE_* tags in
hid/uclogic
--
commit 56471648f10e8fd31480b4cebd55002c586cb470
Author: Pengpeng Hou <hppiscas@163.com>
HID: use IS_REACHABLE(CONFIG_HID_KUNIT_TEST) for inlined KUnit tests
This patch replaces #ifdef CONFIG_HID_KUNIT_TEST with
IS_REACHABLE(CONFIG_HID_KUNIT_TEST) in hid-input.c, hid-uclogic-core.c,
and hid-uclogic-params.c so the included KUnit test files are compiled
when both the drivers and CONFIG_HID_KUNIT_TEST are built as modules.
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index a4d3536c7af29..c97490fa3f8c9 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 eea4238b94213..821cc4a72d848 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 ed16f50f21edc..8c5617bca7a17 100644
> --- a/drivers/hid/hid-uclogic-params.c
> +++ b/drivers/hid/hid-uclogic-params.c
> @@ -2019,6 +2019,6 @@ int uclogic_params_init(struct uclogic_params *params,
> return rc;
> }
>
> -#ifdef CONFIG_HID_KUNIT_TEST
> +#if IS_REACHABLE(CONFIG_HID_KUNIT_TEST)
> #include "hid-uclogic-params-test.c"
> #endif
[Severity: Medium]
Should these KUnit test files be embedded directly into hid.ko and
hid-uclogic.ko via IS_REACHABLE()?
In modular builds such as allmodconfig or CONFIG_KUNIT_ALL_TESTS=m, this
gives core hid.ko and hid-uclogic.ko a hard runtime dependency on kunit.ko.
kunit_module_notify() then runs the embedded suites whenever hid.ko or
hid-uclogic.ko loads, and the tests cannot be run or unloaded independently.
All three included test files also contain standalone MODULE_DESCRIPTION(),
MODULE_LICENSE(), and MODULE_AUTHOR() macros, which end up in hid.ko and
hid-uclogic.ko modinfo alongside the drivers' own metadata.
Meanwhile, with the default CONFIG_HID=y and CONFIG_HID_KUNIT_TEST=m,
IS_REACHABLE(CONFIG_HID_KUNIT_TEST) still evaluates to 0 and omits all
three suites.
Instead of embedding tests in host modules, expose the static helpers with
VISIBLE_IF_KUNIT and EXPORT_SYMBOL_IF_KUNIT and build separate modules, as
in Documentation/dev-tools/kunit/usage.rst and f4ceb2a044f6 ("HID: uclogic:
Avoid linking common code into multiple modules").
--
Sashiko AI review · https://sashiko.dev/#/patchset/179634995880.74470.16564934617135542670@163.com?part=1
prev parent reply other threads:[~2026-12-04 2:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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=sashiko-outbox-248977@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=hppiscas@163.com \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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