[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL_JsqJOv7D5nHteGPDKC2+ns1caVNs-NFFJppLuK0OEB8dztQ@mail.gmail.com>
Date: Thu, 2 Sep 2021 09:24:29 -0500
From: Rob Herring <robh+dt@...nel.org>
To: Saravana Kannan <saravanak@...gle.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Len Brown <lenb@...nel.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
Android Kernel Team <kernel-team@...roid.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
devicetree@...r.kernel.org,
"open list:ACPI FOR ARM64 (ACPI/arm64)" <linux-acpi@...r.kernel.org>
Subject: Re: [PATCH v1 2/2] of: platform: Mark bus devices nodes with FWNODE_FLAG_NEVER_PROBES
On Wed, Sep 1, 2021 at 9:55 PM Saravana Kannan <saravanak@...gle.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@...gle.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
Powered by blists - more mailing lists