Hi Arnd, On Wed, May 29, 2024 at 11:48:05AM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@xxxxxxxx> > > 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. > > Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx> > --- > I have made patches for all such warnings in the tree, this is one I'm not > sure about, maybe there is a better fix. > --- > drivers/hid/Makefile | 12 ++---- > drivers/hid/hid-uclogic-params.c | 8 ++++ > drivers/hid/hid-uclogic-rdesc.c | 72 ++++++++++++++++++++++++++++++++ > 3 files changed, 84 insertions(+), 8 deletions(-) > > diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile > index ce71b53ea6c5..864dfbae8ace 100644 > --- a/drivers/hid/Makefile > +++ b/drivers/hid/Makefile > @@ -133,10 +133,8 @@ obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o > obj-$(CONFIG_HID_TOPRE) += hid-topre.o > obj-$(CONFIG_HID_TWINHAN) += hid-twinhan.o > obj-$(CONFIG_HID_U2FZERO) += hid-u2fzero.o > -hid-uclogic-objs := hid-uclogic-core.o \ > - hid-uclogic-rdesc.o \ > - hid-uclogic-params.o > -obj-$(CONFIG_HID_UCLOGIC) += hid-uclogic.o > +hid-uclogic-objs := hid-uclogic-core.o > +obj-$(CONFIG_HID_UCLOGIC) += hid-uclogic.o hid-uclogic-rdesc.o hid-uclogic-params.o > obj-$(CONFIG_HID_UDRAW_PS3) += hid-udraw-ps3.o > obj-$(CONFIG_HID_LED) += hid-led.o > obj-$(CONFIG_HID_XIAOMI) += hid-xiaomi.o > @@ -154,10 +152,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-test.o hid-uclogic-params.o hid-uclogic-params.o > > obj-$(CONFIG_USB_HID) += usbhid/ > obj-$(CONFIG_USB_MOUSE) += usbhid/ I tested your patch with: hid-uclogic-objs := hid-uclogic-core.o \ hid-uclogic-rdesc.o \ hid-uclogic-params.o obj-$(CONFIG_HID_UCLOGIC) += hid-uclogic.o [...] hid-uclogic-test-objs := hid-uclogic-rdesc-test.o obj-$(CONFIG_HID_KUNIT_TEST) += hid-uclogic.o hid-uclogic-test.o And I think it is a bit more clear and it looks like it does the trick removing the warning. Also, with that change only "EXPORT_SYMBOL_GPL(uclogic_rdesc_template_apply);" is required. The other EXPORT_SYMBOL_GPL can be removed. However, I'm not sure about what are the best practices using EXPORT_SYMBOL_GPL and if it should be used for each function/data in the .h file. Maybe that's why you added them. Best wishes, Jose > diff --git a/drivers/hid/hid-uclogic-params.c b/drivers/hid/hid-uclogic-params.c > index 5bab006ec165..97ae7e4f61e1 100644 > --- a/drivers/hid/hid-uclogic-params.c > +++ b/drivers/hid/hid-uclogic-params.c > @@ -133,6 +133,7 @@ void uclogic_params_hid_dbg(const struct hid_device *hdev, > } > hid_dbg(hdev, "}\n"); > } > +EXPORT_SYMBOL_GPL(uclogic_params_hid_dbg); > > /** > * uclogic_params_get_str_desc - retrieve a string descriptor from a HID > @@ -660,6 +661,7 @@ void uclogic_params_cleanup(struct uclogic_params *params) > memset(params, 0, sizeof(*params)); > } > } > +EXPORT_SYMBOL_GPL(uclogic_params_cleanup); > > /** > * uclogic_params_get_desc() - Get a replacement report descriptor for a > @@ -732,6 +734,7 @@ int uclogic_params_get_desc(const struct uclogic_params *params, > kfree(desc); > return rc; > } > +EXPORT_SYMBOL_GPL(uclogic_params_get_desc); > > /** > * uclogic_params_init_invalid() - initialize tablet interface parameters, > @@ -1859,7 +1862,12 @@ int uclogic_params_init(struct uclogic_params *params, > uclogic_params_cleanup(&p); > return rc; > } > +EXPORT_SYMBOL_GPL(uclogic_params_init); > > #ifdef CONFIG_HID_KUNIT_TEST > #include "hid-uclogic-params-test.c" > #endif > + > +MODULE_LICENSE("GPL"); > +MODULE_AUTHOR("Nikolai Kondrashov"); > +MODULE_DESCRIPTION("HID driver for UC-Logic devices tablet initialization and parameter retrieval"); > diff --git a/drivers/hid/hid-uclogic-rdesc.c b/drivers/hid/hid-uclogic-rdesc.c > index b6dfdf6356a6..d4f1ee79e0a1 100644 > --- a/drivers/hid/hid-uclogic-rdesc.c > +++ b/drivers/hid/hid-uclogic-rdesc.c > @@ -59,9 +59,11 @@ __u8 uclogic_rdesc_wp4030u_fixed_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_wp4030u_fixed_arr); > > const size_t uclogic_rdesc_wp4030u_fixed_size = > sizeof(uclogic_rdesc_wp4030u_fixed_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_wp4030u_fixed_size); > > /* Fixed WP5540U report descriptor */ > __u8 uclogic_rdesc_wp5540u_fixed_arr[] = { > @@ -136,9 +138,11 @@ __u8 uclogic_rdesc_wp5540u_fixed_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_wp5540u_fixed_arr); > > const size_t uclogic_rdesc_wp5540u_fixed_size = > sizeof(uclogic_rdesc_wp5540u_fixed_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_wp5540u_fixed_size); > > /* Fixed WP8060U report descriptor */ > __u8 uclogic_rdesc_wp8060u_fixed_arr[] = { > @@ -213,9 +217,11 @@ __u8 uclogic_rdesc_wp8060u_fixed_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_wp8060u_fixed_arr); > > const size_t uclogic_rdesc_wp8060u_fixed_size = > sizeof(uclogic_rdesc_wp8060u_fixed_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_wp8060u_fixed_size); > > /* Fixed WP1062 report descriptor */ > __u8 uclogic_rdesc_wp1062_fixed_arr[] = { > @@ -261,9 +267,11 @@ __u8 uclogic_rdesc_wp1062_fixed_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_wp1062_fixed_arr); > > const size_t uclogic_rdesc_wp1062_fixed_size = > sizeof(uclogic_rdesc_wp1062_fixed_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_wp1062_fixed_size); > > /* Fixed PF1209 report descriptor */ > __u8 uclogic_rdesc_pf1209_fixed_arr[] = { > @@ -338,9 +346,11 @@ __u8 uclogic_rdesc_pf1209_fixed_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_pf1209_fixed_arr); > > const size_t uclogic_rdesc_pf1209_fixed_size = > sizeof(uclogic_rdesc_pf1209_fixed_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_pf1209_fixed_size); > > /* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */ > __u8 uclogic_rdesc_twhl850_fixed0_arr[] = { > @@ -384,9 +394,11 @@ __u8 uclogic_rdesc_twhl850_fixed0_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_twhl850_fixed0_arr); > > const size_t uclogic_rdesc_twhl850_fixed0_size = > sizeof(uclogic_rdesc_twhl850_fixed0_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_twhl850_fixed0_size); > > /* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */ > __u8 uclogic_rdesc_twhl850_fixed1_arr[] = { > @@ -424,9 +436,11 @@ __u8 uclogic_rdesc_twhl850_fixed1_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_twhl850_fixed1_arr); > > const size_t uclogic_rdesc_twhl850_fixed1_size = > sizeof(uclogic_rdesc_twhl850_fixed1_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_twhl850_fixed1_size); > > /* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */ > __u8 uclogic_rdesc_twhl850_fixed2_arr[] = { > @@ -450,9 +464,11 @@ __u8 uclogic_rdesc_twhl850_fixed2_arr[] = { > 0x80, /* Input, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_twhl850_fixed2_arr); > > const size_t uclogic_rdesc_twhl850_fixed2_size = > sizeof(uclogic_rdesc_twhl850_fixed2_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_twhl850_fixed2_size); > > /* Fixed TWHA60 report descriptor, interface 0 (stylus) */ > __u8 uclogic_rdesc_twha60_fixed0_arr[] = { > @@ -499,9 +515,11 @@ __u8 uclogic_rdesc_twha60_fixed0_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_twha60_fixed0_arr); > > const size_t uclogic_rdesc_twha60_fixed0_size = > sizeof(uclogic_rdesc_twha60_fixed0_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_twha60_fixed0_size); > > /* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */ > __u8 uclogic_rdesc_twha60_fixed1_arr[] = { > @@ -527,9 +545,11 @@ __u8 uclogic_rdesc_twha60_fixed1_arr[] = { > 0x81, 0x01, /* Input (Constant), */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_twha60_fixed1_arr); > > const size_t uclogic_rdesc_twha60_fixed1_size = > sizeof(uclogic_rdesc_twha60_fixed1_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_twha60_fixed1_size); > > /* Fixed report descriptor template for (tweaked) v1 pen reports */ > const __u8 uclogic_rdesc_v1_pen_template_arr[] = { > @@ -581,9 +601,11 @@ const __u8 uclogic_rdesc_v1_pen_template_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v1_pen_template_arr); > > const size_t uclogic_rdesc_v1_pen_template_size = > sizeof(uclogic_rdesc_v1_pen_template_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v1_pen_template_size); > > /* Fixed report descriptor template for (tweaked) v2 pen reports */ > const __u8 uclogic_rdesc_v2_pen_template_arr[] = { > @@ -647,9 +669,11 @@ const __u8 uclogic_rdesc_v2_pen_template_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v2_pen_template_arr); > > const size_t uclogic_rdesc_v2_pen_template_size = > sizeof(uclogic_rdesc_v2_pen_template_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v2_pen_template_size); > > /* > * Expand to the contents of a generic frame buttons report descriptor. > @@ -702,16 +726,22 @@ const size_t uclogic_rdesc_v2_pen_template_size = > const __u8 uclogic_rdesc_v1_frame_arr[] = { > UCLOGIC_RDESC_FRAME_BUTTONS_BYTES(UCLOGIC_RDESC_V1_FRAME_ID, 8) > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v1_frame_arr); > + > const size_t uclogic_rdesc_v1_frame_size = > sizeof(uclogic_rdesc_v1_frame_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v1_frame_size); > > /* Fixed report descriptor for (tweaked) v2 frame button reports */ > const __u8 uclogic_rdesc_v2_frame_buttons_arr[] = { > UCLOGIC_RDESC_FRAME_BUTTONS_BYTES(UCLOGIC_RDESC_V2_FRAME_BUTTONS_ID, > 12) > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v2_frame_buttons_arr); > + > const size_t uclogic_rdesc_v2_frame_buttons_size = > sizeof(uclogic_rdesc_v2_frame_buttons_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v2_frame_buttons_size); > > /* Fixed report descriptor for (tweaked) v2 frame touch ring reports */ > const __u8 uclogic_rdesc_v2_frame_touch_ring_arr[] = { > @@ -758,8 +788,11 @@ const __u8 uclogic_rdesc_v2_frame_touch_ring_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v2_frame_touch_ring_arr); > + > const size_t uclogic_rdesc_v2_frame_touch_ring_size = > sizeof(uclogic_rdesc_v2_frame_touch_ring_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v2_frame_touch_ring_size); > > /* Fixed report descriptor for (tweaked) v2 frame touch strip reports */ > const __u8 uclogic_rdesc_v2_frame_touch_strip_arr[] = { > @@ -806,8 +839,11 @@ const __u8 uclogic_rdesc_v2_frame_touch_strip_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v2_frame_touch_strip_arr); > + > const size_t uclogic_rdesc_v2_frame_touch_strip_size = > sizeof(uclogic_rdesc_v2_frame_touch_strip_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v2_frame_touch_strip_size); > > /* Fixed report descriptor for (tweaked) v2 frame dial reports */ > const __u8 uclogic_rdesc_v2_frame_dial_arr[] = { > @@ -856,14 +892,22 @@ const __u8 uclogic_rdesc_v2_frame_dial_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v2_frame_dial_arr); > + > const size_t uclogic_rdesc_v2_frame_dial_size = > sizeof(uclogic_rdesc_v2_frame_dial_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_v2_frame_dial_size); > > const __u8 uclogic_ugee_v2_probe_arr[] = { > 0x02, 0xb0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 > }; > +EXPORT_SYMBOL_GPL(uclogic_ugee_v2_probe_arr); > + > const size_t uclogic_ugee_v2_probe_size = sizeof(uclogic_ugee_v2_probe_arr); > +EXPORT_SYMBOL_GPL(uclogic_ugee_v2_probe_size); > + > const int uclogic_ugee_v2_probe_endpoint = 0x03; > +EXPORT_SYMBOL_GPL(uclogic_ugee_v2_probe_endpoint); > > /* Fixed report descriptor template for UGEE v2 pen reports */ > const __u8 uclogic_rdesc_ugee_v2_pen_template_arr[] = { > @@ -935,8 +979,11 @@ const __u8 uclogic_rdesc_ugee_v2_pen_template_arr[] = { > 0xc0, /* End Collection, */ > 0xc0, /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_v2_pen_template_arr); > + > const size_t uclogic_rdesc_ugee_v2_pen_template_size = > sizeof(uclogic_rdesc_ugee_v2_pen_template_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_v2_pen_template_size); > > /* Fixed report descriptor template for UGEE v2 frame reports (buttons only) */ > const __u8 uclogic_rdesc_ugee_v2_frame_btn_template_arr[] = { > @@ -964,8 +1011,11 @@ const __u8 uclogic_rdesc_ugee_v2_frame_btn_template_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_v2_frame_btn_template_arr); > + > const size_t uclogic_rdesc_ugee_v2_frame_btn_template_size = > sizeof(uclogic_rdesc_ugee_v2_frame_btn_template_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_v2_frame_btn_template_size); > > /* Fixed report descriptor template for UGEE v2 frame reports (dial) */ > const __u8 uclogic_rdesc_ugee_v2_frame_dial_template_arr[] = { > @@ -1004,8 +1054,11 @@ const __u8 uclogic_rdesc_ugee_v2_frame_dial_template_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_v2_frame_dial_template_arr); > + > const size_t uclogic_rdesc_ugee_v2_frame_dial_template_size = > sizeof(uclogic_rdesc_ugee_v2_frame_dial_template_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_v2_frame_dial_template_size); > > /* Fixed report descriptor template for UGEE v2 frame reports (mouse) */ > const __u8 uclogic_rdesc_ugee_v2_frame_mouse_template_arr[] = { > @@ -1038,8 +1091,11 @@ const __u8 uclogic_rdesc_ugee_v2_frame_mouse_template_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_v2_frame_mouse_template_arr); > + > const size_t uclogic_rdesc_ugee_v2_frame_mouse_template_size = > sizeof(uclogic_rdesc_ugee_v2_frame_mouse_template_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_v2_frame_mouse_template_size); > > /* Fixed report descriptor template for UGEE v2 battery reports */ > const __u8 uclogic_rdesc_ugee_v2_battery_template_arr[] = { > @@ -1072,8 +1128,11 @@ const __u8 uclogic_rdesc_ugee_v2_battery_template_arr[] = { > 0x81, 0x01, /* Input (Constant), */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_v2_battery_template_arr); > + > const size_t uclogic_rdesc_ugee_v2_battery_template_size = > sizeof(uclogic_rdesc_ugee_v2_battery_template_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_v2_battery_template_size); > > /* Fixed report descriptor for Ugee EX07 frame */ > const __u8 uclogic_rdesc_ugee_ex07_frame_arr[] = { > @@ -1099,8 +1158,11 @@ const __u8 uclogic_rdesc_ugee_ex07_frame_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_ex07_frame_arr); > + > const size_t uclogic_rdesc_ugee_ex07_frame_size = > sizeof(uclogic_rdesc_ugee_ex07_frame_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_ex07_frame_size); > > /* Fixed report descriptor for Ugee G5 frame controls */ > const __u8 uclogic_rdesc_ugee_g5_frame_arr[] = { > @@ -1153,8 +1215,10 @@ const __u8 uclogic_rdesc_ugee_g5_frame_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_g5_frame_arr); > const size_t uclogic_rdesc_ugee_g5_frame_size = > sizeof(uclogic_rdesc_ugee_g5_frame_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_ugee_g5_frame_size); > > /* Fixed report descriptor for XP-Pen Deco 01 frame controls */ > const __u8 uclogic_rdesc_xppen_deco01_frame_arr[] = { > @@ -1187,9 +1251,11 @@ const __u8 uclogic_rdesc_xppen_deco01_frame_arr[] = { > 0xC0, /* End Collection, */ > 0xC0 /* End Collection */ > }; > +EXPORT_SYMBOL_GPL(uclogic_rdesc_xppen_deco01_frame_arr); > > const size_t uclogic_rdesc_xppen_deco01_frame_size = > sizeof(uclogic_rdesc_xppen_deco01_frame_arr); > +EXPORT_SYMBOL_GPL(uclogic_rdesc_xppen_deco01_frame_size); > > /** > * uclogic_rdesc_template_apply() - apply report descriptor parameters to a > @@ -1242,3 +1308,9 @@ __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr, > > return rdesc_ptr; > } > +EXPORT_SYMBOL_GPL(uclogic_rdesc_template_apply); > + > +MODULE_LICENSE("GPL"); > +MODULE_AUTHOR("Martin Rusko"); > +MODULE_AUTHOR("Nikolai Kondrashov"); > +MODULE_DESCRIPTION("HID driver for UC-Logic devices original and fixed report descriptors"); > -- > 2.39.2 >