[PATCH v2 0/6] gpiolib: unify gpio-hog code

From: Bartosz Golaszewski

Date: Mon Mar 09 2026 - 08:43:45 EST


GPIO hogs are handled separately in three places: for OF, ACPI and
machine lookup. In addition hogs cannot be set up using software nodes.
A lot of that code is actually redundant and - except for some special
handling of OF nodes - can be unified in one place.

This series moves hogging into GPIO core and bases it on fwnode API
(with a single helper from OF to translate devicetree properties into
lookup flags), converts the two remaining users of machine hogs to using
software node approach and removes machine hog support entirely. In
addition, there's a patch extending the configurability of gpio-sim now
that it uses software nodes for hogs.

For merging: I think this should go through the GPIO tree with an Ack
from OMAP1 maintainers.

Even with the new feature for gpio-sim, this series still removes twice
the number of lines, it adds.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
---
Changes in v2:
- reduce the leakage of OF APIs into GPIO core by replacing
of_phandle_args with fwnode_reference_args
- fix return value check in patch 2/6
- shrink code in patch 2/6
- don't allow #gpio-cells to be 0
- extend commit message of patch 6/6 to explain the need for this new
feature
- Link to v1: https://patch.msgid.link/20260305-gpio-hog-fwnode-v1-0-97d7df6bbd17@xxxxxxxxxxxxxxxx

---
Bartosz Golaszewski (6):
gpio: of: clear OF_POPULATED on hog nodes in remove path
gpio: move hogs into GPIO core
gpio: sim: use fwnode-based GPIO hogs
ARM: omap1: ams-delta: convert GPIO hogs to using firmware nodes
gpio: remove machine hogs
gpio: sim: allow to define the active-low setting of a simulated hog

Documentation/driver-api/gpio/board.rst | 16 ---
arch/arm/mach-omap1/board-ams-delta.c | 32 ++++-
drivers/gpio/gpio-sim.c | 200 +++++++++++++++-----------------
drivers/gpio/gpiolib-acpi-core.c | 70 -----------
drivers/gpio/gpiolib-of.c | 152 ++++--------------------
drivers/gpio/gpiolib-of.h | 10 ++
drivers/gpio/gpiolib.c | 137 +++++++++++++---------
drivers/gpio/gpiolib.h | 3 +
include/linux/gpio/machine.h | 33 ------
9 files changed, 238 insertions(+), 415 deletions(-)
---
base-commit: a0ae2a256046c0c5d3778d1a194ff2e171f16e5f
change-id: 20260224-gpio-hog-fwnode-b46a53196253

Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>