}
static struct irq_cfg *irq_cfgx;
+
+/*
+ * Protect the irq_cfgx_free freelist:
+ */
+static DEFINE_SPINLOCK(irq_cfg_lock);
+
#ifdef CONFIG_HAVE_SPARSE_IRQ
static struct irq_cfg *irq_cfgx_free;
#endif
static struct irq_cfg *irq_cfg_alloc(unsigned int irq)
{
struct irq_cfg *cfg, *cfg_pri;
- int i;
+ unsigned long flags;
int count = 0;
+ int i;
cfg_pri = cfg = irq_cfgx;
while (cfg) {
count++;
}
+ spin_lock_irqsave(&irq_cfg_lock, flags);
if (!irq_cfgx_free) {
unsigned long phys;
unsigned long total_bytes;
else
irq_cfgx = cfg;
cfg->irq = irq;
+
+ spin_unlock_irqrestore(&irq_cfg_lock, flags);
+
printk(KERN_DEBUG "found new irq_cfg for irq %d\n", cfg->irq);
#ifdef CONFIG_HAVE_SPARSE_IRQ_DEBUG
{
}
}
+/*
+ * Protect the sparse_irqs_free freelist:
+ */
+static DEFINE_SPINLOCK(sparse_irq_lock);
+
#ifdef CONFIG_HAVE_SPARSE_IRQ
static struct irq_desc *sparse_irqs_free;
struct irq_desc *sparse_irqs;
}
return NULL;
}
+
struct irq_desc *irq_to_desc_alloc(unsigned int irq)
{
struct irq_desc *desc, *desc_pri;
- int i;
+ unsigned long flags;
int count = 0;
+ int i;
desc_pri = desc = sparse_irqs;
while (desc) {
count++;
}
+ spin_lock_irqsave(&sparse_irq_lock, flags);
/*
* we run out of pre-allocate ones, allocate more
*/
else
sparse_irqs = desc;
desc->irq = irq;
+
+ spin_unlock_irqrestore(&sparse_irq_lock, flags);
+
printk(KERN_DEBUG "found new irq_desc for irq %d\n", desc->irq);
#ifdef CONFIG_HAVE_SPARSE_IRQ_DEBUG
{