Skip to content

Commit f4ceb2a

Browse files
JoseExpositoJiri Kosina
authored andcommitted
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 <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: José Expósito <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent a3a5a37 commit f4ceb2a

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

drivers/hid/Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,8 @@ obj-$(CONFIG_HID_WINWING) += hid-winwing.o
154154
obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o
155155
obj-$(CONFIG_HID_SENSOR_CUSTOM_SENSOR) += hid-sensor-custom.o
156156

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
161159

162160
obj-$(CONFIG_USB_HID) += usbhid/
163161
obj-$(CONFIG_USB_MOUSE) += usbhid/

drivers/hid/hid-uclogic-rdesc-test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <kunit/test.h>
1010
#include "./hid-uclogic-rdesc.h"
1111

12+
MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING);
13+
1214
struct uclogic_template_case {
1315
const char *name;
1416
const __u8 *template;

drivers/hid/hid-uclogic-rdesc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "hid-uclogic-rdesc.h"
1818
#include <linux/slab.h>
1919
#include <asm/unaligned.h>
20+
#include <kunit/visibility.h>
2021

2122
/* Fixed WP4030U report descriptor */
2223
__u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
@@ -1242,3 +1243,4 @@ __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
12421243

12431244
return rdesc_ptr;
12441245
}
1246+
EXPORT_SYMBOL_IF_KUNIT(uclogic_rdesc_template_apply);

0 commit comments

Comments
 (0)