Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219573
b: refs/heads/master
c: 38ab134
h: refs/heads/master
i:
  219571: 2abd8a3
v: v3
  • Loading branch information
Paul Mundt committed Oct 26, 2010
1 parent 6fcb87a commit fe5e943
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 85 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 57b813303ab40557aada8f8886400f3a9de3c0f8
refs/heads/master: 38ab13441c36c0c470b7e4e3b30ec2fb6beba253
6 changes: 0 additions & 6 deletions trunk/arch/sh/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,6 @@ void __init init_IRQ(void)
{
plat_irq_setup();

/*
* Pin any of the legacy IRQ vectors that haven't already been
* grabbed by the platform
*/
reserve_irq_legacy();

/* Perform the machine specific initialisation */
if (sh_mv.mv_init_irq)
sh_mv.mv_init_irq();
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/sh/intc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static void __init intc_register_irq(struct intc_desc *desc,
* Register the IRQ position with the global IRQ map, then insert
* it in to the radix tree.
*/
reserve_irq_vector(irq);
irq_reserve_irqs(irq, 1);

raw_spin_lock_irqsave(&intc_big_lock, flags);
radix_tree_insert(&d->tree, enum_id, intc_irq_xlate_get(irq));
Expand Down
82 changes: 8 additions & 74 deletions trunk/drivers/sh/intc/dynamic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -27,104 +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;

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);
}

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);
int irq = irq_alloc_desc_at(irq_want, node);
if (irq < 0)
return 0;
}

activate_irq(irq);
return 0;

out_unlock:
raw_spin_unlock_irqrestore(&vector_lock, flags);
return 0;
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;

irq_free_desc(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;
}

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);
}
3 changes: 0 additions & 3 deletions trunk/include/linux/sh_intc.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,4 @@ static inline int register_intc_userimask(unsigned long addr)
}
#endif

int reserve_irq_vector(unsigned int irq);
void reserve_irq_legacy(void);

#endif /* __SH_INTC_H */

0 comments on commit fe5e943

Please sign in to comment.