[v2,0/2] gpio: add new SET_CONFIG ioctl() to gpio chardev
mbox series

Message ID 20191031144825.32105-1-warthog618@gmail.com
Headers show
Series
  • gpio: add new SET_CONFIG ioctl() to gpio chardev
Related show

Message

Kent Gibson Oct. 31, 2019, 2:48 p.m. UTC
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(-)

Comments

Drew Fustini Nov. 2, 2019, 9:02 p.m. UTC | #1
On Thu, Oct 31, 2019 at 10:48:23PM +0800, Kent Gibson wrote:
> 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.

I'd like to apply this to test but I wanted to check should I still be applying
all the patches from "[PATCH v4 0/5] gpio: expose line bias flags to userspace"?

thanks,
drew
Kent Gibson Nov. 2, 2019, 11:14 p.m. UTC | #2
On Sat, Nov 02, 2019 at 10:02:05PM +0100, Drew Fustini wrote:
> On Thu, Oct 31, 2019 at 10:48:23PM +0800, Kent Gibson wrote:
> > 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.
> 
> I'd like to apply this to test but I wanted to check should I still be applying
> all the patches from "[PATCH v4 0/5] gpio: expose line bias flags to userspace"?
> 

Yes, this patch series is based on top of the full bias patch series,
so I would apply the whole series.  It definitely requires patch 1 and 4
from that series, as they define some of the flags it uses.

I don't have any corresponding updates for libgpiod yet - and even my
gpiod library only supports the new ioctl for testing.
I was holding off to see if the UAPI changes were ok and if Bart has 
any preference on additions to the libgpiod API, but I should look into 
that now.

Cheers,
Kent.