[PATCH 11/25] irqchip/armada-370-xp: Simplify ipi_resume() code
Andrew Lunn
andrew at lunn.ch
Mon Jul 1 15:25:34 PDT 2024
On Mon, Jul 01, 2024 at 07:02:35PM +0200, Marek Behún wrote:
> Refactor the ipi_resume() function to drop one indentation level.
>
> Signed-off-by: Marek Behún <kabel at kernel.org>
> ---
> drivers/irqchip/irq-armada-370-xp.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
> index 22e1a493abae..d8b0609a9160 100644
> --- a/drivers/irqchip/irq-armada-370-xp.c
> +++ b/drivers/irqchip/irq-armada-370-xp.c
> @@ -462,16 +462,13 @@ static const struct irq_domain_ops ipi_domain_ops = {
> static void ipi_resume(void)
> {
> for (int i = 0; i < IPI_DOORBELL_END; i++) {
> - int irq;
> + unsigned int virq = irq_find_mapping(ipi_domain, i);
>
> - irq = irq_find_mapping(ipi_domain, i);
> - if (irq <= 0)
> + if (!virq || !irq_percpu_is_enabled(virq))
> continue;
> - if (irq_percpu_is_enabled(irq)) {
> - struct irq_data *d;
> - d = irq_domain_get_irq_data(ipi_domain, irq);
> - armada_370_xp_ipi_unmask(d);
> - }
> +
> + armada_370_xp_ipi_unmask(irq_domain_get_irq_data(ipi_domain,
> + virq));
This one took a while to review. Which suggests the commit message
could be better.
irq is renamed to virq. int becomes unsigned int. That then helps
explain that irq_find_mapping() does not return a negative error code,
just 0 when there is no mapping. Hence <= can become !.
I also think
> - struct irq_data *d;
> - d = irq_domain_get_irq_data(ipi_domain, irq);
> - armada_370_xp_ipi_unmask(d);
is more readable than
> + armada_370_xp_ipi_unmask(irq_domain_get_irq_data(ipi_domain,
> + virq));
because it avoids the wrapping.
Andrew
More information about the linux-arm-kernel
mailing list