[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <087643b4-7a29-4424-a3b0-b60bbc7c3140@bootlin.com>
Date: Wed, 5 Nov 2025 09:51:08 +0100
From: Thomas Richard <thomas.richard@...tlin.com>
To: Jonas Jelonek <jelonek.jonas@...il.com>,
Linus Walleij <linus.walleij@...aro.org>, Bartosz Golaszewski
<brgl@...ev.pl>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Peter Rosin <peda@...ntia.se>,
Geert Uytterhoeven <geert+renesas@...der.be>
Cc: linux-gpio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] gpio: add gpio-line-mux driver
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
Powered by blists - more mailing lists