[PATCH 2/2] nvme: keyring: fix conditional compilation
Hannes Reinecke
hare at suse.de
Fri Oct 27 02:08:23 PDT 2023
On 10/27/23 10:56, Christoph Hellwig wrote:
> On Fri, Oct 27, 2023 at 10:54:42AM +0200, Hannes Reinecke wrote:
>>> I don't really mind the link order, for these cases I usually add a
>>> comment to the Makefile so that people don't accidentally change it.
>>
>> Point is not that it has to be initialized first, point is it has to be
>> initialized only _once_.
>
> module_init ensure it is only initialized once except for the case where
> the module is unloaded and reloaded, in which case you actually do need
> to initialize it again.
>
So if I do this:
obj-$(CONFIG_MOD1) += mod1.o mod-common.o
obj-$(CONFIG_MOD2) += mod2.o mod-common.o
and mod-common contains a 'module_init()' and a 'module_exit()'
function, what happens if I load mod2 after mod1?
And what happens if I unload mod2, but keep mod1?
Cheers,
Hannes
More information about the Linux-nvme
mailing list