[PATCH] irq-devres: fix failure path of devm_request_irq()
[linux-2.6/mini2440.git] / include / asm-sparc64 / irqflags.h
blob024fc54d068205befa262d80582d6dc591f34fe6
1 /*
2 * include/asm-sparc64/irqflags.h
4 * IRQ flags handling
6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() functions from the lowlevel headers.
9 */
10 #ifndef _ASM_IRQFLAGS_H
11 #define _ASM_IRQFLAGS_H
13 #ifndef __ASSEMBLY__
15 static inline unsigned long __raw_local_save_flags(void)
17 unsigned long flags;
19 __asm__ __volatile__(
20 "rdpr %%pil, %0"
21 : "=r" (flags)
24 return flags;
27 #define raw_local_save_flags(flags) \
28 do { (flags) = __raw_local_save_flags(); } while (0)
30 static inline void raw_local_irq_restore(unsigned long flags)
32 __asm__ __volatile__(
33 "wrpr %0, %%pil"
34 : /* no output */
35 : "r" (flags)
36 : "memory"
40 static inline void raw_local_irq_disable(void)
42 __asm__ __volatile__(
43 "wrpr 15, %%pil"
44 : /* no outputs */
45 : /* no inputs */
46 : "memory"
50 static inline void raw_local_irq_enable(void)
52 __asm__ __volatile__(
53 "wrpr 0, %%pil"
54 : /* no outputs */
55 : /* no inputs */
56 : "memory"
60 static inline int raw_irqs_disabled_flags(unsigned long flags)
62 return (flags > 0);
65 static inline int raw_irqs_disabled(void)
67 unsigned long flags = __raw_local_save_flags();
69 return raw_irqs_disabled_flags(flags);
73 * For spinlocks, etc:
75 static inline unsigned long __raw_local_irq_save(void)
77 unsigned long flags = __raw_local_save_flags();
79 raw_local_irq_disable();
81 return flags;
84 #define raw_local_irq_save(flags) \
85 do { (flags) = __raw_local_irq_save(); } while (0)
87 #endif /* (__ASSEMBLY__) */
89 #endif /* !(_ASM_IRQFLAGS_H) */