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

From: Linus Walleij
Date: Tue Dec 17 2024 - 09:17:07 EST


On Mon, Dec 9, 2024 at 11:36 AM Matthias Schiffer
<matthias.schiffer@xxxxxxxxxxxxxxx> wrote:

> +static void tqmx86_gpio_clrsetbits(struct tqmx86_gpio_data *gpio,
> + u8 clr, u8 set, unsigned int reg)
> + __must_hold(&gpio->spinlock)
> +{
> + u8 val = tqmx86_gpio_read(gpio, reg);
> +
> + val &= ~clr;
> + val |= set;
> +
> + tqmx86_gpio_write(gpio, val, reg);
> +}

Maybe a question that has been asked before but why are we rolling
a set of tqmx86_* wrappers that start to look like regmap-mmio
instead of just using regmap-mmio?

tqmx86_gpio_[read|write|get|set] and now clrsetbits can all
be handled by corresponding regmap_* calls (in this case
regmap_update_bits().

Sure, this driver is using a raq spinlock but regmap-mmio supports
raw spinlocks too.

Yours,
Linus Walleij