Re: [PATCH v11 6/9] gpio: pl061: use cleanup helpers for locks

From: Andy Shevchenko

Date: Wed Oct 21 2026 - 12:36:04 EST


On Tue, Oct 20, 2026 at 03:54:10PM +0800, Long Zhao via B4 Relay wrote:

> Convert raw_spinlock critical sections to guard()() from cleanup.h.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

...

> @@ -267,9 +262,8 @@ static void pl061_irq_mask(struct irq_data *d)
> struct pl061 *pl061 = gpiochip_get_data(gc);
> u8 mask = BIT(irqd_to_hwirq(d) % PL061_GPIO_NR);
>
> - raw_spin_lock(&pl061->lock);
> - regmap_clear_bits(pl061->regmap, GPIOIE, mask);
> - raw_spin_unlock(&pl061->lock);
> + scoped_guard(raw_spinlock, &pl061->lock)
> + regmap_clear_bits(pl061->regmap, GPIOIE, mask);
>
> gpiochip_disable_irq(gc, d->hwirq);
> }
> @@ -282,9 +276,8 @@ static void pl061_irq_unmask(struct irq_data *d)
>
> gpiochip_enable_irq(gc, d->hwirq);
>
> - raw_spin_lock(&pl061->lock);
> - regmap_set_bits(pl061->regmap, GPIOIE, mask);
> - raw_spin_unlock(&pl061->lock);
> + scoped_guard(raw_spinlock, &pl061->lock)
> + regmap_set_bits(pl061->regmap, GPIOIE, mask);

Strictly speaking guard()() will work, but for the sake of consistency with
_mask this is fine.

> }

--
With Best Regards,
Andy Shevchenko