[PATCH 00/23] gpio: mockup: support dynamically created and removed chips

From: Bartosz Golaszewski
Date: Fri Sep 04 2020 - 11:50:33 EST


From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx>

We're about to merge w V2 user API for GPIO. In user-space we're using the
gpio-mockup driver for testing but it's quite cumbersome (needs unloading
and reloading to change chip configuration) and not very extensible (config
is passed over module params).

This series proposes to extend the debugfs interface to support dynamic
creation and removal of dummy chips, with extensible options.

First 3 patches add some lib functionality we'll use later on. Next 3 contain
general gpiolib refactoring and can be picked up independently.

Next we refactor gpio-mockup and finally add the delete_device and new_device
attributes. Last patch adds documentation for gpio-mockup so I'm not going into
detail on how the new interface works - the doc describes it pretty well.

Bartosz Golaszewski (23):
lib: cmdline: export next_arg()
lib: string_helpers: provide kfree_strarray()
lib: uaccess: provide getline_from_user()
gpiolib: generalize devprop_gpiochip_set_names() for device properties
gpiolib: unexport devprop_gpiochip_set_names()
gpiolib: switch to simpler IDA interface
gpio: mockup: drop unneeded includes
gpio: mockup: use pr_fmt()
gpio: mockup: use KBUILD_MODNAME
gpio: mockup: fix resource leak in error path
gpio: mockup: remove the limit on number of dummy chips
gpio: mockup: define a constant for chip label size
gpio: mockup: pass the chip label as device property
gpio: mockup: use the generic 'gpio-line-names' property
gpio: mockup: use dynamic device IDs
gpio: mockup: refactor the module init function
gpio: mockup: rename and move around debugfs callbacks
gpio: mockup: require debugfs to build
gpio: mockup: add a symlink for the per-chip debugfs directory
gpio: mockup: add a lock for dummy device list
gpio: mockup: provide a way to delete dummy chips
gpio: mockup: provide a way to create new dummy chips
Documentation: gpio: add documentation for gpio-mockup

.../admin-guide/gpio/gpio-mockup.rst | 87 +++
drivers/gpio/Kconfig | 1 +
drivers/gpio/Makefile | 1 -
drivers/gpio/gpio-mockup.c | 614 ++++++++++++++----
drivers/gpio/gpiolib-acpi.c | 3 -
drivers/gpio/gpiolib-devprop.c | 63 --
drivers/gpio/gpiolib-of.c | 5 -
drivers/gpio/gpiolib.c | 62 +-
include/linux/gpio/driver.h | 3 -
include/linux/string_helpers.h | 2 +
include/linux/uaccess.h | 3 +
lib/cmdline.c | 1 +
lib/string_helpers.c | 22 +
lib/usercopy.c | 37 ++
14 files changed, 705 insertions(+), 199 deletions(-)
create mode 100644 Documentation/admin-guide/gpio/gpio-mockup.rst
delete mode 100644 drivers/gpio/gpiolib-devprop.c

--
2.26.1