Re: [PATCH] Revert "gpiolib: Split GPIO flags parsing and GPIO configuration"
From: Johan Hovold
Date: Tue Jul 05 2016 - 05:12:21 EST
On Tue, Jul 05, 2016 at 08:54:36AM +0200, Linus Walleij wrote:
> On Mon, Jul 4, 2016 at 10:33 PM, Laurent Pinchart
> <laurent.pinchart@xxxxxxxxxxxxxxxx> wrote:
>
> > As we're not dealing with a v4.7 regression that would need to be applied this
> > week, can't you propose a proper fix instead of a revert ?
>
> AFAICT the proper fix is to simply move the gpiod_request() sites earlier,
> I can propose something if that's all right?
How would that work?
You still need to claim the pin before touching the descriptor flags,
and that isn't done until gpiod_request(). Furthermore, it's that very
function that calls the gpio driver request() callback, which in turn
was supposed to do the sanity check.
So what you need to do is to pass the desired flags down the call stack,
and make sure not to apply them before claiming the pin.
This may work without modifying the request callback prototype (which I
mentioned in my reply to Laurent), but it could still get a bit
invasive and hence not suitable for stable (and we really need this to
be fixed in 4.[456] stable).
Your call. :)
Thanks,
Johan