[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdYjfvSywb2=ppopk5W57jCbe8fj-HK4HJFS_cMLopJ9YA@mail.gmail.com>
Date: Tue, 4 Mar 2025 08:57:42 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Matti Vaittinen <mazziesaccount@...il.com>
Cc: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>, Bartosz Golaszewski <brgl@...ev.pl>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Biju Das <biju.das.jz@...renesas.com>, Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: Re: [PATCH v2 4/4] gpio: Hide valid_mask from direct assignments
On Fri, Feb 28, 2025 at 1:36 PM Matti Vaittinen
<mazziesaccount@...il.com> wrote:
> The valid_mask member of the struct gpio_chip is unconditionally written
> by the GPIO core at driver registration. Current documentation does not
> mention this but just says the valid_mask is used if it's not NULL. This
> lured me to try populating it directly in the GPIO driver probe instead
> of using the init_valid_mask() callback. It took some retries with
> different bitmaps and eventually a bit of code-reading to understand why
> the valid_mask was not obeyed. I could've avoided this trial and error if
> the valid_mask was hidden in the struct gpio_device instead of being a
> visible member of the struct gpio_chip.
>
> Help the next developer who decides to directly populate the valid_mask
> in struct gpio_chip by hiding the valid_mask in struct gpio_device and
> keep it internal to the GPIO core.
>
> Suggested-by: Linus Walleij <linus.walleij@...aro.org>
> Signed-off-by: Matti Vaittinen <mazziesaccount@...il.com>
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
Yours,
Linus Walleij
Powered by blists - more mailing lists