Re: [PATCH 1/2] driver core: Clear FWNODE_FLAG_NOT_DEVICE when a device is added

From: Saravana Kannan
Date: Tue Feb 20 2024 - 21:42:12 EST


On Tue, Feb 20, 2024 at 3:10 AM Herve Codina <herve.codina@xxxxxxxxxxx> wrote:
>
> Since commit 1a50d9403fb9 ("treewide: Fix probing of devices in DT
> overlays"), when using device-tree overlays, the FWNODE_FLAG_NOT_DEVICE
> is set on each overlay nodes.
> When an overlay contains a node related to a bus (i2c for instance)
> and its children nodes representing i2c devices, the flag is cleared for
> the bus node by the OF notifier but the "standard" probe sequence takes
> place (the same one is performed without an overlay) for the bus and
> children devices are created simply by walking the children DT nodes
> without clearing the FWNODE_FLAG_NOT_DEVICE flag for these devices.
>
> Clear the FWNODE_FLAG_NOT_DEVICE when the device is added, no matter if
> an overlay is used or not.
>
> Fixes: 1a50d9403fb9 ("treewide: Fix probing of devices in DT overlays")
> Cc: <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
> ---
> drivers/base/core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 14d46af40f9a..61d09ac57bfb 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -3619,6 +3619,7 @@ int device_add(struct device *dev)
> */
> if (dev->fwnode && !dev->fwnode->dev) {
> dev->fwnode->dev = dev;
> + dev->fwnode->flags &= ~FWNODE_FLAG_NOT_DEVICE;
> fw_devlink_link_device(dev);
> }

Temporary Nack on this. I think depending on how we address patch 2/2
this patch might not be necessary.

Also, I'd ideally prefer this gets cleared before the device is added,
but it's a position that I'd be willing to change.



-Saravana