Commit 09a82a9e authored by Russell King's avatar Russell King

[ARM] Add synchronize_irq() support.

parent 5a1b817d
...@@ -85,6 +85,23 @@ static struct irqdesc bad_irq_desc = { ...@@ -85,6 +85,23 @@ static struct irqdesc bad_irq_desc = {
.disable_depth = 1, .disable_depth = 1,
}; };
#ifdef CONFIG_SMP
void synchronize_irq(unsigned int irq)
{
struct irqdesc *desc = irq_desc + irq;
while (desc->running)
barrier();
}
EXPORT_SYMBOL(synchronize_irq);
#define smp_set_running(desc) do { desc->running = 1; } while (0)
#define smp_clear_running(desc) do { desc->running = 0; } while (0)
#else
#define smp_set_running(desc) do { } while (0)
#define smp_clear_running(desc) do { } while (0)
#endif
/** /**
* disable_irq_nosync - disable an irq without waiting * disable_irq_nosync - disable an irq without waiting
* @irq: Interrupt to disable * @irq: Interrupt to disable
...@@ -338,12 +355,16 @@ do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) ...@@ -338,12 +355,16 @@ do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
kstat_cpu(cpu).irqs[irq]++; kstat_cpu(cpu).irqs[irq]++;
smp_set_running(desc);
action = desc->action; action = desc->action;
if (action) { if (action) {
int ret = __do_irq(irq, action, regs); int ret = __do_irq(irq, action, regs);
if (ret != IRQ_HANDLED) if (ret != IRQ_HANDLED)
report_bad_irq(irq, regs, desc, ret); report_bad_irq(irq, regs, desc, ret);
} }
smp_clear_running(desc);
} }
/* /*
...@@ -429,6 +450,8 @@ do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) ...@@ -429,6 +450,8 @@ do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
if (likely(!desc->disable_depth)) { if (likely(!desc->disable_depth)) {
kstat_cpu(cpu).irqs[irq]++; kstat_cpu(cpu).irqs[irq]++;
smp_set_running(desc);
/* /*
* Return with this interrupt masked if no action * Return with this interrupt masked if no action
*/ */
...@@ -443,6 +466,8 @@ do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs) ...@@ -443,6 +466,8 @@ do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
!check_irq_lock(desc, irq, regs))) !check_irq_lock(desc, irq, regs)))
desc->chip->unmask(irq); desc->chip->unmask(irq);
} }
smp_clear_running(desc);
} }
} }
......
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