diff mbox series

[1/2] HID: input: fix test for CONFIG_HID_KUNIT_TEST=m

Message ID 20241208-hid-ifdef-kunit-v1-1-cbea6077a233@weissschuh.net
State New
Headers show
Series [1/2] HID: input: fix test for CONFIG_HID_KUNIT_TEST=m | expand

Commit Message

Thomas Weißschuh Dec. 8, 2024, 12:01 p.m. UTC
If CONFIG_HID_KUNIT_TEST is set to "m", the #ifdef test does not work.
Switch to IS_ENABLED() which works for both "m" and "y".

Fixes: a608dc1c0639 ("HID: input: map battery system charging")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/hid/hid-input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

kernel test robot Dec. 9, 2024, 5:08 a.m. UTC | #1
Hi Thomas,

kernel test robot noticed the following build errors:

[auto build test ERROR on 7503345ac5f5e82fd9a36d6e6b447c016376403a]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Wei-schuh/HID-input-fix-test-for-CONFIG_HID_KUNIT_TEST-m/20241208-200350
base:   7503345ac5f5e82fd9a36d6e6b447c016376403a
patch link:    https://lore.kernel.org/r/20241208-hid-ifdef-kunit-v1-1-cbea6077a233%40weissschuh.net
patch subject: [PATCH 1/2] HID: input: fix test for CONFIG_HID_KUNIT_TEST=m
config: i386-randconfig-012-20241209 (https://download.01.org/0day-ci/archive/20241209/202412091018.qz83ukPy-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241209/202412091018.qz83ukPy-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/202412091018.qz83ukPy-lkp@intel.com/

All errors (new ones prefixed by >>):

>> ld.lld: error: undefined symbol: kunit_kmalloc_array
   >>> referenced by test.h:447 (include/kunit/test.h:447)
   >>>               drivers/hid/hid-input.o:(hid_test_input_set_battery_charge_status) in archive vmlinux.a
   >>> referenced by test.h:447 (include/kunit/test.h:447)
   >>>               drivers/hid/hid-input.o:(hid_test_input_get_battery_property) in archive vmlinux.a
   >>> referenced by test.h:447 (include/kunit/test.h:447)
   >>>               drivers/hid/hid-input.o:(hid_test_input_get_battery_property) in archive vmlinux.a
--
>> ld.lld: error: undefined symbol: kunit_binary_assert_format
   >>> referenced by hid-input-test.c:20 (drivers/hid/hid-input-test.c:20)
   >>>               drivers/hid/hid-input.o:(hid_test_input_set_battery_charge_status) in archive vmlinux.a
   >>> referenced by hid-input-test.c:24 (drivers/hid/hid-input-test.c:24)
   >>>               drivers/hid/hid-input.o:(hid_test_input_set_battery_charge_status) in archive vmlinux.a
   >>> referenced by hid-input-test.c:28 (drivers/hid/hid-input-test.c:28)
   >>>               drivers/hid/hid-input.o:(hid_test_input_set_battery_charge_status) in archive vmlinux.a
   >>> referenced 6 more times
--
>> ld.lld: error: undefined symbol: __kunit_do_failed_assertion
   >>> referenced by hid-input-test.c:20 (drivers/hid/hid-input-test.c:20)
   >>>               drivers/hid/hid-input.o:(hid_test_input_set_battery_charge_status) in archive vmlinux.a
   >>> referenced by hid-input-test.c:24 (drivers/hid/hid-input-test.c:24)
   >>>               drivers/hid/hid-input.o:(hid_test_input_set_battery_charge_status) in archive vmlinux.a
   >>> referenced by hid-input-test.c:28 (drivers/hid/hid-input-test.c:28)
   >>>               drivers/hid/hid-input.o:(hid_test_input_set_battery_charge_status) in archive vmlinux.a
   >>> referenced 9 more times
--
>> ld.lld: error: undefined symbol: kunit_ptr_not_err_assert_format
   >>> referenced by hid-input-test.c:16 (drivers/hid/hid-input-test.c:16)
   >>>               drivers/hid/hid-input.o:(hid_test_input_set_battery_charge_status) in archive vmlinux.a
   >>> referenced by hid-input-test.c:39 (drivers/hid/hid-input-test.c:39)
   >>>               drivers/hid/hid-input.o:(hid_test_input_get_battery_property) in archive vmlinux.a
   >>> referenced by hid-input-test.c:43 (drivers/hid/hid-input-test.c:43)
   >>>               drivers/hid/hid-input.o:(hid_test_input_get_battery_property) in archive vmlinux.a
--
>> ld.lld: error: undefined symbol: __kunit_abort
   >>> referenced by hid-input-test.c:16 (drivers/hid/hid-input-test.c:16)
   >>>               drivers/hid/hid-input.o:(hid_test_input_set_battery_charge_status) in archive vmlinux.a
   >>> referenced by hid-input-test.c:39 (drivers/hid/hid-input-test.c:39)
   >>>               drivers/hid/hid-input.o:(hid_test_input_get_battery_property) in archive vmlinux.a
   >>> referenced by hid-input-test.c:43 (drivers/hid/hid-input-test.c:43)
   >>>               drivers/hid/hid-input.o:(hid_test_input_get_battery_property) in archive vmlinux.a
diff mbox series

Patch

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index fda9dce3da99808e04ce66dd7beec6731173e75f..8f065d89979c3577dcc17a6f0d52468d69f16c87 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -2388,6 +2388,6 @@  void hidinput_disconnect(struct hid_device *hid)
 }
 EXPORT_SYMBOL_GPL(hidinput_disconnect);
 
-#ifdef CONFIG_HID_KUNIT_TEST
+#if IS_ENABLED(CONFIG_HID_KUNIT_TEST)
 #include "hid-input-test.c"
 #endif