[GIT PULL] configfs-based GPIO simulator for v5.16

From: Bartosz Golaszewski
Date: Thu Nov 04 2021 - 15:01:35 EST


Linus,

A while ago I sent you a pull-request for the GPIO subsystem which, in addition
to regular GPIO updates, contained a new GPIO simulator module based on
configfs that we want to use to test the uAPI and its main user-space user -
libgpiod. The PR included changes to configfs itself in the form of an
implementation of the concept of committable items. The changes had been in
development for several months and the maintainers had been largely
unresponsive which made me send it directly to you eventually after gathering
some reviews on the linux-gpio mailing list. You then Cc'ed Al who raised some
concerns and the patches were pulled out.

A couple months have passed with a few more iterations and I still can't get
any meaningful reviews from the configfs maintainers (nor NAKs for that
matter). I decided to give it another try and send it to you directly again.

Since last time I've addressed issues raised by Al (to the best of my ability
anyway) and made sure all references are counted correctly (including error
paths) and all resources freed. This code has been tested a lot with
a development version of libgpiod. The branch I've tagged spent some time in
next too with a single issue reported and fixed.

Please consider pulling.

Best Regards,
Bartosz Golaszewski

The following changes since commit 519d81956ee277b4419c723adfb154603c2565ba:

Linux 5.15-rc6 (2021-10-17 20:00:13 -1000)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git tags/gpio-sim-for-v5.16

for you to fetch changes up to 5065e08e4ef3c3fd0daf141f601de4b4d1af2333:

gpio: sim: fix missing unlock on error in gpio_sim_config_commit_item() (2021-10-30 17:10:47 +0200)

----------------------------------------------------------------
gpio simulator + configfs changes for v5.16

- implement committable items in configfs
- add sample code
- implement the GPIO simulator based on configfs committable items
- add tests

----------------------------------------------------------------
Bartosz Golaszewski (8):
configfs: increase the item name length
configfs: use (1UL << bit) for internal flags
configfs: implement committable items
samples: configfs: add a committable group
gpio: sim: new testing module
selftests: gpio: provide a helper for reading chip info
selftests: gpio: add a helper for reading GPIO line names
selftests: gpio: add test cases for gpio-sim

Wei Yongjun (1):
gpio: sim: fix missing unlock on error in gpio_sim_config_commit_item()

Documentation/admin-guide/gpio/gpio-sim.rst | 72 +++
Documentation/filesystems/configfs.rst | 6 +-
drivers/gpio/Kconfig | 8 +
drivers/gpio/Makefile | 1 +
drivers/gpio/gpio-sim.c | 884 ++++++++++++++++++++++++++
fs/configfs/configfs_internal.h | 22 +-
fs/configfs/dir.c | 276 +++++++-
include/linux/configfs.h | 3 +-
samples/configfs/configfs_sample.c | 153 +++++
tools/testing/selftests/gpio/.gitignore | 2 +
tools/testing/selftests/gpio/Makefile | 4 +-
tools/testing/selftests/gpio/config | 1 +
tools/testing/selftests/gpio/gpio-chip-info.c | 57 ++
tools/testing/selftests/gpio/gpio-line-name.c | 55 ++
tools/testing/selftests/gpio/gpio-sim.sh | 229 +++++++
15 files changed, 1750 insertions(+), 23 deletions(-)
create mode 100644 Documentation/admin-guide/gpio/gpio-sim.rst
create mode 100644 drivers/gpio/gpio-sim.c
create mode 100644 tools/testing/selftests/gpio/gpio-chip-info.c
create mode 100644 tools/testing/selftests/gpio/gpio-line-name.c
create mode 100755 tools/testing/selftests/gpio/gpio-sim.sh