Changes from v1: Address v1 review comments, specifically refactoring line handle flag validation out of linehandle_create in a separate patch, and refactoring the set_config itself to improve readability and minimize changes to existing code. Add the GPIOHANDLE_SET_CONFIG_IOCTL to the gpio chardev. The ioctl allows some of the configuration of a requested handle to be changed without having to release the line. The primary use case is the changing of direction for bi-directional lines. The patch series is against Bart's gpio/for-next branch[1] with v4 of my bias patch series "gpio: expose line bias flags to userspace" applied. This is necessary to support setting of the bias flags introduced there. The patch has been successfully tested against gpio-mockup using the feature/pud_set_config branch of my Go gpiod library[2], as libgpiod has not yet been updated with the uAPI change. Kent Gibson (2): gpiolib: move validation of line handle flags into helper function gpio: add new SET_CONFIG ioctl() to gpio chardev drivers/gpio/gpiolib.c | 162 ++++++++++++++++++++++++++++---------- include/uapi/linux/gpio.h | 18 +++++ 2 files changed, 138 insertions(+), 42 deletions(-) -- 2.23.0 [1] git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git [2] https://github.com/warthog618/gpiod.git