LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Rob Herring <robh+dt@kernel.org>
To: Saravana Kannan <saravanak@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Len Brown <lenb@kernel.org>, Ulf Hansson <ulf.hansson@linaro.org>,
	Android Kernel Team <kernel-team@android.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	devicetree@vger.kernel.org,
	"open list:ACPI FOR ARM64 (ACPI/arm64)"
	<linux-acpi@vger.kernel.org>
Subject: Re: [PATCH v1 2/2] of: platform: Mark bus devices nodes with FWNODE_FLAG_NEVER_PROBES
Date: Thu, 2 Sep 2021 09:24:29 -0500	[thread overview]
Message-ID: <CAL_JsqJOv7D5nHteGPDKC2+ns1caVNs-NFFJppLuK0OEB8dztQ@mail.gmail.com> (raw)
In-Reply-To: <20210902025528.1017391-3-saravanak@google.com>

On Wed, Sep 1, 2021 at 9:55 PM Saravana Kannan <saravanak@google.com> wrote:
>
> We don't want fw_devlink creating device links for bus devices as
> they'll never probe. So mark those device node with this flag.
>
> Signed-off-by: Saravana Kannan <saravanak@google.com>
> ---
>  drivers/of/platform.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 74afbb7a4f5e..42b3936d204a 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -392,6 +392,22 @@ static int of_platform_bus_create(struct device_node *bus,
>         if (!dev || !of_match_node(matches, bus))
>                 return 0;
>
> +       /*
> +        * If the bus node has only one compatible string value and it has
> +        * matched as a bus node, it's never going to get probed by a device
> +        * driver. So flag it as such so that fw_devlink knows not to create
> +        * device links with this device.
> +        *
> +        * This doesn't catch all devices that'll never probe, but this is good
> +        * enough for now.
> +        *
> +        * This doesn't really work for PPC because of how it uses
> +        * of_platform_bus_probe() to add normal devices. So ignore PPC cases.
> +        */
> +       if (!IS_ENABLED(CONFIG_PPC) &&
> +           of_property_count_strings(bus, "compatible") == 1)
> +               bus->fwnode.flags |= FWNODE_FLAG_NOT_DEVICE;

This looks fragile relying on 1 compatible string, and the DT flags in
this code have been fragile too. I'm pretty sure we have cases of
simple-bus or simple-mfd that also have another compatible.

Couldn't we solve this with a simple driver? Make 'simple-pm-bus'
driver work for other cases? BTW, this patch doesn't even work for
simple-pm-bus. A driver for simple-bus may cause issues if there's a
more specific driver to bind to as we don't handle that. It's simply
whichever matches first.

Rob

  reply	other threads:[~2021-09-02 14:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02  2:55 [PATCH v1 0/2] Ulf reported an issue[1] with fw_devlink. This series tries to fix that issue Saravana Kannan
2021-09-02  2:55 ` [PATCH v1 1/2] driver core: Add support for FWNODE_FLAG_NEVER_PROBES Saravana Kannan
2021-09-02  2:55 ` [PATCH v1 2/2] of: platform: Mark bus devices nodes with FWNODE_FLAG_NEVER_PROBES Saravana Kannan
2021-09-02 14:24   ` Rob Herring [this message]
2021-09-02 16:57     ` Saravana Kannan
2021-09-02 19:02       ` Rob Herring
2021-09-02 19:28         ` Saravana Kannan
2021-09-03  0:53           ` Rob Herring
2021-09-03  1:15             ` Saravana Kannan
2021-09-03 14:58               ` Rob Herring
2021-09-03 17:06                 ` Saravana Kannan
2021-09-03 17:37               ` Rafael J. Wysocki
2021-09-02 17:20   ` Saravana Kannan
2021-09-02  2:56 ` [PATCH v1 0/2] Ulf reported an issue[1] with fw_devlink. This series tries to fix that issue Saravana Kannan
2021-09-02 15:56   ` Rafael J. Wysocki
2021-09-02 16:27     ` Saravana Kannan
2021-09-02 16:31       ` Rafael J. Wysocki

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=CAL_JsqJOv7D5nHteGPDKC2+ns1caVNs-NFFJppLuK0OEB8dztQ@mail.gmail.com \
    --to=robh+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@android.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=saravanak@google.com \
    --cc=ulf.hansson@linaro.org \
    --subject='Re: [PATCH v1 2/2] of: platform: Mark bus devices nodes with FWNODE_FLAG_NEVER_PROBES' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).