Skip to content

Commit 15d772e

Browse files
committed
genirq/chip: Rework handle_eoi_irq()
Use the new helpers to decide whether the interrupt should be handled and switch the descriptor locking to guard(). Fixup the kernel doc comment while at it. No functional change. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/all/20250429065420.986002418@linutronix.de
1 parent 2334c45 commit 15d772e

1 file changed

Lines changed: 18 additions & 24 deletions

File tree

kernel/irq/chip.c

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -653,20 +653,26 @@ static void cond_unmask_eoi_irq(struct irq_desc *desc, struct irq_chip *chip)
653653
}
654654
}
655655

656+
static inline void cond_eoi_irq(struct irq_chip *chip, struct irq_data *data)
657+
{
658+
if (!(chip->flags & IRQCHIP_EOI_IF_HANDLED))
659+
chip->irq_eoi(data);
660+
}
661+
656662
/**
657-
* handle_fasteoi_irq - irq handler for transparent controllers
658-
* @desc: the interrupt description structure for this irq
663+
* handle_fasteoi_irq - irq handler for transparent controllers
664+
* @desc: the interrupt description structure for this irq
659665
*
660-
* Only a single callback will be issued to the chip: an ->eoi()
661-
* call when the interrupt has been serviced. This enables support
662-
* for modern forms of interrupt handlers, which handle the flow
663-
* details in hardware, transparently.
666+
* Only a single callback will be issued to the chip: an ->eoi() call when
667+
* the interrupt has been serviced. This enables support for modern forms
668+
* of interrupt handlers, which handle the flow details in hardware,
669+
* transparently.
664670
*/
665671
void handle_fasteoi_irq(struct irq_desc *desc)
666672
{
667673
struct irq_chip *chip = desc->irq_data.chip;
668674

669-
raw_spin_lock(&desc->lock);
675+
guard(raw_spinlock)(&desc->lock);
670676

671677
/*
672678
* When an affinity change races with IRQ handling, the next interrupt
@@ -676,19 +682,14 @@ void handle_fasteoi_irq(struct irq_desc *desc)
676682
if (!irq_can_handle_pm(desc)) {
677683
if (irqd_needs_resend_when_in_progress(&desc->irq_data))
678684
desc->istate |= IRQS_PENDING;
679-
goto out;
685+
cond_eoi_irq(chip, &desc->irq_data);
686+
return;
680687
}
681688

682-
desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
683-
684-
/*
685-
* If its disabled or no action available
686-
* then mask it and get out of here:
687-
*/
688-
if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) {
689-
desc->istate |= IRQS_PENDING;
689+
if (!irq_can_handle_actions(desc)) {
690690
mask_irq(desc);
691-
goto out;
691+
cond_eoi_irq(chip, &desc->irq_data);
692+
return;
692693
}
693694

694695
kstat_incr_irqs_this_cpu(desc);
@@ -704,13 +705,6 @@ void handle_fasteoi_irq(struct irq_desc *desc)
704705
*/
705706
if (unlikely(desc->istate & IRQS_PENDING))
706707
check_irq_resend(desc, false);
707-
708-
raw_spin_unlock(&desc->lock);
709-
return;
710-
out:
711-
if (!(chip->flags & IRQCHIP_EOI_IF_HANDLED))
712-
chip->irq_eoi(&desc->irq_data);
713-
raw_spin_unlock(&desc->lock);
714708
}
715709
EXPORT_SYMBOL_GPL(handle_fasteoi_irq);
716710

0 commit comments

Comments
 (0)