* [PATCH] nvmem: imx-ocotp: Initialize in subsys_initcall
@ 2026-04-08 10:19 Paul Geurts
2026-04-08 10:23 ` Ahmad Fatoum
2026-04-08 11:46 ` Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Paul Geurts @ 2026-04-08 10:19 UTC (permalink / raw)
To: srini, Frank.Li, s.hauer, kernel, festevam, gregkh, p.zabel, imx,
linux-arm-kernel, linux-kernel
Cc: martijn.de.gouw, Paul Geurts
The i.MX OCOTP driver is implemented as module_platform_driver();,
which makes it initialize in device_initcall(). This means that all
drivers referencing the clock driver nodes in the device tree are
deferred by fw_devlink.
As the OCOTP driver is arch specific, but dependent on the i.MX clock
driver, which is also initialized in arch_initcall(), explicitly
initialize the driver in subsys_initcall(). This makes sure the drivers
depending on fuses defined by OCOTP, which are initialized in
device_initcall() are not deferred.
Fixes: 3edba6b47e42 ("nvmem: imx-ocotp: Add i.MX6 OCOTP driver")
Signed-off-by: Paul Geurts <paul.geurts@prodrive-technologies.com>
---
drivers/nvmem/imx-ocotp.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
index 108d78d7f6cb..9b1e7bb14ced 100644
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -638,7 +638,18 @@ static struct platform_driver imx_ocotp_driver = {
.of_match_table = imx_ocotp_dt_ids,
},
};
-module_platform_driver(imx_ocotp_driver);
+
+static int __init imx_ocotp_init(void)
+{
+ return platform_driver_register(&imx_ocotp_driver);
+}
+subsys_initcall(imx_ocotp_init);
+
+static void __exit imx_ocotp_exit(void)
+{
+ platform_driver_unregister(&imx_ocotp_driver);
+}
+module_exit(imx_ocotp_exit);
MODULE_AUTHOR("Philipp Zabel <p.zabel@pengutronix.de>");
MODULE_DESCRIPTION("i.MX6/i.MX7 OCOTP fuse box driver");
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvmem: imx-ocotp: Initialize in subsys_initcall
2026-04-08 10:19 [PATCH] nvmem: imx-ocotp: Initialize in subsys_initcall Paul Geurts
@ 2026-04-08 10:23 ` Ahmad Fatoum
2026-04-08 11:46 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2026-04-08 10:23 UTC (permalink / raw)
To: Paul Geurts, srini, Frank.Li, s.hauer, kernel, festevam, gregkh,
p.zabel, imx, linux-arm-kernel, linux-kernel
Cc: martijn.de.gouw
Hello Paul,
On 4/8/26 12:19 PM, Paul Geurts wrote:
> The i.MX OCOTP driver is implemented as module_platform_driver();,
> which makes it initialize in device_initcall(). This means that all
> drivers referencing the clock driver nodes in the device tree are
> deferred by fw_devlink.
>
> As the OCOTP driver is arch specific, but dependent on the i.MX clock
> driver, which is also initialized in arch_initcall(), explicitly
> initialize the driver in subsys_initcall(). This makes sure the drivers
> depending on fuses defined by OCOTP, which are initialized in
> device_initcall() are not deferred.
>
> Fixes: 3edba6b47e42 ("nvmem: imx-ocotp: Add i.MX6 OCOTP driver")
Same question as the imx8mm-clk patch.
Your commit message doesn't mention what problem you had the with deferral.
> -module_platform_driver(imx_ocotp_driver);
> +
> +static int __init imx_ocotp_init(void)
> +{
> + return platform_driver_register(&imx_ocotp_driver);
> +}
> +subsys_initcall(imx_ocotp_init);
Same question as before. What happens when you build this as module.
Cheers,
Ahmad
> +
> +static void __exit imx_ocotp_exit(void)
> +{
> + platform_driver_unregister(&imx_ocotp_driver);
> +}
> +module_exit(imx_ocotp_exit);
>
> MODULE_AUTHOR("Philipp Zabel <p.zabel@pengutronix.de>");
> MODULE_DESCRIPTION("i.MX6/i.MX7 OCOTP fuse box driver");
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvmem: imx-ocotp: Initialize in subsys_initcall
2026-04-08 10:19 [PATCH] nvmem: imx-ocotp: Initialize in subsys_initcall Paul Geurts
2026-04-08 10:23 ` Ahmad Fatoum
@ 2026-04-08 11:46 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2026-04-08 11:46 UTC (permalink / raw)
To: Paul Geurts
Cc: srini, Frank.Li, s.hauer, kernel, festevam, p.zabel, imx,
linux-arm-kernel, linux-kernel, martijn.de.gouw
On Wed, Apr 08, 2026 at 12:19:01PM +0200, Paul Geurts wrote:
> The i.MX OCOTP driver is implemented as module_platform_driver();,
> which makes it initialize in device_initcall(). This means that all
> drivers referencing the clock driver nodes in the device tree are
> deferred by fw_devlink.
>
> As the OCOTP driver is arch specific, but dependent on the i.MX clock
> driver, which is also initialized in arch_initcall(), explicitly
> initialize the driver in subsys_initcall(). This makes sure the drivers
> depending on fuses defined by OCOTP, which are initialized in
> device_initcall() are not deferred.
>
> Fixes: 3edba6b47e42 ("nvmem: imx-ocotp: Add i.MX6 OCOTP driver")
> Signed-off-by: Paul Geurts <paul.geurts@prodrive-technologies.com>
> ---
> drivers/nvmem/imx-ocotp.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
> index 108d78d7f6cb..9b1e7bb14ced 100644
> --- a/drivers/nvmem/imx-ocotp.c
> +++ b/drivers/nvmem/imx-ocotp.c
> @@ -638,7 +638,18 @@ static struct platform_driver imx_ocotp_driver = {
> .of_match_table = imx_ocotp_dt_ids,
> },
> };
> -module_platform_driver(imx_ocotp_driver);
> +
> +static int __init imx_ocotp_init(void)
> +{
> + return platform_driver_register(&imx_ocotp_driver);
> +}
> +subsys_initcall(imx_ocotp_init);
This is not a subsystem, sorry, but this isn't ok for a single driver to
use.
Please use the default level here, module_platform_driver() is correct,
and handle the deferred probe correctly, that is what it is designed to
do. Playing games with init levels will not solve the root problem
here, as was pointed out by the fact that you could load this module in
any order and have the exact same problem you are attempting to "solve"
here.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-08 11:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-08 10:19 [PATCH] nvmem: imx-ocotp: Initialize in subsys_initcall Paul Geurts
2026-04-08 10:23 ` Ahmad Fatoum
2026-04-08 11:46 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox