Skip to content

Commit 2ef2e13

Browse files
committed
genirq/chip: Rework handle_nested_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.744042890@linutronix.de
1 parent a6d8d0d commit 2ef2e13

1 file changed

Lines changed: 36 additions & 42 deletions

File tree

kernel/irq/chip.c

Lines changed: 36 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -450,48 +450,6 @@ void unmask_threaded_irq(struct irq_desc *desc)
450450
unmask_irq(desc);
451451
}
452452

453-
/*
454-
* handle_nested_irq - Handle a nested irq from a irq thread
455-
* @irq: the interrupt number
456-
*
457-
* Handle interrupts which are nested into a threaded interrupt
458-
* handler. The handler function is called inside the calling
459-
* threads context.
460-
*/
461-
void handle_nested_irq(unsigned int irq)
462-
{
463-
struct irq_desc *desc = irq_to_desc(irq);
464-
struct irqaction *action;
465-
irqreturn_t action_ret;
466-
467-
might_sleep();
468-
469-
raw_spin_lock_irq(&desc->lock);
470-
471-
desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
472-
473-
action = desc->action;
474-
if (unlikely(!action || irqd_irq_disabled(&desc->irq_data))) {
475-
desc->istate |= IRQS_PENDING;
476-
raw_spin_unlock_irq(&desc->lock);
477-
return;
478-
}
479-
480-
kstat_incr_irqs_this_cpu(desc);
481-
atomic_inc(&desc->threads_active);
482-
raw_spin_unlock_irq(&desc->lock);
483-
484-
action_ret = IRQ_NONE;
485-
for_each_action_of_desc(desc, action)
486-
action_ret |= action->thread_fn(action->irq, action->dev_id);
487-
488-
if (!irq_settings_no_debug(desc))
489-
note_interrupt(desc, action_ret);
490-
491-
wake_threads_waitq(desc);
492-
}
493-
EXPORT_SYMBOL_GPL(handle_nested_irq);
494-
495453
static bool irq_check_poll(struct irq_desc *desc)
496454
{
497455
if (!(desc->istate & IRQS_POLL_INPROGRESS))
@@ -543,6 +501,42 @@ static inline bool irq_can_handle(struct irq_desc *desc)
543501
return irq_can_handle_actions(desc);
544502
}
545503

504+
/**
505+
* handle_nested_irq - Handle a nested irq from a irq thread
506+
* @irq: the interrupt number
507+
*
508+
* Handle interrupts which are nested into a threaded interrupt
509+
* handler. The handler function is called inside the calling threads
510+
* context.
511+
*/
512+
void handle_nested_irq(unsigned int irq)
513+
{
514+
struct irq_desc *desc = irq_to_desc(irq);
515+
struct irqaction *action;
516+
irqreturn_t action_ret;
517+
518+
might_sleep();
519+
520+
scoped_guard(raw_spinlock_irq, &desc->lock) {
521+
if (irq_can_handle_actions(desc))
522+
return;
523+
524+
action = desc->action;
525+
kstat_incr_irqs_this_cpu(desc);
526+
atomic_inc(&desc->threads_active);
527+
}
528+
529+
action_ret = IRQ_NONE;
530+
for_each_action_of_desc(desc, action)
531+
action_ret |= action->thread_fn(action->irq, action->dev_id);
532+
533+
if (!irq_settings_no_debug(desc))
534+
note_interrupt(desc, action_ret);
535+
536+
wake_threads_waitq(desc);
537+
}
538+
EXPORT_SYMBOL_GPL(handle_nested_irq);
539+
546540
/**
547541
* handle_simple_irq - Simple and software-decoded IRQs.
548542
* @desc: the interrupt description structure for this irq

0 commit comments

Comments
 (0)