Re: [PATCH V2 1/4] gpio: mxc: Support module build

From: Arnd Bergmann
Date: Wed Jul 22 2020 - 04:15:26 EST


On Wed, Jul 22, 2020 at 3:50 AM Anson Huang <Anson.Huang@xxxxxxx> wrote:
>
> Change config to tristate, add module device table, module author,
> description and license to support module build for i.MX GPIO driver.
>
> As this is a SoC GPIO module, it provides common functions for most
> of the peripheral devices, such as GPIO pins control, secondary
> interrupt controller for GPIO pins IRQ etc., without GPIO driver, most
> of the peripheral devices will NOT work properly, so GPIO module is
> similar with clock, pinctrl driver that should be loaded ONCE and
> never unloaded.
>
> Since MXC GPIO driver needs to have init function to register syscore
> ops once, here still use subsys_initcall(), NOT module_platform_driver().

I'm not following this explanation.

Why is this driver using syscore_ops rather than
SIMPLE_DEV_PM_OPS() or similar?

Why can the driver not unregister the syscore_ops the way it
registers them when unloading the module?

Why do you need subsys_initcall() rather than a device_initcall()?

If the subsys_initcall() is indeed required here instead of
device_initcall(), how can it work if the driver is a loadable
module?

Arnd