Btrfs: fix balancing oops when invalidate_inode_pages2 returns EBUSY
[linux-2.6/mini2440.git] / kernel / irq / migration.c
blobe05ad9be43b7a5fa7e6d6a24f94e49828a73572a
2 #include <linux/irq.h>
4 void move_masked_irq(int irq)
6 struct irq_desc *desc = irq_to_desc(irq);
8 if (likely(!(desc->status & IRQ_MOVE_PENDING)))
9 return;
12 * Paranoia: cpu-local interrupts shouldn't be calling in here anyway.
14 if (CHECK_IRQ_PER_CPU(desc->status)) {
15 WARN_ON(1);
16 return;
19 desc->status &= ~IRQ_MOVE_PENDING;
21 if (unlikely(cpumask_empty(desc->pending_mask)))
22 return;
24 if (!desc->chip->set_affinity)
25 return;
27 assert_spin_locked(&desc->lock);
30 * If there was a valid mask to work with, please
31 * do the disable, re-program, enable sequence.
32 * This is *not* particularly important for level triggered
33 * but in a edge trigger case, we might be setting rte
34 * when an active trigger is comming in. This could
35 * cause some ioapics to mal-function.
36 * Being paranoid i guess!
38 * For correct operation this depends on the caller
39 * masking the irqs.
41 if (likely(cpumask_any_and(desc->pending_mask, cpu_online_mask)
42 < nr_cpu_ids)) {
43 cpumask_and(desc->affinity,
44 desc->pending_mask, cpu_online_mask);
45 desc->chip->set_affinity(irq, desc->affinity);
47 cpumask_clear(desc->pending_mask);
50 void move_native_irq(int irq)
52 struct irq_desc *desc = irq_to_desc(irq);
54 if (likely(!(desc->status & IRQ_MOVE_PENDING)))
55 return;
57 if (unlikely(desc->status & IRQ_DISABLED))
58 return;
60 desc->chip->mask(irq);
61 move_masked_irq(irq);
62 desc->chip->unmask(irq);