Re: [PATCH 2/2] nvme: keyring: fix conditional compilation

Christoph Hellwig
2023-10-27T09:22:01Z

On Fri, Oct 27, 2023 at 11:08:23AM +0200, Hannes Reinecke wrote:
> 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?

mod-common is already loaded and won't be loaded again.

> And what happens if I unload mod2, but keep mod1?

mod-common doesn't become available for unloading until all
modules using it are unloaded first.