Re: [PATCH 3/4] gpio: tqmx86: introduce tqmx86_gpio_clrsetbits() helper

From: Linus Walleij
Date: Fri Dec 20 2024 - 08:43:54 EST


On Tue, Dec 17, 2024 at 4:11 PM Matthias Schiffer
<matthias.schiffer@xxxxxxxxxxxxxxx> wrote:

> - I introduced a tqmx86_gpio_read() wrapper around regmap_read() to avoid
> dealing with the indirect value argument all the time for an operation that
> can't actually fail
> - I also kept the tqmx86_gpio_write() for symmetry (just wrapping regmap_write)

I don't see why we can't add
unsigned in regmap_read_cantfail()
that always just return the value if this is a common problem for people using
regmap MMIO specifically? Could perhaps be restricted to mmio.

Maybe Mark has objections.

> - I introduced a tqmx86_gpio_clrsetbits() wrapper around regmap_update_bits()
> (having arguments for set and clear was more convenient than mask and value
> in a few places)

Isn't that what regmap fields are for?
regmap_field_set_bits()
regmap_field_clear_bits()
...
but I can see why that would feel overdesigned, it's not like I don't get
the point.

> - I was still handling locking outside of regmap because we sometimes want to
> protect a whole sequence of accesses or other driver state

So reg_sequence cannot be used in this case? (Other driver state seems
to imply that.)

> - The TQMx86 GPIO controller has a write-only and a read-only register at the
> same address, which I understand not to be supported well by regmap (at least
> if you also want to use a regcache)

Hehe yeah that is a first! I never saw that before.

Thanks for considering anyway, I can live without regmap.

Yours,
Linus Walleij