summaryrefslogtreecommitdiffstats
path: root/kernel/irq
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-10-08 12:47:53 +0200
committerThomas Gleixner <tglx@linutronix.de>2010-10-12 16:53:45 +0200
commita05a900a51c7622ebd8ddb41f14f8bf9db599d8d (patch)
tree3c0f7d5c6aff2af86c350c76cc44631e620d9333 /kernel/irq
parentc2f31c37b7303150ffcce53f6c6ed4ac62952b34 (diff)
downloadblackbird-obmc-linux-a05a900a51c7622ebd8ddb41f14f8bf9db599d8d.tar.gz
blackbird-obmc-linux-a05a900a51c7622ebd8ddb41f14f8bf9db599d8d.zip
genirq: Make sparse_lock a mutex
No callers from atomic regions. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/irq')
-rw-r--r--kernel/irq/irqdesc.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 4f0b9c9d5c46..0e302f90d2ee 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -90,7 +90,7 @@ static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node)
int nr_irqs = NR_IRQS;
EXPORT_SYMBOL_GPL(nr_irqs);
-static DEFINE_RAW_SPINLOCK(sparse_irq_lock);
+static DEFINE_MUTEX(sparse_irq_lock);
static DECLARE_BITMAP(allocated_irqs, NR_IRQS);
#ifdef CONFIG_SPARSE_IRQ
@@ -159,13 +159,12 @@ err_desc:
static void free_desc(unsigned int irq)
{
struct irq_desc *desc = irq_to_desc(irq);
- unsigned long flags;
unregister_irq_proc(irq, desc);
- raw_spin_lock_irqsave(&sparse_irq_lock, flags);
+ mutex_lock(&sparse_irq_lock);
delete_irq_desc(irq);
- raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);
+ mutex_unlock(&sparse_irq_lock);
free_masks(desc);
kfree(desc->kstat_irqs);
@@ -175,16 +174,15 @@ static void free_desc(unsigned int irq)
static int alloc_descs(unsigned int start, unsigned int cnt, int node)
{
struct irq_desc *desc;
- unsigned long flags;
int i;
for (i = 0; i < cnt; i++) {
desc = alloc_desc(start + i, node);
if (!desc)
goto err;
- raw_spin_lock_irqsave(&sparse_irq_lock, flags);
+ mutex_lock(&sparse_irq_lock);
irq_insert_desc(start + i, desc);
- raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);
+ mutex_unlock(&sparse_irq_lock);
}
return start;
@@ -192,9 +190,9 @@ err:
for (i--; i >= 0; i--)
free_desc(start + i);
- raw_spin_lock_irqsave(&sparse_irq_lock, flags);
+ mutex_lock(&sparse_irq_lock);
bitmap_clear(allocated_irqs, start, cnt);
- raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);
+ mutex_unlock(&sparse_irq_lock);
return -ENOMEM;
}
@@ -291,7 +289,6 @@ static inline int alloc_descs(unsigned int start, unsigned int cnt, int node)
*/
void irq_free_descs(unsigned int from, unsigned int cnt)
{
- unsigned long flags;
int i;
if (from >= nr_irqs || (from + cnt) > nr_irqs)
@@ -300,9 +297,9 @@ void irq_free_descs(unsigned int from, unsigned int cnt)
for (i = 0; i < cnt; i++)
free_desc(from + i);
- raw_spin_lock_irqsave(&sparse_irq_lock, flags);
+ mutex_lock(&sparse_irq_lock);
bitmap_clear(allocated_irqs, from, cnt);
- raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);
+ mutex_unlock(&sparse_irq_lock);
}
/**
@@ -317,13 +314,12 @@ void irq_free_descs(unsigned int from, unsigned int cnt)
int __ref
irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node)
{
- unsigned long flags;
int start, ret;
if (!cnt)
return -EINVAL;
- raw_spin_lock_irqsave(&sparse_irq_lock, flags);
+ mutex_lock(&sparse_irq_lock);
start = bitmap_find_next_zero_area(allocated_irqs, nr_irqs, from, cnt, 0);
ret = -EEXIST;
@@ -335,11 +331,11 @@ irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node)
goto err;
bitmap_set(allocated_irqs, start, cnt);
- raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);
+ mutex_unlock(&sparse_irq_lock);
return alloc_descs(start, cnt, node);
err:
- raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);
+ mutex_unlock(&sparse_irq_lock);
return ret;
}
@@ -352,20 +348,19 @@ err:
*/
int irq_reserve_irqs(unsigned int from, unsigned int cnt)
{
- unsigned long flags;
unsigned int start;
int ret = 0;
if (!cnt || (from + cnt) > nr_irqs)
return -EINVAL;
- raw_spin_lock_irqsave(&sparse_irq_lock, flags);
+ mutex_lock(&sparse_irq_lock);
start = bitmap_find_next_zero_area(allocated_irqs, nr_irqs, from, cnt, 0);
if (start == from)
bitmap_set(allocated_irqs, start, cnt);
else
ret = -EEXIST;
- raw_spin_unlock_irqrestore(&sparse_irq_lock, flags);
+ mutex_unlock(&sparse_irq_lock);
return ret;
}
OpenPOWER on IntegriCloud