Re: [PATCH v3 2/3] mux: Document mux_chip_find_by_fwnode()
From: Alvin Šipraga
Date: Wed Sep 30 2026 - 05:50:42 EST
On Tue, Sep 29, 2026 at 10:51:47PM +0200, Fabio Forni via B4 Relay wrote:
> From: Fabio Forni <development@xxxxxxxxxx>
>
> What mux_chip_find_by_fwnode() does it pretty obvious. What's
> not-so-obvious is that the reference count of mux_chip->dev must be
> decreased when done working with it. This commit clarifies the
> requirement.
>
> Signed-off-by: Fabio Forni <development@xxxxxxxxxx>
Reviewed-by: Alvin Šipraga <alvin.sipraga@xxxxxxxxxx>
> ---
> drivers/mux/core.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mux/core.c b/drivers/mux/core.c
> index 56096a9139bd..d5121772c483 100644
> --- a/drivers/mux/core.c
> +++ b/drivers/mux/core.c
> @@ -517,7 +517,16 @@ int mux_state_deselect(struct mux_state *mstate)
> }
> EXPORT_SYMBOL_GPL(mux_state_deselect);
>
> -/* Note this function returns a reference to the mux_chip dev. */
> +/**
> + * mux_chip_find_by_fwnode() - Find a mux-chip by its fwnode.
> + * @fwnode: The fwnode representing the mux-chip.
> + *
> + * When a mux-chip is found, the mux-chip increases the reference count of
> + * the underlying &struct device. The caller is responsible for calling
> + * put_device() on it.
> + *
> + * Return: Pointer to the mux-chip, or NULL if not found.
> + */
> static struct mux_chip *mux_chip_find_by_fwnode(struct fwnode_handle *fwnode)
> {
> struct device *dev;
>
> --
> 2.55.0
>
>