Re: [PATCH v2 1/4] gpio: Respect valid_mask when requesting GPIOs

From: Linus Walleij
Date: Tue Mar 04 2025 - 02:56:06 EST


On Fri, Feb 28, 2025 at 1:35 PM Matti Vaittinen
<mazziesaccount@xxxxxxxxx> wrote:

> When GPIOs were requested the validity of GPIOs were checked only when
> the GPIO-chip had the request -callback populated. This made using
> masked GPIOs possible.
>
> The GPIO chip driver authors may find it difficult to understand the
> relation of enforsing the GPIO validity and the 'request' -callback
> because the current documentation for the 'request' callback does not
> mention this. It only states:
>
> * @request: optional hook for chip-specific activation, such as
> * enabling module power and clock; may sleep
>
> The validity of the GPIO line should be checked whether the driver
> provides the 'request' callback or not.
>
> Unconditionally check the GPIO validity when GPIO is being requested.
>
> Signed-off-by: Matti Vaittinen <mazziesaccount@xxxxxxxxx>

Good catch!
Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

Yours,
Linus Walleij