aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-10-11 13:03:09 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-10-26 02:01:52 -0400
commitc4318baf00ed24b7fdcc255de33a18ab37ee8606 (patch)
tree2bf80722d2e7236de917e0e577fb14233e58e513
parent2f98492c5375e906e48c78d88351f45bb11b6a8a (diff)
sh: Sanitize sparse irq
Switch over to the new allocator functions. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/kernel/cpu/irq/ipr.c6
-rw-r--r--drivers/sh/intc/core.c10
-rw-r--r--drivers/sh/intc/dynamic.c23
3 files changed, 17 insertions, 22 deletions
diff --git a/arch/sh/kernel/cpu/irq/ipr.c b/arch/sh/kernel/cpu/irq/ipr.c
index 9282d965a1b6..a4a9906e12d0 100644
--- a/arch/sh/kernel/cpu/irq/ipr.c
+++ b/arch/sh/kernel/cpu/irq/ipr.c
@@ -62,13 +62,13 @@ void register_ipr_controller(struct ipr_desc *desc)
62 62
63 for (i = 0; i < desc->nr_irqs; i++) { 63 for (i = 0; i < desc->nr_irqs; i++) {
64 struct ipr_data *p = desc->ipr_data + i; 64 struct ipr_data *p = desc->ipr_data + i;
65 struct irq_desc *irq_desc; 65 int res;
66 66
67 BUG_ON(p->ipr_idx >= desc->nr_offsets); 67 BUG_ON(p->ipr_idx >= desc->nr_offsets);
68 BUG_ON(!desc->ipr_offsets[p->ipr_idx]); 68 BUG_ON(!desc->ipr_offsets[p->ipr_idx]);
69 69
70 irq_desc = irq_to_desc_alloc_node(p->irq, numa_node_id()); 70 res = irq_alloc_desc_at(p->irq, numa_node_id());
71 if (unlikely(!irq_desc)) { 71 if (unlikely(res != p->irq && res != -EEXIST))
72 printk(KERN_INFO "can not get irq_desc for %d\n", 72 printk(KERN_INFO "can not get irq_desc for %d\n",
73 p->irq); 73 p->irq);
74 continue; 74 continue;
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 306ed287077a..8f3c27e9f9e2 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -300,13 +300,13 @@ int __init register_intc_controller(struct intc_desc *desc)
300 for (i = 0; i < hw->nr_vectors; i++) { 300 for (i = 0; i < hw->nr_vectors; i++) {
301 struct intc_vect *vect = hw->vectors + i; 301 struct intc_vect *vect = hw->vectors + i;
302 unsigned int irq = evt2irq(vect->vect); 302 unsigned int irq = evt2irq(vect->vect);
303 struct irq_desc *irq_desc; 303 int res;
304 304
305 if (!vect->enum_id) 305 if (!vect->enum_id)
306 continue; 306 continue;
307 307
308 irq_desc = irq_to_desc_alloc_node(irq, numa_node_id()); 308 res = irq_alloc_desc_at(irq, numa_node_id());
309 if (unlikely(!irq_desc)) { 309 if (res != irq && res != -EEXIST) {
310 pr_err("can't get irq_desc for %d\n", irq); 310 pr_err("can't get irq_desc for %d\n", irq);
311 continue; 311 continue;
312 } 312 }
@@ -326,8 +326,8 @@ int __init register_intc_controller(struct intc_desc *desc)
326 * IRQ support, each vector still needs to have 326 * IRQ support, each vector still needs to have
327 * its own backing irq_desc. 327 * its own backing irq_desc.
328 */ 328 */
329 irq_desc = irq_to_desc_alloc_node(irq2, numa_node_id()); 329 res = irq_alloc_desc_at(irq2, numa_node_id());
330 if (unlikely(!irq_desc)) { 330 if (res != irq2 && res != -EEXIST) {
331 pr_err("can't get irq_desc for %d\n", irq2); 331 pr_err("can't get irq_desc for %d\n", irq2);
332 continue; 332 continue;
333 } 333 }
diff --git a/drivers/sh/intc/dynamic.c b/drivers/sh/intc/dynamic.c
index 6caecdffe201..e994c7ed916e 100644
--- a/drivers/sh/intc/dynamic.c
+++ b/drivers/sh/intc/dynamic.c
@@ -37,7 +37,6 @@ unsigned int create_irq_nr(unsigned int irq_want, int node)
37{ 37{
38 unsigned int irq = 0, new; 38 unsigned int irq = 0, new;
39 unsigned long flags; 39 unsigned long flags;
40 struct irq_desc *desc;
41 40
42 raw_spin_lock_irqsave(&vector_lock, flags); 41 raw_spin_lock_irqsave(&vector_lock, flags);
43 42
@@ -55,24 +54,20 @@ unsigned int create_irq_nr(unsigned int irq_want, int node)
55 __set_bit(new, intc_irq_map); 54 __set_bit(new, intc_irq_map);
56 } 55 }
57 56
58 desc = irq_to_desc_alloc_node(new, node); 57 raw_spin_unlock_irqrestore(&vector_lock, flags);
59 if (unlikely(!desc)) { 58
59 irq = irq_alloc_desc_at(new, node);
60 if (unlikely(irq != new)) {
60 pr_err("can't get irq_desc for %d\n", new); 61 pr_err("can't get irq_desc for %d\n", new);
61 goto out_unlock; 62 return 0;
62 } 63 }
63 64
64 desc = move_irq_desc(desc, node); 65 activate_irq(irq);
65 irq = new; 66 return 0;
66 67
67out_unlock: 68out_unlock:
68 raw_spin_unlock_irqrestore(&vector_lock, flags); 69 raw_spin_unlock_irqrestore(&vector_lock, flags);
69 70 return 0;
70 if (irq > 0) {
71 dynamic_irq_init(irq);
72 activate_irq(irq);
73 }
74
75 return irq;
76} 71}
77 72
78int create_irq(void) 73int create_irq(void)
@@ -91,7 +86,7 @@ void destroy_irq(unsigned int irq)
91{ 86{
92 unsigned long flags; 87 unsigned long flags;
93 88
94 dynamic_irq_cleanup(irq); 89 irq_free_desc(irq);
95 90
96 raw_spin_lock_irqsave(&vector_lock, flags); 91 raw_spin_lock_irqsave(&vector_lock, flags);
97 __clear_bit(irq, intc_irq_map); 92 __clear_bit(irq, intc_irq_map);