[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdasQZ26cEv7CCSu75MJH=Pn8a45XQvZmNt4MB=hzTSa6A@mail.gmail.com>
Date: Fri, 28 Feb 2025 09:06:48 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Matti Vaittinen <mazziesaccount@...il.com>, Geert Uytterhoeven <geert+renesas@...der.be>
Cc: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>, Bartosz Golaszewski <brgl@...ev.pl>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] gpio: Document the 'valid_mask' being internal
On Wed, Feb 26, 2025 at 12:42 PM Matti Vaittinen
<mazziesaccount@...il.com> 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
Powered by blists - more mailing lists