Re: [PATCH] gpio: Document the 'valid_mask' being internal
From: Linus Walleij
Date: Fri Feb 28 2025 - 03:08:23 EST
On Wed, Feb 26, 2025 at 12:42 PM Matti Vaittinen
<mazziesaccount@xxxxxxxxx> wrote:
> On 26/02/2025 12:18, Linus Walleij wrote:
> > That's easy to check with some git grep valid_mask
>
> True. I just tried. It seems mostly Ok, but...
> For example the drivers/gpio/gpio-rcar.c uses the contents of the
> 'valid_mask' in it's set_multiple callback to disallow setting the value
> of masked GPIOs.
>
> For uneducated person like me, it feels this check should be done and
> enforced by the gpiolib and not left for untrustworthy driver writers
> like me! (I am working on BD79124 driver and it didn't occur to me I
> should check for the valid_mask in driver :) If gpiolib may call the
> driver's set_multiple() with masked lines - then the bd79124 driver just
> had one unknown bug less :rolleyes:) )
Yeah that should be done in gpiolib.
And I think it is, gpiolib will not allow you to request a line
that is not valid AFAIK.
This check in rcar is just overzealous and can probably be
removed. Geert what do you say?
Yours,
Linus Walleij