From c4318baf00ed24b7fdcc255de33a18ab37ee8606 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Tue, 12 Oct 2010 02:03:09 +0900 Subject: sh: Sanitize sparse irq Switch over to the new allocator functions. Signed-off-by: Thomas Gleixner Signed-off-by: Paul Mundt --- drivers/sh/intc/core.c | 10 +++++----- drivers/sh/intc/dynamic.c | 23 +++++++++-------------- 2 files changed, 14 insertions(+), 19 deletions(-) (limited to 'drivers/sh/intc') diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c index 306ed287077..8f3c27e9f9e 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) for (i = 0; i < hw->nr_vectors; i++) { struct intc_vect *vect = hw->vectors + i; unsigned int irq = evt2irq(vect->vect); - struct irq_desc *irq_desc; + int res; if (!vect->enum_id) continue; - irq_desc = irq_to_desc_alloc_node(irq, numa_node_id()); - if (unlikely(!irq_desc)) { + res = irq_alloc_desc_at(irq, numa_node_id()); + if (res != irq && res != -EEXIST) { pr_err("can't get irq_desc for %d\n", irq); continue; } @@ -326,8 +326,8 @@ int __init register_intc_controller(struct intc_desc *desc) * IRQ support, each vector still needs to have * its own backing irq_desc. */ - irq_desc = irq_to_desc_alloc_node(irq2, numa_node_id()); - if (unlikely(!irq_desc)) { + res = irq_alloc_desc_at(irq2, numa_node_id()); + if (res != irq2 && res != -EEXIST) { pr_err("can't get irq_desc for %d\n", irq2); continue; } diff --git a/drivers/sh/intc/dynamic.c b/drivers/sh/intc/dynamic.c index 6caecdffe20..e994c7ed916 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) { unsigned int irq = 0, new; unsigned long flags; - struct irq_desc *desc; raw_spin_lock_irqsave(&vector_lock, flags); @@ -55,24 +54,20 @@ unsigned int create_irq_nr(unsigned int irq_want, int node) __set_bit(new, intc_irq_map); } - desc = irq_to_desc_alloc_node(new, node); - if (unlikely(!desc)) { + raw_spin_unlock_irqrestore(&vector_lock, flags); + + irq = irq_alloc_desc_at(new, node); + if (unlikely(irq != new)) { pr_err("can't get irq_desc for %d\n", new); - goto out_unlock; + return 0; } - desc = move_irq_desc(desc, node); - irq = new; + activate_irq(irq); + return 0; out_unlock: raw_spin_unlock_irqrestore(&vector_lock, flags); - - if (irq > 0) { - dynamic_irq_init(irq); - activate_irq(irq); - } - - return irq; + return 0; } int create_irq(void) @@ -91,7 +86,7 @@ void destroy_irq(unsigned int irq) { unsigned long flags; - dynamic_irq_cleanup(irq); + irq_free_desc(irq); raw_spin_lock_irqsave(&vector_lock, flags); __clear_bit(irq, intc_irq_map); -- cgit v1.2.3-70-g09d2