Re: [PATCH v6 13/27] PCI: of: Remove fwnode_dev_initialized() call for a PCI root bridge node

Bjorn Helgaas
2026-03-25T20:20:38Z

On Wed, Mar 25, 2026 at 03:35:40PM +0100, Herve Codina wrote:
> During the instantiation of devices described by a device-tree overlay
> applied on a PCI device, devlink displays the following kind of debug
> messages instead of creating the expected links:
> 'Not linking xxxx - might never become dev'
>
> Without those expected links, the device removal order cannot be
> correct.
>
> Those debug traces are printed by fw_devlink_create_devlink(). In our
> use case, they are all printed because the supplier of the link has at
> least one of its ancestor with its fwnode flag FWNODE_FLAG_INITIALIZED
> set.
>
> The culprit ancestor is the PCI root bridge.
>
> The fwnode related to the PCI root bridge is created dynamically by the
> of_pci_make_host_bridge_node() function. During this creation
> fwnode_dev_initialized() is called which set the FWNODE_FLAG_INITIALIZED
> flag.
>
> Calling fwnode_dev_initialized() tells devlink that the device related
> to this node is handled out of the driver core. This is not correct in
> our case. Indeed the device related to this firmware node is handled
> using driver core mechanisms and is fully compliant devlink
> expectations.
>
> Simply remove the fwnode_dev_initialized() call. With that done, the
> devlink debug messages are no more displayed and links that were missing
> are correctly created.
>
> Signed-off-by: Herve Codina <herve.codina@bootlin.com>

I would ordinarily make sure the person who added
fwnode_dev_initialized() here was ok with its removal, but it looks
like you added this with 1f340724419e ("PCI: of: Create device tree
PCI host bridge node"), so I assume you're ok with removing it :)

I suppose there could be a "Fixes: 1f340724419e" tag, but maybe
there's no need to backport this anywhere?

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
> drivers/pci/of.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/pci/of.c b/drivers/pci/of.c
> index b694fcda16b1..0993257fe025 100644
> --- a/drivers/pci/of.c
> +++ b/drivers/pci/of.c
> @@ -811,7 +811,6 @@ void of_pci_make_host_bridge_node(struct pci_host_bridge *bridge)
> */
> of_node_set_flag(np, OF_POPULATED);
> fw_devlink_set_device(&np->fwnode, &bridge->dev);
> - fwnode_dev_initialized(&np->fwnode, true);
>
> ret = of_changeset_apply(cset);
> if (ret)
> --
> 2.53.0
>