On Thu, Jan 23, 2025 at 12:09:50PM +0100, Uwe Kleine-König wrote: > Symbols can be exported in namespaces and to make use of such symbols, > the namespace has to be explicitly imported. Importing a namespace > without actually using one of its symbols is likely a mistake. > > There are a few offenders for an x86_64 allmodconfig build, so the > warning is (for now) only enabled for W=1 builds. > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx> > --- > Hello, > > one of the offenders is drivers/pwm/pwm-raspberrypi-poe.c ( > > WARNING: modpost: module pwm-raspberrypi-poe imports namespace PWM, but doesn't use it. > > ). The issue there is that on x86_64 CONFIG_RASPBERRYPI_FIRMWARE is > always disabled and so devm_rpi_firmware_get() returns always NULL which > makes raspberrypi_pwm_probe return an error before the pwm functions are > used. So the compiler optimizes out all references to pwm functions and > the warning triggers. I didn't look into the other problems to check if > these are similar half-false positives. > > Still I think this is a useful check? This will require to add a number of ugly ifdeffery to the kernel code like MODULE_FOO(); #if ... MODULE_IMPORT_NS(); #endif I am definitely not okay with that. Maybe you should introduce the MODULE_IMPORT_NS_IF_REACHABLE() or so to hide this or whatever equivalent there? -- With Best Regards, Andy Shevchenko