Re: [PATCH v5 07/28] driver core: fw_devlink: Introduce fw_devlink_set_device()
From: Jonathan Cameron
Date: Mon Mar 02 2026 - 07:26:51 EST
On Fri, 27 Feb 2026 14:54:04 +0100
Herve Codina <herve.codina@xxxxxxxxxxx> wrote:
> Setting fwnode->dev is specific to fw_devlink.
>
> In order to avoid having a direct 'fwnode->dev = dev;' in several
> place in the kernel, introduce fw_devlink_set_device() helper to perform
> this operation.
>
I don't mind the helper, but the description could do with a little
detail on why. Is it just to avoid visibility of internal details, or
is there a stronger reason?
> Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> Reviewed-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
> ---
> include/linux/fwnode.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
> index a921ca2fe940..a1345e274125 100644
> --- a/include/linux/fwnode.h
> +++ b/include/linux/fwnode.h
> @@ -231,4 +231,10 @@ void fw_devlink_purge_absent_suppliers(struct fwnode_handle *fwnode);
> void fw_devlink_refresh_fwnode(struct fwnode_handle *fwnode);
> bool fw_devlink_is_strict(void);
>
> +static inline void fw_devlink_set_device(struct fwnode_handle *fwnode,
> + struct device *dev)
> +{
> + fwnode->dev = dev;
> +}
> +
> #endif