mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 v3 1/2] soc: imx8m: Probe the SoC driver as platform driver
Date: Sat, 28 Sep 2024 14:09:06 +0000	[thread overview]
Message-ID: <cf49f401-725d-4460-8c04-5acd993333f3@app.fastmail.com> (raw)
In-Reply-To: <CAGETcx95ZMBJR0F-3Cr8++1_MwiMCPHiwfdx7m5q0XDAiGG75A@mail.gmail.com>

On Fri, Sep 27, 2024, at 22:27, Saravana Kannan wrote:
> On Fri, Sep 27, 2024 at 2:55 PM Marek Vasut <marex@denx.de> wrote:
>> >
>> > I'm glad it's working for you, but I think there might still be a race
>> > that you are just lucky enough to not hit. I think you still need to
>> > fix up drivers/base/soc.c to return -EPROBE_DEFER when
>> > soc_device_match() is called but soc_bus_type has no devices
>> > registered. That way any drivers that try to use that API will defer
>> > probe until this device gets to probe.
>>
>> soc_device_match() returns a pointer to soc_device_attribute or NULL, do
>> you have some other function in mind ?
>
> No, I'm talking about the same function. I'm asking to change it to
> return ERR_PTR(-EPROBE_DEFER) instead
> of NULL if no soc device has been registered yet.
>
> And you'll also go change all the drivers that use that API and are on
> the IMX boards supported by this soc driver, to handle the
> -EPROBE_DEFER correctly.
>
> And this error will only get returned for boards that do async probing
> and using a platform device to register the soc device. So it's
> not going to break everyone if you do this change.

I don't like it when an interface can return both NULL an
ERR_PTR(), that just makes it too easy to be used incorrectly.

Changing it to always return ERR_PTR() on an error is still
risky, e.g. when a new driver gets merged that did get the
same treewide API change, so if we do that, this should
probably also change either the function name or the prototype.

    Arnd

  reply	other threads:[~2024-09-28 14:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26 21:36 Marek Vasut
2024-09-26 21:36 ` [PATCH v3 2/2] soc: imx8m: Remove global soc_uid Marek Vasut
2024-09-27 16:58   ` Frank Li
2024-09-27 20:05     ` Marek Vasut
2024-09-26 23:39 ` [PATCH v3 1/2] soc: imx8m: Probe the SoC driver as platform driver Saravana Kannan
2024-09-27 11:56   ` Arnd Bergmann
2024-09-27 21:42   ` Marek Vasut
2024-09-27 22:27     ` Saravana Kannan
2024-09-28 14:09       ` Arnd Bergmann [this message]
2024-09-29 18:47       ` 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=cf49f401-725d-4460-8c04-5acd993333f3@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®