[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a9967a8c-8e03-44c2-8f79-14c6dd5d74af@app.fastmail.com>
Date: Thu, 26 Sep 2024 06:28:17 +0000
From: "Arnd Bergmann" <arnd@...db.de>
To: "Marek Vasut" <marex@...x.de>, linux-arm-kernel@...ts.infradead.org
Cc: kernel@...electronics.com,
"AngeloGioacchino Del Regno" <angelogioacchino.delregno@...labora.com>,
"Fabio Estevam" <festevam@...il.com>,
"Jeff Johnson" <quic_jjohnson@...cinc.com>,
"Neil Armstrong" <neil.armstrong@...aro.org>,
"Pengutronix Kernel Team" <kernel@...gutronix.de>,
"Saravana Kannan" <saravanak@...gle.com>,
"Sascha Hauer" <s.hauer@...gutronix.de>, "Shawn Guo" <shawnguo@...nel.org>,
imx@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] soc: imx8m: Probe the SoC driver as platform driver
On Wed, Sep 25, 2024, at 22:04, Marek Vasut wrote:
> With driver_async_probe=* on kernel command line, the following trace is
> produced because on i.MX8M Plus hardware because the soc-imx8m.c driver
> calls of_clk_get_by_name() which returns -EPROBE_DEFER because the clock
> driver is not yet probed. This was not detected during regular testing
> without driver_async_probe.
>
> Convert the SoC code to platform driver and instantiate a platform device
> in its current device_initcall() to probe the platform driver. Rework
> .soc_revision callback to always return valid error code and return SoC
> revision via parameter. This way, if anything in the .soc_revision callback
> return -EPROBE_DEFER, it gets propagated to .probe and the .probe will get
> retried later.
Thanks for the new version, that was quick!
> +static struct platform_driver imx8m_soc_driver = {
> + .probe = imx8m_soc_probe,
> + .driver = {
> + .name = "imx8m-soc",
> + },
> +};
> +module_platform_driver(imx8m_soc_driver);
> +
> +static int __init imx8_soc_init(void)
> +{
> + struct platform_device *pdev;
> +
> + pdev = platform_device_register_simple("imx8m-soc", -1, NULL, 0);
> +
> + return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
> +}
> device_initcall(imx8_soc_init);
Did you run into problems with the method I suggested first?
I don't like the way that this version still registers both the
device and driver regardless of the hardware it runs on, I'd
prefer to leave the platform check in the initcall and
only register them if we are actually on an imx8 machine.
Having two initcalls also makes it impossible to build this
as a loadable module, which is why I suggested
platform_create_bundle(). I think you can keep the
of_device_id lookup and pass the imx8_soc_data pointer
as the platform_data to platform_create_bundle.
Arnd
Powered by blists - more mailing lists