Re: [PATCH] clk: imx8mp: register driver at arch_initcall time

From: Fabio Estevam
Date: Sat Nov 19 2022 - 17:03:06 EST


On Sat, Nov 19, 2022 at 6:57 PM Rasmus Villemoes
<linux@xxxxxxxxxxxxxxxxxx> wrote:

> Sorry, I don't follow. Before this patch, the driver also implicitly had
> a module_exit() doing exactly this platform_driver_unregister(), it was
> just hidden inside the module_platform_driver() macro. And I think
> that's necessary if one wants to test that the module can be loaded and
> unloaded (I don't think it's ever useful or even possible to have it be
> a module on an actual imx8mp board).

You cannot load/unload it due to .suppress_bind_attrs = true, being passed.

> For a modular build, this patch changes nothing since all foo_initcall
> levels are translated to module_initcall for those. And when the driver
> is built-in, the __exit code, both before and after this patch, is
> discarded in the final image.

All I am suggesting is that you the patch only does:

--- a/drivers/clk/imx/clk-imx8mp.c
+++ b/drivers/clk/imx/clk-imx8mp.c
@@ -734,7 +734,19 @@ static struct platform_driver imx8mp_clk_driver = {
.of_match_table = imx8mp_clk_of_match,
},
};
-module_platform_driver(imx8mp_clk_driver);
+
+static int __init imx8mp_clk_init(void)
+{
+ return platform_driver_register(&imx8mp_clk_driver);
+}
+arch_initcall(imx8mp_clk_init);

This is the same as in drivers/pinctrl/freescale/pinctrl-imx8mm.c for example.