[PATCH v2 0/3] Add synchronous fake device creation utility for GPIO drivers

From: Koichiro Den
Date: Tue Feb 18 2025 - 11:05:08 EST


This patch series introduces a utility for some GPIO devices to reduce
code duplication. There are no functional changes.

In this series, only gpio-sim and gpio-virtuser are updated to use
dev-sync-probe, as the current gpio-aggregator does not benefit from it at
all. A follow-up patch series that introduces a configfs interface for
gpio-aggregator will convert it to use dev-sync-probe as well.

This work originated from a suggestion by Bartosz:
https://lore.kernel.org/all/CAMRc=MfcooZXBqVpbQ0ak+8LGsPDzwKSN3Zfb0eZDx1Bx4duzQ@xxxxxxxxxxxxxx/

N.B. this submission is based on the latest gpio/for-next as of writing:
f04867a5d0d3 ("gpio: loongson-64bit: Remove unneeded ngpio assignment").


v1->v2 changes:
- Renamed the files (gpio-pseudo.[ch] -> dev-sync-probe.[ch]).
- Renamed the helper functions and a struct.
- Fixed Kconfig (correcting bool to tristate, etc.).
- Fixed Copyright.
- Added some missing #include.

v1: https://lore.kernel.org/all/20250217142758.540601-1-koichiro.den@xxxxxxxxxxxxx/


Koichiro Den (3):
gpio: introduce utilities for synchronous fake device creation
gpio: sim: convert to use dev-sync-probe utilities
gpio: virtuser: convert to use dev-sync-probe utilities

drivers/gpio/Kconfig | 10 ++++
drivers/gpio/Makefile | 3 ++
drivers/gpio/dev-sync-probe.c | 96 +++++++++++++++++++++++++++++++++++
drivers/gpio/dev-sync-probe.h | 25 +++++++++
drivers/gpio/gpio-sim.c | 84 +++++-------------------------
drivers/gpio/gpio-virtuser.c | 73 ++++----------------------
6 files changed, 156 insertions(+), 135 deletions(-)
create mode 100644 drivers/gpio/dev-sync-probe.c
create mode 100644 drivers/gpio/dev-sync-probe.h

--
2.45.2