Re: [PATCH] gpio: shared: undo the vote of the proxy on GPIO free

From: Linus Walleij

Date: Mon May 25 2026 - 04:53:52 EST


On Wed, May 20, 2026 at 2:48 PM Bartosz Golaszewski
<bartosz.golaszewski@xxxxxxxxxxxxxxxx> wrote:

> When the user of a shared GPIO managed by gpio-shared-proxy calls
> gpiod_put() to release it, we never undo the potential "vote" for
> driving the shared line "high". In the free() callback, check if this
> proxy voted for "high" and - if so - decrease the number of votes.
>
> Note that we don't set the value back to "low" when the last user
> releases the line in line with most GPIO drivers that leave the value
> "as-is" in GPIO free() path.
>
> Fixes: e992d54c6f97 ("gpio: shared-proxy: implement the shared GPIO proxy driver")
> Closes: https://sashiko.dev/#/patchset/20260513-gpio-shared-dynamic-voting-v1-1-8e1c49961b7d%40oss.qualcomm.com
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>

Really nice find by Sashiko.
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>

Yours,
Linus Walleij