[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdaccTSqpKQeUc1c6UEMo+fZmB+w0BQJL--gubrLMmKSgw@mail.gmail.com>
Date: Tue, 2 Oct 2018 09:38:05 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
Cc: timur@...nel.org, jhugo@...eaurora.org,
Stephen Boyd <swboyd@...omium.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>
Subject: Re: [PATCH v2] gpiolib: Show correct direction from the beginning
On Tue, Oct 2, 2018 at 9:15 AM Ricardo Ribalda Delgado
<ricardo.ribalda@...il.com> wrote:
> On Mon, Oct 1, 2018 at 11:20 PM Linus Walleij <linus.walleij@...aro.org> wrote:
> > gpiochip_add_data() doesn't allocate anything, it
> > just adds a already allocated (or static!) gpio_chip
> > to the gpiolib subsystem.
>
> Take a look to gpiochip_add_data_with_key()
> ->gpiochip_init_valid_mask()
> -> gpiochip->valid_mask = gpiochip_allocate_mask(gpiochip);
Aha I see...
> > In fact I think it is wrong to set up the mask after
> > calling gpiolob_add_data(), because of exactly the
> > type of problem you're seeing.
>
> I agree, and I believe that the cleaner way would be to add a function
> pointer that replaces:
>
> gpiochip_allocate_mask()
> bitmap_fill(p, chip->ngpio);
>
> with a proper initalization from the driver
OK
> But as today the only driver that seems to be using valid_mask is msm,
> so perhaps a hack is something better and then when we have a second
> driver that requires it we figure out the real requirements. But it is
> definately your decision ;)
I would just add some exported function to gpiolib to do what you
need so you can set up the valid_mask before calling
gpiochip_add*.
Yours,
Linus Walleij
Powered by blists - more mailing lists