mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/4] gpio: shared-proxy: Fix line accounting
@ 2026-10-17  4:36 Shawn Guo
  2026-10-17  4:36 ` [PATCH v4 1/4] gpio: shared-proxy: Fix race between concurrent first users Shawn Guo
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Shawn Guo @ 2026-10-17  4:36 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: linux-gpio, linux-arm-msm, linux-kernel, Shawn Guo

Four fixes for how the shared GPIO proxy accounts for 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.

Patch 3 fixes gpiod_set_value() to the default value doing nothing on
a line that was requested with GPIOD_ASIS and left at the opposite
value, e.g. by the bootloader.

Patch 4 drops a proxy's vote when it switches the line to input, so
releasing the line no longer fails trying to write the default value
to an input

Changes in v4:
- Patch 4: New. Clear the vote when reinitializing the line as input.
  It predates patch 1 (Sashiko)
- Link to v3: https://lore.kernel.org/all/20261017024335.1432020-1-shengchao.guo@oss.qualcomm.com/

Changes in v3:
- Patch 3: New. Drive the default value to the hardware when no votes
  are outstanding. It predates patch 1 (Sashiko)
- Link to v2: https://lore.kernel.org/all/20261016144919.1362846-1-shengchao.guo@oss.qualcomm.com/

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 (4):
  gpio: shared-proxy: Fix race between concurrent first users
  gpio: shared-proxy: Drop the vote of a released proxy on write failure
  gpio: shared-proxy: Drive the default value when no votes are cast
  gpio: shared-proxy: Drop the vote when switching to input

 drivers/gpio/gpio-shared-proxy.c | 94 ++++++++++++++++++++++++++++----
 drivers/gpio/gpiolib-shared.h    |  1 +
 2 files changed, 83 insertions(+), 12 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-10-28  9:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-17  4:36 [PATCH v4 0/4] gpio: shared-proxy: Fix line accounting Shawn Guo
2026-10-17  4:36 ` [PATCH v4 1/4] gpio: shared-proxy: Fix race between concurrent first users Shawn Guo
2026-10-20 10:06   ` Bartosz Golaszewski
2026-10-28  6:57     ` Shawn Guo
2026-10-17  4:36 ` [PATCH v4 2/4] gpio: shared-proxy: Drop the vote of a released proxy on write failure Shawn Guo
2026-10-17  4:36 ` [PATCH v4 3/4] gpio: shared-proxy: Drive the default value when no votes are cast Shawn Guo
2026-10-20 13:17   ` Bartosz Golaszewski
2026-10-28  7:01     ` Shawn Guo
2026-10-28  9:22       ` Bartosz Golaszewski
2026-10-17  4:36 ` [PATCH v4 4/4] gpio: shared-proxy: Drop the vote when switching to input Shawn Guo
2026-10-20 13:18 ` [PATCH v4 0/4] gpio: shared-proxy: Fix line accounting Bartosz Golaszewski

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®