aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/interrupt.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-07-03 03:24:27 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-03 18:27:00 -0400
commitc01d403b2e3e3f231b18ebd07ad64ecbe6a258a5 (patch)
treeb7ccadf4bb93d9cdb5c770e976637fb783d9dab5 /include/linux/interrupt.h
parenta875a69f8b00a38b4f40d9632a4fc71a159f0e0d (diff)
[PATCH] lockdep: add disable/enable_irq_lockdep() API
lockdep wants to use the disable_irq()/enable_irq() prototypes before they are provied by the platform's asm/irq.h. So move them out of the CONFIG_GENERIC_HARDIRQS define - all architectures have a common prototype for this anyway. Add special lockdep variants of irq line disabling/enabling. These should be used for locking constructs that know that a particular irq context which is disabled, and which is the only irq-context user of a lock, that it's safe to take the lock in the irq-disabled section without disabling hardirqs. [akpm@osdl.org: build fix] Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/interrupt.h')
-rw-r--r--include/linux/interrupt.h49
1 files changed, 48 insertions, 1 deletions
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index da3e0dbe61d4..2c5452c1d7bb 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -86,6 +86,41 @@ extern void disable_irq_nosync(unsigned int irq);
86extern void disable_irq(unsigned int irq); 86extern void disable_irq(unsigned int irq);
87extern void enable_irq(unsigned int irq); 87extern void enable_irq(unsigned int irq);
88 88
89/*
90 * Special lockdep variants of irq disabling/enabling.
91 * These should be used for locking constructs that
92 * know that a particular irq context which is disabled,
93 * and which is the only irq-context user of a lock,
94 * that it's safe to take the lock in the irq-disabled
95 * section without disabling hardirqs.
96 *
97 * On !CONFIG_LOCKDEP they are equivalent to the normal
98 * irq disable/enable methods.
99 */
100static inline void disable_irq_nosync_lockdep(unsigned int irq)
101{
102 disable_irq_nosync(irq);
103#ifdef CONFIG_LOCKDEP
104 local_irq_disable();
105#endif
106}
107
108static inline void disable_irq_lockdep(unsigned int irq)
109{
110 disable_irq(irq);
111#ifdef CONFIG_LOCKDEP
112 local_irq_disable();
113#endif
114}
115
116static inline void enable_irq_lockdep(unsigned int irq)
117{
118#ifdef CONFIG_LOCKDEP
119 local_irq_enable();
120#endif
121 enable_irq(irq);
122}
123
89/* IRQ wakeup (PM) control: */ 124/* IRQ wakeup (PM) control: */
90extern int set_irq_wake(unsigned int irq, unsigned int on); 125extern int set_irq_wake(unsigned int irq, unsigned int on);
91 126
@@ -99,7 +134,19 @@ static inline int disable_irq_wake(unsigned int irq)
99 return set_irq_wake(irq, 0); 134 return set_irq_wake(irq, 0);
100} 135}
101 136
102#endif 137#else /* !CONFIG_GENERIC_HARDIRQS */
138/*
139 * NOTE: non-genirq architectures, if they want to support the lock
140 * validator need to define the methods below in their asm/irq.h
141 * files, under an #ifdef CONFIG_LOCKDEP section.
142 */
143# ifndef CONFIG_LOCKDEP
144# define disable_irq_nosync_lockdep(irq) disable_irq_nosync(irq)
145# define disable_irq_lockdep(irq) disable_irq(irq)
146# define enable_irq_lockdep(irq) enable_irq(irq)
147# endif
148
149#endif /* CONFIG_GENERIC_HARDIRQS */
103 150
104#ifndef __ARCH_SET_SOFTIRQ_PENDING 151#ifndef __ARCH_SET_SOFTIRQ_PENDING
105#define set_softirq_pending(x) (local_softirq_pending() = (x)) 152#define set_softirq_pending(x) (local_softirq_pending() = (x))