[PATCH v3 1/2] gpio: brcmstb: implement irq_mask_ack

Andy Shevchenko andy.shevchenko at gmail.com
Tue Feb 3 07:28:57 PST 2026


On Thu, Jan 29, 2026 at 10:13 PM Florian Fainelli
<florian.fainelli at broadcom.com> wrote:
>
> From: Doug Berger <opendmb at gmail.com>
>
> The irq_mask_ack operation is slightly more efficient than doing

.irq_mask_ack()

> irq_mask and irq_ack separately.

.irq_mask()
.irq_ack()

> More importantly for this driver it bypasses the check of
> irqd_irq_masked ensuring a previously masked but still active
> interrupt gets remasked if unmasked at the hardware level. This
> allows the driver to more efficiently unmask the wake capable
> interrupts when quiescing without needing to enable the irqs
> individually to clear the irqd_irq_masked state.

...

> +static void brcmstb_gpio_irq_mask_ack(struct irq_data *d)
> +{
> +       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
> +       struct brcmstb_gpio_bank *bank = gpiochip_get_data(gc);
> +       struct brcmstb_gpio_priv *priv = bank->parent_priv;

> +       u32 mask = BIT(brcmstb_gpio_hwirq_to_offset(d->hwirq, bank));

Use API to get HW IRQ from irq_data. This is documented in the GPIO
documentation.

> +
> +       guard(gpio_generic_lock_irqsave)(&bank->chip);
> +       __brcmstb_gpio_set_imask(bank, d->hwirq, false);
> +       gpio_generic_write_reg(&bank->chip,
> +                              priv->reg_base + GIO_STAT(bank->id), mask);
> +}


-- 
With Best Regards,
Andy Shevchenko



More information about the linux-arm-kernel mailing list