From 92bb655022b180b0678d0e3b6cd6cbc5105da0b9 Mon Sep 17 00:00:00 2001 From: "Keith M. Wesolowski" Date: Thu, 8 Jan 2004 09:41:04 -0800 Subject: [PATCH] [SPARC]: Use spinlock to protect IRQ action management. --- arch/sparc/kernel/irq.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c index e04eb26260064..87378e7711eba 100644 --- a/arch/sparc/kernel/irq.c +++ b/arch/sparc/kernel/irq.c @@ -49,6 +49,9 @@ #include #include +/* Used to protect the IRQ action lists */ +spinlock_t irq_action_lock = SPIN_LOCK_UNLOCKED; + /* * Dave Redman (djhr@tadpole.co.uk) * @@ -492,7 +495,7 @@ int request_fast_irq(unsigned int irq, return -EBUSY; } - save_and_cli(flags); + spin_lock_irqsave(&irq_action_lock, flags); /* If this is flagged as statically allocated then we use our * private struct which is never freed. @@ -507,10 +510,10 @@ int request_fast_irq(unsigned int irq, if (action == NULL) action = (struct irqaction *)kmalloc(sizeof(struct irqaction), - GFP_KERNEL); + GFP_ATOMIC); if (!action) { - restore_flags(flags); + spin_unlock_irqrestore(&irq_action_lock, flags); return -ENOMEM; } @@ -547,7 +550,7 @@ int request_fast_irq(unsigned int irq, *(cpu_irq + irq_action) = action; enable_irq(irq); - restore_flags(flags); + spin_unlock_irqrestore(&irq_action_lock, flags); return 0; } @@ -586,7 +589,7 @@ int request_irq(unsigned int irq, action = NULL; /* Or else! */ } - save_and_cli(flags); + spin_lock_irqsave(&irq_action_lock, flags); /* If this is flagged as statically allocated then we use our * private struct which is never freed. @@ -600,10 +603,10 @@ int request_irq(unsigned int irq, if (action == NULL) action = (struct irqaction *)kmalloc(sizeof(struct irqaction), - GFP_KERNEL); + GFP_ATOMIC); if (!action) { - restore_flags(flags); + spin_unlock_irqrestore(&irq_action_lock, flags); return -ENOMEM; } @@ -620,7 +623,7 @@ int request_irq(unsigned int irq, *(cpu_irq + irq_action) = action; enable_irq(irq); - restore_flags(flags); + spin_unlock_irqrestore(&irq_action_lock, flags); return 0; } -- 2.53.0