Re: [PATCH v4 09/29] drivers: core: Use fw_devlink_set_device()

From: Ulf Hansson

Date: Tue Oct 21 2025 - 06:37:26 EST


On Wed, 15 Oct 2025 at 09:18, Herve Codina <herve.codina@xxxxxxxxxxx> wrote:
>
> The code set directly fwnode->dev field.
>
> Use the dedicated fw_devlink_set_device() helper to perform this
> operation.
>
> Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

Reviewed-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>

Kind regards
Uffe


> ---
> drivers/base/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 3e81b1914ce5..9da630d75d17 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -3739,7 +3739,7 @@ int device_add(struct device *dev)
> * device and the driver sync_state callback is called for this device.
> */
> if (dev->fwnode && !dev->fwnode->dev) {
> - dev->fwnode->dev = dev;
> + fw_devlink_set_device(dev->fwnode, dev);
> fw_devlink_link_device(dev);
> }
>
> @@ -3899,7 +3899,7 @@ void device_del(struct device *dev)
> device_unlock(dev);
>
> if (dev->fwnode && dev->fwnode->dev == dev)
> - dev->fwnode->dev = NULL;
> + fw_devlink_set_device(dev->fwnode, NULL);
>
> /* Notify clients of device removal. This call must come
> * before dpm_sysfs_remove().
> --
> 2.51.0
>