Re: [PATCH 1/4] module: Add module_subinit{_noexit} and module_subeixt helper macros
From: Christoph Hellwig
Date: Tue Jul 23 2024 - 10:34:16 EST
On Tue, Jul 23, 2024 at 04:32:36PM +0800, Youling Tang wrote:
> Providing module_subinit{_noexit} and module_subeixt helps macros ensure
> that modules init/exit match their order, while also simplifying the code.
>
> The three macros are defined as follows:
> - module_subinit(initfn, exitfn,rollback)
> - module_subinit_noexit(initfn, rollback)
> - module_subexit(rollback)
>
> `initfn` is the initialization function and `exitfn` is the corresponding
> exit function.
I find the interface a little confusing. What I would have expected
is to:
- have the module_subinit call at file scope instead of in the
module_init helper, similar to module_init/module_exit
- thus keep the rollback state explicitly in the module structure or
similar so that the driver itself doesn't need to care about at
all, and thus remove the need for the module_subexit call.