diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-28 23:06:51 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-28 23:06:51 +0400 |
commit | 3c3762957818dc902222733a8184f23102e24472 (patch) | |
tree | 97a17d0923d87108715af32f83a526d24e65fb80 /drivers/sh/intc/dynamic.c | |
parent | e9f29c9a56ca06d0effa557823a737cbe7ec09f7 (diff) | |
parent | 63111a3a70fb4d80e3b54ed75f13795e98f7a467 (diff) | |
download | linux-3c3762957818dc902222733a8184f23102e24472.tar.xz |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (32 commits)
sh: intc: switch irq_desc iteration to new active IRQ iterator.
sh: fix up cpu hotplug IRQ migration for irq_data changes.
sh: oprofile: Make sure the backtrace op is available for timer-fallback.
sh64: oprofile: Fix up kernel stack pointer size mismatch.
sh: oprofile: Fix up and extend op_name_from_perf_id().
sh: lockless get_user_pages_fast()
sh64: _PAGE_SPECIAL support.
sound: sh: ctrl_in/outX to __raw_read/writeX conversion.
sh: disable deprecated genirq support.
sh: update show_interrupts() for irq_data chip lookup.
sh: intc: irq_data conversion.
sh64: irq_data conversion.
sh64: update for IRQ flag handling naming changes.
rtc: rtc-rs5c313: ctrl_in/outX to __raw_read/writeX conversion.
sh: mach-se: irq_data conversion.
input: hp680_ts_input: ctrl_in/outX to __raw_read/writeX conversion.
input: jornada680_kbd: ctrl_in/outX to __raw_read/writeX conversion.
sh: hd64461: irq_data conversion.
sh: mach-x3proto: irq_data conversion.
sh: mach-systemh: irq_data conversion.
...
Diffstat (limited to 'drivers/sh/intc/dynamic.c')
-rw-r--r-- | drivers/sh/intc/dynamic.c | 91 |
1 files changed, 10 insertions, 81 deletions
diff --git a/drivers/sh/intc/dynamic.c b/drivers/sh/intc/dynamic.c index 6caecdffe201..4187cce20ffd 100644 --- a/drivers/sh/intc/dynamic.c +++ b/drivers/sh/intc/dynamic.c @@ -17,7 +17,7 @@ #include "internals.h" /* only for activate_irq() damage.. */ /* - * The intc_irq_map provides a global map of bound IRQ vectors for a + * The IRQ bitmap provides a global map of bound IRQ vectors for a * given platform. Allocation of IRQs are either static through the CPU * vector map, or dynamic in the case of board mux vectors or MSI. * @@ -27,109 +27,38 @@ * when dynamically creating IRQs, as well as tying in to otherwise * unused irq_desc positions in the sparse array. */ -static DECLARE_BITMAP(intc_irq_map, NR_IRQS); -static DEFINE_RAW_SPINLOCK(vector_lock); /* * Dynamic IRQ allocation and deallocation */ 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); - - /* - * First try the wanted IRQ - */ - if (test_and_set_bit(irq_want, intc_irq_map) == 0) { - new = irq_want; - } else { - /* .. then fall back to scanning. */ - new = find_first_zero_bit(intc_irq_map, nr_irqs); - if (unlikely(new == nr_irqs)) - goto out_unlock; - - __set_bit(new, intc_irq_map); - } - - desc = irq_to_desc_alloc_node(new, node); - if (unlikely(!desc)) { - pr_err("can't get irq_desc for %d\n", new); - goto out_unlock; - } - - desc = move_irq_desc(desc, node); - irq = new; - -out_unlock: - raw_spin_unlock_irqrestore(&vector_lock, flags); - - if (irq > 0) { - dynamic_irq_init(irq); - activate_irq(irq); - } + int irq = irq_alloc_desc_at(irq_want, node); + if (irq < 0) + return 0; + activate_irq(irq); return irq; } int create_irq(void) { - int nid = cpu_to_node(smp_processor_id()); - int irq; - - irq = create_irq_nr(NR_IRQS_LEGACY, nid); - if (irq == 0) - irq = -1; + int irq = irq_alloc_desc(numa_node_id()); + if (irq >= 0) + activate_irq(irq); return irq; } void destroy_irq(unsigned int irq) { - unsigned long flags; - - dynamic_irq_cleanup(irq); - - raw_spin_lock_irqsave(&vector_lock, flags); - __clear_bit(irq, intc_irq_map); - raw_spin_unlock_irqrestore(&vector_lock, flags); -} - -int reserve_irq_vector(unsigned int irq) -{ - unsigned long flags; - int ret = 0; - - raw_spin_lock_irqsave(&vector_lock, flags); - if (test_and_set_bit(irq, intc_irq_map)) - ret = -EBUSY; - raw_spin_unlock_irqrestore(&vector_lock, flags); - - return ret; + irq_free_desc(irq); } void reserve_intc_vectors(struct intc_vect *vectors, unsigned int nr_vecs) { - unsigned long flags; int i; - raw_spin_lock_irqsave(&vector_lock, flags); for (i = 0; i < nr_vecs; i++) - __set_bit(evt2irq(vectors[i].vect), intc_irq_map); - raw_spin_unlock_irqrestore(&vector_lock, flags); -} - -void reserve_irq_legacy(void) -{ - unsigned long flags; - int i, j; - - raw_spin_lock_irqsave(&vector_lock, flags); - j = find_first_bit(intc_irq_map, nr_irqs); - for (i = 0; i < j; i++) - __set_bit(i, intc_irq_map); - raw_spin_unlock_irqrestore(&vector_lock, flags); + irq_reserve_irqs(evt2irq(vectors[i].vect), 1); } |