Commit c7bd3ec0 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Rafael J. Wysocki

genirq: Create helper for flow handler entry check

All flow handlers - except the per cpu ones - check for an interrupt
in progress and an eventual concurrent polling on another cpu.

Create a helper function for the repeated code pattern.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent c3d7acd0
...@@ -342,6 +342,13 @@ static bool irq_check_poll(struct irq_desc *desc) ...@@ -342,6 +342,13 @@ static bool irq_check_poll(struct irq_desc *desc)
return irq_wait_for_poll(desc); return irq_wait_for_poll(desc);
} }
static bool irq_may_run(struct irq_desc *desc)
{
if (!irqd_irq_inprogress(&desc->irq_data))
return true;
return irq_check_poll(desc);
}
/** /**
* handle_simple_irq - Simple and software-decoded IRQs. * handle_simple_irq - Simple and software-decoded IRQs.
* @irq: the interrupt number * @irq: the interrupt number
...@@ -359,8 +366,7 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc) ...@@ -359,8 +366,7 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
{ {
raw_spin_lock(&desc->lock); raw_spin_lock(&desc->lock);
if (unlikely(irqd_irq_inprogress(&desc->irq_data))) if (!irq_may_run(desc))
if (!irq_check_poll(desc))
goto out_unlock; goto out_unlock;
desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING); desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
...@@ -412,8 +418,7 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc) ...@@ -412,8 +418,7 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
raw_spin_lock(&desc->lock); raw_spin_lock(&desc->lock);
mask_ack_irq(desc); mask_ack_irq(desc);
if (unlikely(irqd_irq_inprogress(&desc->irq_data))) if (!irq_may_run(desc))
if (!irq_check_poll(desc))
goto out_unlock; goto out_unlock;
desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING); desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
...@@ -485,8 +490,7 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc) ...@@ -485,8 +490,7 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
raw_spin_lock(&desc->lock); raw_spin_lock(&desc->lock);
if (unlikely(irqd_irq_inprogress(&desc->irq_data))) if (!irq_may_run(desc))
if (!irq_check_poll(desc))
goto out; goto out;
desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING); desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
...@@ -541,17 +545,11 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc) ...@@ -541,17 +545,11 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING); desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
/* if (!irq_may_run(desc)) {
* If the handler is currently running, mark it pending,
* handle the necessary masking and go out
*/
if (unlikely(irqd_irq_inprogress(&desc->irq_data))) {
if (!irq_check_poll(desc)) {
desc->istate |= IRQS_PENDING; desc->istate |= IRQS_PENDING;
mask_ack_irq(desc); mask_ack_irq(desc);
goto out_unlock; goto out_unlock;
} }
}
/* /*
* If its disabled or no action available then mask it and get * If its disabled or no action available then mask it and get
...@@ -612,16 +610,10 @@ void handle_edge_eoi_irq(unsigned int irq, struct irq_desc *desc) ...@@ -612,16 +610,10 @@ void handle_edge_eoi_irq(unsigned int irq, struct irq_desc *desc)
desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING); desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
/* if (!irq_may_run(desc)) {
* If the handler is currently running, mark it pending,
* handle the necessary masking and go out
*/
if (unlikely(irqd_irq_inprogress(&desc->irq_data))) {
if (!irq_check_poll(desc)) {
desc->istate |= IRQS_PENDING; desc->istate |= IRQS_PENDING;
goto out_eoi; goto out_eoi;
} }
}
/* /*
* If its disabled or no action available then mask it and get * If its disabled or no action available then mask it and get
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment