From: "Arnd Bergmann" <arnd@arndb.de>
To: "Saravana Kannan" <saravanak@google.com>, "Marek Vasut" <marex@denx.de>
Cc: linux-arm-kernel@lists.infradead.org, kernel@dh-electronics.com,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Fabio Estevam" <festevam@gmail.com>,
"Jeff Johnson" <quic_jjohnson@quicinc.com>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Shawn Guo" <shawnguo@kernel.org>,
imx@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] soc: imx8m: Probe the SoC driver late
Date: Wed, 25 Sep 2024 20:00:00 +0000 [thread overview]
Message-ID: <37634d8e-678e-45ba-98e9-a40a5e71cf77@app.fastmail.com> (raw)
In-Reply-To: <CAGETcx_ODj-FqhH7stxu27PpGNg2LiFwgC=1piLaBjDV4OagLA@mail.gmail.com>
On Wed, Sep 25, 2024, at 18:48, Saravana Kannan wrote:
> On Wed, Sep 25, 2024 at 10:07 AM Marek Vasut <marex@denx.de> wrote:
>> >
>> > Right, of course. And unfortunately it can't just register to
>> > the fsl,imx8mm-anatop/fsl,imx8mm-ocotp/... nodes because they
>> > all have a driver already.
>
> Can't we change this to add a platform device and a platform driver in
> the initcall? And then the driver can return -EPROBE_DEFER if it can't
> get the clock yet?
Yes, good idea. So the initcall would still use of_match_node()
to see if wants to be loaded and then either bail early or
call platform_create_bundle() to register the driver and the
device.
>> > On the other hand, making it a late_initcall() defeats the
>> > purpose of the driver because then it can't be used by other
>> > drivers with soc_device_match(), resulting in incorrect
>> > behavior when another driver relies on this to enable
>> > a chip revision specific workaround.
>
> We could have soc_device_match() return -EPROBE_DEFER if no soc device
> has been registered yet.
>
> For cases where it's already working without any changes, we shouldn't
> see any new -EPROBE_DEFER return values. But for cases like what Marek
> is trying to do, it should work properly. He might have to fix bad
> driver code where they remap the error instead of returning it as is.
Right.
> On a tangential note, the soc framework seems to be yet another
> framework violating the bus vs class thing. If it's a bus, then you
> need to have a probe. Otherwise, just make it a class. Might be too
> much to fix at this point, but might be good to keep this in mind if
> you plan to write more frameworks or redo soc framework at some point
> :)
>
> See Slide 20:
> https://lpc.events/event/18/contributions/1734/
Very useful, I don't think I've seen this explained like this
in the past. It's probably not easy to change now since I'm
sure there is existing userspace looking at /sys/bus/soc, but
I can at least make sure I'll follow these when reviewing new
bus_type or class submissions.
Arnd
next prev parent reply other threads:[~2024-09-25 20:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 16:00 Marek Vasut
2024-09-25 16:04 ` Arnd Bergmann
2024-09-25 16:09 ` Marek Vasut
2024-09-25 16:31 ` Arnd Bergmann
2024-09-25 17:07 ` Marek Vasut
2024-09-25 18:48 ` Saravana Kannan
2024-09-25 20:00 ` Arnd Bergmann [this message]
2024-09-25 20:04 ` Saravana Kannan
2024-09-25 22:11 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=37634d8e-678e-45ba-98e9-a40a5e71cf77@app.fastmail.com \
--to=arnd@arndb.de \
--cc=angelogioacchino.delregno@collabora.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@dh-electronics.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
--cc=neil.armstrong@linaro.org \
--cc=quic_jjohnson@quicinc.com \
--cc=s.hauer@pengutronix.de \
--cc=saravanak@google.com \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®