Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: uclogic: Avoid linking common code into multiple modules

The hid-uclogic-params.o and hid-uclogic-rdesc.o files are linked
into both the driver module and the unit test, which triggers a
W=1 warning:

scripts/Makefile.build:236: drivers/hid/Makefile: hid-uclogic-rdesc.o is added to multiple modules: hid-uclogic hid-uclogic-test
scripts/Makefile.build:236: drivers/hid/Makefile: hid-uclogic-params.o is added to multiple modules: hid-uclogic hid-uclogic-test

Avoids this by moving these two files into a separate module
that is used by the driver and the unit test.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>

authored by

José Expósito and committed by
Jiri Kosina
f4ceb2a0 a3a5a37e

+6 -4
+2 -4
drivers/hid/Makefile
··· 154 154 obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o 155 155 obj-$(CONFIG_HID_SENSOR_CUSTOM_SENSOR) += hid-sensor-custom.o 156 156 157 - hid-uclogic-test-objs := hid-uclogic-rdesc.o \ 158 - hid-uclogic-params.o \ 159 - hid-uclogic-rdesc-test.o 160 - obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic-test.o 157 + hid-uclogic-test-objs := hid-uclogic-rdesc-test.o 158 + obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic.o hid-uclogic-test.o 161 159 162 160 obj-$(CONFIG_USB_HID) += usbhid/ 163 161 obj-$(CONFIG_USB_MOUSE) += usbhid/
+2
drivers/hid/hid-uclogic-rdesc-test.c
··· 9 9 #include <kunit/test.h> 10 10 #include "./hid-uclogic-rdesc.h" 11 11 12 + MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING); 13 + 12 14 struct uclogic_template_case { 13 15 const char *name; 14 16 const __u8 *template;
+2
drivers/hid/hid-uclogic-rdesc.c
··· 17 17 #include "hid-uclogic-rdesc.h" 18 18 #include <linux/slab.h> 19 19 #include <asm/unaligned.h> 20 + #include <kunit/visibility.h> 20 21 21 22 /* Fixed WP4030U report descriptor */ 22 23 __u8 uclogic_rdesc_wp4030u_fixed_arr[] = { ··· 1243 1242 1244 1243 return rdesc_ptr; 1245 1244 } 1245 + EXPORT_SYMBOL_IF_KUNIT(uclogic_rdesc_template_apply);