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

Three 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.

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 (3):
  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

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

-- 
2.43.0


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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-17  2:43 [PATCH v3 0/3] gpio: shared-proxy: Fix line accounting Shawn Guo
2026-10-17  2:43 ` [PATCH v3 1/3] gpio: shared-proxy: Fix race between concurrent first users Shawn Guo
2026-10-17  3:00   ` sashiko-bot
2026-10-17  4:07     ` Shawn Guo
2026-10-17  2:43 ` [PATCH v3 2/3] gpio: shared-proxy: Drop the vote of a released proxy on write failure Shawn Guo
2026-10-17  2:43 ` [PATCH v3 3/3] gpio: shared-proxy: Drive the default value when no votes are cast Shawn Guo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.