Re: [PATCH] gpio: Document the 'valid_mask' being internal
From: Linus Walleij
Date: Wed Feb 26 2025 - 05:19:21 EST
On Wed, Feb 26, 2025 at 7:09 AM Matti Vaittinen
<mazziesaccount@xxxxxxxxx> wrote:
> On 25/02/2025 23:36, Linus Walleij wrote:
> > we can maybe move it to struct gpio_device in
> > drivers/gpio/gpiolib.h?
> >
> > This struct exist for every gpio_chip but is entirely gpiolib-internal.
> >
> > Then it becomes impossible to do it wrong...
>
> True. I can try seeing what it'd require to do that. But ... If there
> are any drivers out there altering the valid_mask _after_ registering
> the driver to the gpio-core ... Then it may be a can of worms and I may
> just keep the lid closed :)
That's easy to check with some git grep valid_mask
and intuition. I think all calls actually changing the valid_mask
are in the init_valid_mask() callback as they should be.
> Furthermore, I was not 100% sure the valid_mask was not intended to be
> used directly by the drivers. I hoped you and Bart have an opinion on that.
Oh it was. First we just had .valid_mask and then it was
manipulated directly.
Then we introduced init_valid_mask() and all users switched over
to using that.
So evolution, not intelligent design...
Yours,
Linus Walleij