Re: [PATCH] mtd: make mtd_test.c a separate module

From: Arnd Bergmann
Date: Wed May 29 2024 - 08:37:20 EST


On Wed, May 29, 2024, at 14:13, Miquel Raynal wrote:
> Hi Arnd,
>
> arnd@xxxxxxxxxx wrote on Wed, 29 May 2024 11:50:39 +0200:
>
>> From: Arnd Bergmann <arnd@xxxxxxxx>
>>
>> This file gets linked into nine different modules, which causes a warning:
>>
>> scripts/Makefile.build:236: drivers/mtd/tests/Makefile: mtd_test.o is added to multiple modules: mtd_nandbiterrs mtd_oobtest mtd_pagetest mtd_readtest mtd_speedtest mtd_stresstest mtd_subpagetest mtd_torturetest
>
> I've never experienced this warning myself, how did you produce it?

This warning is currently enabled when building with 'make W=1',
but there are only a handful of drivers that run into it, so
I have sent patches for each one, with the plan to enable it
by default in the future.

>> Make it a separate module instead.
>
> I'm not a total fan of this just because it now requires an additional
> step to insert these test modules (they are likely used for
> debugging/development purposes, so not properly installed in the
> rootfs). Is there any chance we can find another way?

This should only be a problem when using plain 'insmod' instead
of 'modprobe' for loading the modules. Do you think this is
commonly used here?

Another option would be to turn all the helper functions into
static inline versions and just include the header, but
that does not avoid the duplication then.

Arnd