diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-11-17 10:46:45 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-12-14 17:55:33 -0500 |
commit | 239007b8440abff689632f50cdf0f2b9e895b534 (patch) | |
tree | 569cab843af4a999d6d868ec9a824530d2bfa733 /kernel/irq/manage.c | |
parent | 9f5a5621e78cf48d86682a71ceb3fcdbde38b222 (diff) |
genirq: Convert irq_desc.lock to raw_spinlock
Convert locks which cannot be sleeping locks in preempt-rt to
raw_spinlocks.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/irq/manage.c')
-rw-r--r-- | kernel/irq/manage.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 7305b297d1eb..eb6078ca60c7 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -46,9 +46,9 @@ void synchronize_irq(unsigned int irq) | |||
46 | cpu_relax(); | 46 | cpu_relax(); |
47 | 47 | ||
48 | /* Ok, that indicated we're done: double-check carefully. */ | 48 | /* Ok, that indicated we're done: double-check carefully. */ |
49 | spin_lock_irqsave(&desc->lock, flags); | 49 | raw_spin_lock_irqsave(&desc->lock, flags); |
50 | status = desc->status; | 50 | status = desc->status; |
51 | spin_unlock_irqrestore(&desc->lock, flags); | 51 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
52 | 52 | ||
53 | /* Oops, that failed? */ | 53 | /* Oops, that failed? */ |
54 | } while (status & IRQ_INPROGRESS); | 54 | } while (status & IRQ_INPROGRESS); |
@@ -114,7 +114,7 @@ int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask) | |||
114 | if (!desc->chip->set_affinity) | 114 | if (!desc->chip->set_affinity) |
115 | return -EINVAL; | 115 | return -EINVAL; |
116 | 116 | ||
117 | spin_lock_irqsave(&desc->lock, flags); | 117 | raw_spin_lock_irqsave(&desc->lock, flags); |
118 | 118 | ||
119 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 119 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
120 | if (desc->status & IRQ_MOVE_PCNTXT) { | 120 | if (desc->status & IRQ_MOVE_PCNTXT) { |
@@ -134,7 +134,7 @@ int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask) | |||
134 | } | 134 | } |
135 | #endif | 135 | #endif |
136 | desc->status |= IRQ_AFFINITY_SET; | 136 | desc->status |= IRQ_AFFINITY_SET; |
137 | spin_unlock_irqrestore(&desc->lock, flags); | 137 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
140 | 140 | ||
@@ -181,11 +181,11 @@ int irq_select_affinity_usr(unsigned int irq) | |||
181 | unsigned long flags; | 181 | unsigned long flags; |
182 | int ret; | 182 | int ret; |
183 | 183 | ||
184 | spin_lock_irqsave(&desc->lock, flags); | 184 | raw_spin_lock_irqsave(&desc->lock, flags); |
185 | ret = setup_affinity(irq, desc); | 185 | ret = setup_affinity(irq, desc); |
186 | if (!ret) | 186 | if (!ret) |
187 | irq_set_thread_affinity(desc); | 187 | irq_set_thread_affinity(desc); |
188 | spin_unlock_irqrestore(&desc->lock, flags); | 188 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
189 | 189 | ||
190 | return ret; | 190 | return ret; |
191 | } | 191 | } |
@@ -231,9 +231,9 @@ void disable_irq_nosync(unsigned int irq) | |||
231 | return; | 231 | return; |
232 | 232 | ||
233 | chip_bus_lock(irq, desc); | 233 | chip_bus_lock(irq, desc); |
234 | spin_lock_irqsave(&desc->lock, flags); | 234 | raw_spin_lock_irqsave(&desc->lock, flags); |
235 | __disable_irq(desc, irq, false); | 235 | __disable_irq(desc, irq, false); |
236 | spin_unlock_irqrestore(&desc->lock, flags); | 236 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
237 | chip_bus_sync_unlock(irq, desc); | 237 | chip_bus_sync_unlock(irq, desc); |
238 | } | 238 | } |
239 | EXPORT_SYMBOL(disable_irq_nosync); | 239 | EXPORT_SYMBOL(disable_irq_nosync); |
@@ -308,9 +308,9 @@ void enable_irq(unsigned int irq) | |||
308 | return; | 308 | return; |
309 | 309 | ||
310 | chip_bus_lock(irq, desc); | 310 | chip_bus_lock(irq, desc); |
311 | spin_lock_irqsave(&desc->lock, flags); | 311 | raw_spin_lock_irqsave(&desc->lock, flags); |
312 | __enable_irq(desc, irq, false); | 312 | __enable_irq(desc, irq, false); |
313 | spin_unlock_irqrestore(&desc->lock, flags); | 313 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
314 | chip_bus_sync_unlock(irq, desc); | 314 | chip_bus_sync_unlock(irq, desc); |
315 | } | 315 | } |
316 | EXPORT_SYMBOL(enable_irq); | 316 | EXPORT_SYMBOL(enable_irq); |
@@ -347,7 +347,7 @@ int set_irq_wake(unsigned int irq, unsigned int on) | |||
347 | /* wakeup-capable irqs can be shared between drivers that | 347 | /* wakeup-capable irqs can be shared between drivers that |
348 | * don't need to have the same sleep mode behaviors. | 348 | * don't need to have the same sleep mode behaviors. |
349 | */ | 349 | */ |
350 | spin_lock_irqsave(&desc->lock, flags); | 350 | raw_spin_lock_irqsave(&desc->lock, flags); |
351 | if (on) { | 351 | if (on) { |
352 | if (desc->wake_depth++ == 0) { | 352 | if (desc->wake_depth++ == 0) { |
353 | ret = set_irq_wake_real(irq, on); | 353 | ret = set_irq_wake_real(irq, on); |
@@ -368,7 +368,7 @@ int set_irq_wake(unsigned int irq, unsigned int on) | |||
368 | } | 368 | } |
369 | } | 369 | } |
370 | 370 | ||
371 | spin_unlock_irqrestore(&desc->lock, flags); | 371 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
372 | return ret; | 372 | return ret; |
373 | } | 373 | } |
374 | EXPORT_SYMBOL(set_irq_wake); | 374 | EXPORT_SYMBOL(set_irq_wake); |
@@ -484,12 +484,12 @@ static int irq_wait_for_interrupt(struct irqaction *action) | |||
484 | static void irq_finalize_oneshot(unsigned int irq, struct irq_desc *desc) | 484 | static void irq_finalize_oneshot(unsigned int irq, struct irq_desc *desc) |
485 | { | 485 | { |
486 | chip_bus_lock(irq, desc); | 486 | chip_bus_lock(irq, desc); |
487 | spin_lock_irq(&desc->lock); | 487 | raw_spin_lock_irq(&desc->lock); |
488 | if (!(desc->status & IRQ_DISABLED) && (desc->status & IRQ_MASKED)) { | 488 | if (!(desc->status & IRQ_DISABLED) && (desc->status & IRQ_MASKED)) { |
489 | desc->status &= ~IRQ_MASKED; | 489 | desc->status &= ~IRQ_MASKED; |
490 | desc->chip->unmask(irq); | 490 | desc->chip->unmask(irq); |
491 | } | 491 | } |
492 | spin_unlock_irq(&desc->lock); | 492 | raw_spin_unlock_irq(&desc->lock); |
493 | chip_bus_sync_unlock(irq, desc); | 493 | chip_bus_sync_unlock(irq, desc); |
494 | } | 494 | } |
495 | 495 | ||
@@ -514,9 +514,9 @@ irq_thread_check_affinity(struct irq_desc *desc, struct irqaction *action) | |||
514 | return; | 514 | return; |
515 | } | 515 | } |
516 | 516 | ||
517 | spin_lock_irq(&desc->lock); | 517 | raw_spin_lock_irq(&desc->lock); |
518 | cpumask_copy(mask, desc->affinity); | 518 | cpumask_copy(mask, desc->affinity); |
519 | spin_unlock_irq(&desc->lock); | 519 | raw_spin_unlock_irq(&desc->lock); |
520 | 520 | ||
521 | set_cpus_allowed_ptr(current, mask); | 521 | set_cpus_allowed_ptr(current, mask); |
522 | free_cpumask_var(mask); | 522 | free_cpumask_var(mask); |
@@ -545,7 +545,7 @@ static int irq_thread(void *data) | |||
545 | 545 | ||
546 | atomic_inc(&desc->threads_active); | 546 | atomic_inc(&desc->threads_active); |
547 | 547 | ||
548 | spin_lock_irq(&desc->lock); | 548 | raw_spin_lock_irq(&desc->lock); |
549 | if (unlikely(desc->status & IRQ_DISABLED)) { | 549 | if (unlikely(desc->status & IRQ_DISABLED)) { |
550 | /* | 550 | /* |
551 | * CHECKME: We might need a dedicated | 551 | * CHECKME: We might need a dedicated |
@@ -555,9 +555,9 @@ static int irq_thread(void *data) | |||
555 | * retriggers the interrupt itself --- tglx | 555 | * retriggers the interrupt itself --- tglx |
556 | */ | 556 | */ |
557 | desc->status |= IRQ_PENDING; | 557 | desc->status |= IRQ_PENDING; |
558 | spin_unlock_irq(&desc->lock); | 558 | raw_spin_unlock_irq(&desc->lock); |
559 | } else { | 559 | } else { |
560 | spin_unlock_irq(&desc->lock); | 560 | raw_spin_unlock_irq(&desc->lock); |
561 | 561 | ||
562 | action->thread_fn(action->irq, action->dev_id); | 562 | action->thread_fn(action->irq, action->dev_id); |
563 | 563 | ||
@@ -679,7 +679,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) | |||
679 | /* | 679 | /* |
680 | * The following block of code has to be executed atomically | 680 | * The following block of code has to be executed atomically |
681 | */ | 681 | */ |
682 | spin_lock_irqsave(&desc->lock, flags); | 682 | raw_spin_lock_irqsave(&desc->lock, flags); |
683 | old_ptr = &desc->action; | 683 | old_ptr = &desc->action; |
684 | old = *old_ptr; | 684 | old = *old_ptr; |
685 | if (old) { | 685 | if (old) { |
@@ -775,7 +775,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) | |||
775 | __enable_irq(desc, irq, false); | 775 | __enable_irq(desc, irq, false); |
776 | } | 776 | } |
777 | 777 | ||
778 | spin_unlock_irqrestore(&desc->lock, flags); | 778 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
779 | 779 | ||
780 | /* | 780 | /* |
781 | * Strictly no need to wake it up, but hung_task complains | 781 | * Strictly no need to wake it up, but hung_task complains |
@@ -802,7 +802,7 @@ mismatch: | |||
802 | ret = -EBUSY; | 802 | ret = -EBUSY; |
803 | 803 | ||
804 | out_thread: | 804 | out_thread: |
805 | spin_unlock_irqrestore(&desc->lock, flags); | 805 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
806 | if (new->thread) { | 806 | if (new->thread) { |
807 | struct task_struct *t = new->thread; | 807 | struct task_struct *t = new->thread; |
808 | 808 | ||
@@ -844,7 +844,7 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) | |||
844 | if (!desc) | 844 | if (!desc) |
845 | return NULL; | 845 | return NULL; |
846 | 846 | ||
847 | spin_lock_irqsave(&desc->lock, flags); | 847 | raw_spin_lock_irqsave(&desc->lock, flags); |
848 | 848 | ||
849 | /* | 849 | /* |
850 | * There can be multiple actions per IRQ descriptor, find the right | 850 | * There can be multiple actions per IRQ descriptor, find the right |
@@ -856,7 +856,7 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) | |||
856 | 856 | ||
857 | if (!action) { | 857 | if (!action) { |
858 | WARN(1, "Trying to free already-free IRQ %d\n", irq); | 858 | WARN(1, "Trying to free already-free IRQ %d\n", irq); |
859 | spin_unlock_irqrestore(&desc->lock, flags); | 859 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
860 | 860 | ||
861 | return NULL; | 861 | return NULL; |
862 | } | 862 | } |
@@ -884,7 +884,7 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) | |||
884 | desc->chip->disable(irq); | 884 | desc->chip->disable(irq); |
885 | } | 885 | } |
886 | 886 | ||
887 | spin_unlock_irqrestore(&desc->lock, flags); | 887 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
888 | 888 | ||
889 | unregister_handler_proc(irq, action); | 889 | unregister_handler_proc(irq, action); |
890 | 890 | ||