From: Dan Carpenter <dan.carpenter@linaro.org>
To: Jonas Jelonek <jelonek.jonas@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Peter Rosin <peda@axentia.se>,
Geert Uytterhoeven <geert+renesas@glider.be>,
linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Thomas Richard <thomas.richard@bootlin.com>
Subject: Re: [PATCH v7 2/2] gpio: add gpio-line-mux driver
Date: Wed, 7 Jan 2026 11:40:08 +0300 [thread overview]
Message-ID: <aV4b6GAGz1zyf8Xy@stanley.mountain> (raw)
In-Reply-To: <20251227180134.1262138-3-jelonek.jonas@gmail.com>
On Sat, Dec 27, 2025 at 06:01:34PM +0000, Jonas Jelonek wrote:
> +struct gpio_lmux {
> + struct gpio_chip gc;
> + struct mux_control *mux;
> + struct gpio_desc *muxed_gpio;
> +
> + u32 num_gpio_mux_states;
> + unsigned int gpio_mux_states[] __counted_by(num_gpio_mux_states);
> +};
> +
> +static int gpio_lmux_gpio_get(struct gpio_chip *gc, unsigned int offset)
> +{
> + struct gpio_lmux *glm = gpiochip_get_data(gc);
> + int ret;
> +
> + if (offset > gc->ngpio)
This is off by one. Should be >=.
regards,
dan carpenter
> + return -EINVAL;
> +
> + ret = mux_control_select_delay(glm->mux, glm->gpio_mux_states[offset],
> + MUX_SELECT_DELAY_US);
> + if (ret < 0)
> + return ret;
> +
> + ret = gpiod_get_raw_value_cansleep(glm->muxed_gpio);
> + mux_control_deselect(glm->mux);
> + return ret;
> +}
next prev parent reply other threads:[~2026-01-07 8:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-27 18:01 [PATCH v7 0/2] add gpio-line-mux Jonas Jelonek
2025-12-27 18:01 ` [PATCH v7 1/2] dt-bindings: gpio: add gpio-line-mux controller Jonas Jelonek
2025-12-27 18:01 ` [PATCH v7 2/2] gpio: add gpio-line-mux driver Jonas Jelonek
2026-01-07 8:40 ` Dan Carpenter [this message]
2026-01-07 8:52 ` Bartosz Golaszewski
2026-01-02 10:10 ` [PATCH v7 0/2] add gpio-line-mux Bartosz Golaszewski
2026-01-04 12:11 ` Linus Walleij
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=aV4b6GAGz1zyf8Xy@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=jelonek.jonas@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peda@axentia.se \
--cc=robh@kernel.org \
--cc=thomas.richard@bootlin.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox