From: Thomas Richard <thomas.richard@bootlin.com>
To: Jonas Jelonek <jelonek.jonas@gmail.com>,
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>
Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] gpio: add gpio-line-mux driver
Date: Wed, 5 Nov 2025 09:51:08 +0100 [thread overview]
Message-ID: <087643b4-7a29-4424-a3b0-b60bbc7c3140@bootlin.com> (raw)
In-Reply-To: <20251104210021.247476-3-jelonek.jonas@gmail.com>
Hi Jonas,
On 11/4/25 10:00 PM, Jonas Jelonek wrote:
> Add a new driver which provides a 1-to-many mapping for a single real
> GPIO using a multiplexer. Each virtual GPIO corresponds to a multiplexer
> state which, if set for the multiplexer, connects the real GPIO to the
> corresponding virtual GPIO.
[...]
> +
> +struct gpio_lmux {
> + struct gpio_chip gc;
> + struct mux_control *mux;
> + struct mutex lock;
> +
> + struct gpio_desc *shared_gpio;
> + /* dynamically sized, must be last */
> + unsigned int gpio_mux_states[];
> +};
> +
> +DEFINE_GUARD(gpio_lmux, struct gpio_lmux *, mutex_lock(&_T->lock), mutex_unlock(&_T->lock))
I think you don't need this. A mutex guard is already defined in the
mutex header file [1].
So you just have to call:
guard(mutex)(&glm->lock);
[1]
https://elixir.bootlin.com/linux/v6.17.7/source/include/linux/mutex.h#L228
> +
> +static int gpio_lmux_gpio_get(struct gpio_chip *gc, unsigned int offset)
> +{
> + struct gpio_lmux *glm = (struct gpio_lmux *)gpiochip_get_data(gc);
useless cast
Best Regards,
Thomas
next prev parent reply other threads:[~2025-11-05 8:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 21:00 [PATCH v3 0/2] add gpio-line-mux Jonas Jelonek
2025-11-04 21:00 ` [PATCH v3 1/2] dt-bindings: gpio: add gpio-line-mux controller Jonas Jelonek
2025-11-05 8:49 ` Krzysztof Kozlowski
2025-11-04 21:00 ` [PATCH v3 2/2] gpio: add gpio-line-mux driver Jonas Jelonek
2025-11-05 8:51 ` Thomas Richard [this message]
2025-11-05 9:31 ` Peter Rosin
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=087643b4-7a29-4424-a3b0-b60bbc7c3140@bootlin.com \
--to=thomas.richard@bootlin.com \
--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 \
/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
all inboxes | Powered by JetHome®