All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alvin Šipraga" <alvin.sipraga@analog.com>
To: development@redaril.me
Cc: Peter Rosin <peda@lysator.liu.se>,
	Linus Walleij <linusw@kernel.org>,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	xu.yang_2@nxp.com
Subject: Re: [PATCH v3 2/3] mux: Document mux_chip_find_by_fwnode()
Date: Wed, 30 Sep 2026 11:39:21 +0200	[thread overview]
Message-ID: <arzYvT0pxsC72iP1@analog.com> (raw)
In-Reply-To: <20260929-mux_fwnode-v3-2-9b3b9ae1334e@redaril.me>

On Tue, Sep 29, 2026 at 10:51:47PM +0200, Fabio Forni via B4 Relay wrote:
> From: Fabio Forni <development@redaril.me>
> 
> 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@redaril.me>

Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>

> ---
>  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
> 
> 

  reply	other threads:[~2026-09-30  9:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 20:51 [PATCH v3 0/3] Migrate the multiplexer subsystem to fwnode Fabio Forni via B4 Relay
2026-09-29 20:51 ` Fabio Forni
2026-09-29 20:51 ` [PATCH v3 1/3] mux: convert to use fwnode interface Fabio Forni via B4 Relay
2026-09-29 20:51   ` Fabio Forni
2026-09-30  9:39   ` Alvin Šipraga
2026-09-29 20:51 ` [PATCH v3 2/3] mux: Document mux_chip_find_by_fwnode() Fabio Forni via B4 Relay
2026-09-29 20:51   ` Fabio Forni
2026-09-30  9:39   ` Alvin Šipraga [this message]
2026-09-29 20:51 ` [PATCH v3 3/3] mux: Avoid use-after-free of args.fwnode in mux_get() Fabio Forni via B4 Relay
2026-09-29 20:51   ` Fabio Forni
2026-09-30  9:45   ` Alvin Šipraga
2026-09-30 17:44     ` Fabio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=arzYvT0pxsC72iP1@analog.com \
    --to=alvin.sipraga@analog.com \
    --cc=development@redaril.me \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@lysator.liu.se \
    --cc=xu.yang_2@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.