Skip to contentSkip to conversation

Fix UCLogic warnings

PATCH In review José Expósito 2 participants 4 messages Jun 14, 2024 – Jun 19, 2024 HID

lore
Share & tools
lore
#0 lore raw

v2 cover Fix UCLogic warnings

Hi everyone,

This is a follow up on Arnd's work [1] fixing these warnings.

Sending it as v2 so it is clear that the first patch doesn't need to be merged.

Best wishes,
Jose

[1] https://lore.kernel.org/linux-input/[email protected]/T/
José Expósito (2):
HID: uclogic: Avoid linking common code into multiple modules
HID: uclogic: Add module description

 drivers/hid/Makefile                 | 6 ++----
 drivers/hid/hid-uclogic-core.c       | 1 +
 drivers/hid/hid-uclogic-rdesc-test.c | 2 ++
 drivers/hid/hid-uclogic-rdesc.c      | 2 ++
 4 files changed, 7 insertions(+), 4 deletions(-)
Signature · 1 line
2.45.2
#1 lore raw

PATCH v2 1/2 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.

---
 drivers/hid/Makefile                 | 6 ++----
 drivers/hid/hid-uclogic-rdesc-test.c | 2 ++
 drivers/hid/hid-uclogic-rdesc.c      | 2 ++
 3 files changed, 6 insertions(+), 4 deletions(-)
drivers/hid/Makefile +2 -4
index ce71b53ea6c5..e40f1ddebbb7 100644
@@ -154,10 +154,8 @@ obj-$(CONFIG_HID_WINWING)	+= hid-winwing.o
 obj-$(CONFIG_HID_SENSOR_HUB)	+= hid-sensor-hub.o
 obj-$(CONFIG_HID_SENSOR_CUSTOM_SENSOR)	+= hid-sensor-custom.o
 
-hid-uclogic-test-objs		:= hid-uclogic-rdesc.o \
-				   hid-uclogic-params.o \
-				   hid-uclogic-rdesc-test.o
-obj-$(CONFIG_HID_KUNIT_TEST)	+= hid-uclogic-test.o
+hid-uclogic-test-objs		:= hid-uclogic-rdesc-test.o
+obj-$(CONFIG_HID_KUNIT_TEST)	+= hid-uclogic.o hid-uclogic-test.o
 
 obj-$(CONFIG_USB_HID)		+= usbhid/
 obj-$(CONFIG_USB_MOUSE)		+= usbhid/
drivers/hid/hid-uclogic-rdesc-test.c +2 -0
index 90bf4e586e01..d6b18213f45f 100644
@@ -9,6 +9,8 @@
 #include <kunit/test.h>
 #include "./hid-uclogic-rdesc.h"
 
+MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING);
+
 struct uclogic_template_case {
 	const char *name;
 	const __u8 *template;
drivers/hid/hid-uclogic-rdesc.c +2 -0
index b6dfdf6356a6..6c7a90417569 100644
@@ -17,6 +17,7 @@
 #include "hid-uclogic-rdesc.h"
 #include <linux/slab.h>
 #include <asm/unaligned.h>
+#include <kunit/visibility.h>
 
 /* Fixed WP4030U report descriptor */
 __u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
@@ -1242,3 +1243,4 @@ __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
 
 	return rdesc_ptr;
 }
+EXPORT_SYMBOL_IF_KUNIT(uclogic_rdesc_template_apply);
Signature · 1 line
2.45.2
maintainer
#2 lore raw

Re: [PATCH v2 1/2] HID: uclogic: Avoid linking common code into multiple modules

Quoted 4 lines · José Expósito

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:

Quoted 8 lines

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.

I've added Reported-by: for Arnd and applied, thanks!

Signature · 2 lines
Jiri Kosina
SUSE Labs
#3 lore raw

PATCH v2 2/2 HID: uclogic: Add module description

In reply to José Expósito

Not having it triggers a warning:

WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/hid/hid-uclogic.o

---
 drivers/hid/hid-uclogic-core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/hid/hid-uclogic-core.c +1 -0
index ad74cbc9a0aa..26bacbf1474e 100644
@@ -568,6 +568,7 @@ module_hid_driver(uclogic_driver);
 MODULE_AUTHOR("Martin Rusko");
 MODULE_AUTHOR("Nikolai Kondrashov");
 MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("HID driver for UC-Logic devices not fully compliant with HID standard");
 
 #ifdef CONFIG_HID_KUNIT_TEST
 #include "hid-uclogic-core-test.c"
Signature · 1 line
2.45.2