From: "Alvin Šipraga" <alvin.sipraga@analog.com>
To: Fabio Forni <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 v2] mux: convert to use fwnode interface
Date: Fri, 25 Sep 2026 17:37:22 +0200 [thread overview]
Message-ID: <araS8BpKyYI-nkxM@analog.com> (raw)
In-Reply-To: <20260916-mux_fwnode-v2-1-58f1d85b9dde@redaril.me>
On Wed, Sep 16, 2026 at 07:26:34PM +0200, Fabio Forni wrote:
> As firmware node is a more common abstract, this will convert the whole
> thing to fwnode interface.
>
> Co-developed-by: Xu Yang <xu.yang_2@nxp.com>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> Signed-off-by: Fabio Forni <development@redaril.me>
> ---
> This patch migrates the multiplexer subsystem from using the of_*
> family of functions and structs, to the more generic fwnode framework.
>
> It is a rebase of a single commit[1] contained in a old patch series[2]
> submitted by Xu Yang. The original commit plus follow-up comments were
> tested on kernel v6.12 on an arm64-based board, but this current rebase
> isn't tested yet.
>
> Link: https://lore.kernel.org/all/20220823195429.1243516-3-xu.yang_2@nxp.com [1]
> Link: https://lore.kernel.org/all/20220823195429.1243516-1-xu.yang_2@nxp.com [2]
> ---
> Changes in v2:
> - Rename devm_mux_state_get_from_swnode into devm_mux_state_get_from_fwnode
> - Link to v1: https://lore.kernel.org/r/20260915-mux_fwnode-v1-1-ed5a6d8202d4@redaril.me
> ---
> drivers/mux/core.c | 96 ++++++++++++++++++-----------------
> drivers/pinctrl/pinctrl-generic-mux.c | 4 +-
> include/linux/mux/consumer.h | 6 ++-
> 3 files changed, 57 insertions(+), 49 deletions(-)
[...]
> static struct mux_control *mux_get(struct device *dev, const char *mux_name,
> unsigned int *state, bool optional,
> - struct device_node *node)
> + struct fwnode_handle *node)
> {
> - struct device_node *np = node ? node : dev->of_node;
> - struct of_phandle_args args;
> + struct fwnode_handle *fwnode = node ? node : dev_fwnode(dev);
> + struct fwnode_reference_args args;
> struct mux_chip *mux_chip;
> unsigned int controller;
> int index = 0;
> @@ -551,11 +552,13 @@ static struct mux_control *mux_get(struct device *dev, const char *mux_name,
>
> if (mux_name) {
> if (state)
> - index = of_property_match_string(np, "mux-state-names",
> - mux_name);
> + index = fwnode_property_match_string(fwnode,
> + "mux-state-names",
> + mux_name);
> else
> - index = of_property_match_string(np, "mux-control-names",
> - mux_name);
> + index = fwnode_property_match_string(fwnode,
> + "mux-control-names",
> + mux_name);
> if (index < 0 && optional) {
> return NULL;
> } else if (index < 0) {
> @@ -566,39 +569,40 @@ static struct mux_control *mux_get(struct device *dev, const char *mux_name,
> }
>
> if (state)
> - ret = of_parse_phandle_with_args(np,
> - "mux-states", "#mux-state-cells",
> - index, &args);
> + ret = fwnode_property_get_reference_args(fwnode, "mux-states",
> + "#mux-state-cells", 0,
> + index, &args);
> else
> - ret = of_parse_phandle_with_args(np,
> - "mux-controls", "#mux-control-cells",
> - index, &args);
> + ret = fwnode_property_get_reference_args(fwnode,
> + "mux-controls", "#mux-control-cells",
> + 0, index, &args);
> +
> if (ret) {
> if (optional && ret == -ENOENT)
> return NULL;
>
> - dev_err(dev, "%pOF: failed to get mux-%s %s(%i)\n",
> - np, state ? "state" : "control",
> - mux_name ?: "", index);
> + dev_err(dev, "%pfw: failed to get mux-%s %s(%i)\n",
> + fwnode, state ? "state" : "control", mux_name ?: "",
> + index);
> return ERR_PTR(ret);
> }
>
> - mux_chip = of_find_mux_chip_by_node(args.np);
> - of_node_put(args.np);
> + mux_chip = mux_chip_find_by_fwnode(args.fwnode);
> + fwnode_handle_put(args.fwnode);
I'm actually not sure why there was an of_node_put() here in the first
place. It seems wrong to me. Any idea what it's for?
I want to give a Reviewed-by here for the rest of the code, but if the
above _put() erroneous, it might be better to add a patch before this
one to remove it (and cc the stable list with that patch).
> if (!mux_chip)
> return ERR_PTR(-EPROBE_DEFER);
Kind regards,
Alvin
next prev parent reply other threads:[~2026-09-25 15:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 17:26 [PATCH v2] mux: convert to use fwnode interface Fabio Forni via B4 Relay
2026-09-16 17:26 ` Fabio Forni
2026-09-23 21:24 ` Fabio
2026-09-25 15:37 ` Alvin Šipraga [this message]
2026-09-26 10:00 ` Fabio
2026-09-29 7:59 ` Alvin Šipraga
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=araS8BpKyYI-nkxM@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.