linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] gpio: shared-proxy: Fix line accounting
@ 2026-10-16 14:49 Shawn Guo
  2026-10-16 14:49 ` [PATCH v2 1/2] gpio: shared-proxy: Fix race between concurrent first users Shawn Guo
  2026-10-16 14:49 ` [PATCH v2 2/2] gpio: shared-proxy: Drop the vote of a released proxy on write failure Shawn Guo
  0 siblings, 2 replies; 5+ messages in thread
From: Shawn Guo @ 2026-10-16 14:49 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: linux-gpio, linux-arm-msm, linux-kernel, Shawn Guo

Two fixes for the shared GPIO proxy's accounting of users and votes.

Patch 1 fixes a race between consumers that request a shared line
concurrently. Each of them sees usecnt > 1, assumes another user has
already configured the line, and fails with -EPERM. On Nord RRD this
intermittently leaves both DAC supply regulators without their enable
GPIO.

Patch 2 fixes a stale vote left behind when a proxy releases the line
and restoring the default value fails. The line stays at the
non-default value for the remaining users, and votecnt can underflow
when the line is requested again.

Changes in v2:
- Patch 1: Also use gpio_shared_proxy_may_init() instead of
  usecnt > 1 in set_config, so concurrent first users no longer skip
  the hardware config or log a spurious conflict (Sashiko)
- Patch 2: New. Fix the votecnt underflow on a failed write in free.
  It predates patch 1 (Sashiko)
- Link to v1: https://lore.kernel.org/all/20261015122740.971792-1-shengchao.guo@oss.qualcomm.com

Shawn Guo (2):
  gpio: shared-proxy: Fix race between concurrent first users
  gpio: shared-proxy: Drop the vote of a released proxy on write failure

 drivers/gpio/gpio-shared-proxy.c | 80 ++++++++++++++++++++++++++++----
 drivers/gpio/gpiolib-shared.h    |  1 +
 2 files changed, 71 insertions(+), 10 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-17  2:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-16 14:49 [PATCH v2 0/2] gpio: shared-proxy: Fix line accounting Shawn Guo
2026-10-16 14:49 ` [PATCH v2 1/2] gpio: shared-proxy: Fix race between concurrent first users Shawn Guo
2026-10-16 14:58   ` sashiko-bot
2026-10-17  2:25     ` Shawn Guo
2026-10-16 14:49 ` [PATCH v2 2/2] gpio: shared-proxy: Drop the vote of a released proxy on write failure Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).