Skip to content

Commit df9ee29

Browse files
committed
Fix IRQ flag handling naming
Fix the IRQ flag handling naming. In linux/irqflags.h under one configuration, it maps: local_irq_enable() -> raw_local_irq_enable() local_irq_disable() -> raw_local_irq_disable() local_irq_save() -> raw_local_irq_save() ... and under the other configuration, it maps: raw_local_irq_enable() -> local_irq_enable() raw_local_irq_disable() -> local_irq_disable() raw_local_irq_save() -> local_irq_save() ... This is quite confusing. There should be one set of names expected of the arch, and this should be wrapped to give another set of names that are expected by users of this facility. Change this to have the arch provide: flags = arch_local_save_flags() flags = arch_local_irq_save() arch_local_irq_restore(flags) arch_local_irq_disable() arch_local_irq_enable() arch_irqs_disabled_flags(flags) arch_irqs_disabled() arch_safe_halt() Then linux/irqflags.h wraps these to provide: raw_local_save_flags(flags) raw_local_irq_save(flags) raw_local_irq_restore(flags) raw_local_irq_disable() raw_local_irq_enable() raw_irqs_disabled_flags(flags) raw_irqs_disabled() raw_safe_halt() with type checking on the flags 'arguments', and then wraps those to provide: local_save_flags(flags) local_irq_save(flags) local_irq_restore(flags) local_irq_disable() local_irq_enable() irqs_disabled_flags(flags) irqs_disabled() safe_halt() with tracing included if enabled. The arch functions can now all be inline functions rather than some of them having to be macros. Signed-off-by: David Howells <[email protected]> [X86, FRV, MN10300] Signed-off-by: Chris Metcalf <[email protected]> [Tile] Signed-off-by: Michal Simek <[email protected]> [Microblaze] Tested-by: Catalin Marinas <[email protected]> [ARM] Acked-by: Thomas Gleixner <[email protected]> Acked-by: Haavard Skinnemoen <[email protected]> [AVR] Acked-by: Tony Luck <[email protected]> [IA-64] Acked-by: Hirokazu Takata <[email protected]> [M32R] Acked-by: Greg Ungerer <[email protected]> [M68K/M68KNOMMU] Acked-by: Ralf Baechle <[email protected]> [MIPS] Acked-by: Kyle McMartin <[email protected]> [PA-RISC] Acked-by: Paul Mackerras <[email protected]> [PowerPC] Acked-by: Martin Schwidefsky <[email protected]> [S390] Acked-by: Chen Liqin <[email protected]> [Score] Acked-by: Matt Fleming <[email protected]> [SH] Acked-by: David S. Miller <[email protected]> [Sparc] Acked-by: Chris Zankel <[email protected]> [Xtensa] Reviewed-by: Richard Henderson <[email protected]> [Alpha] Reviewed-by: Yoshinori Sato <[email protected]> [H8300] Cc: [email protected] [CRIS] Cc: [email protected] [CRIS] Cc: [email protected]
1 parent ca4d3e6 commit df9ee29

File tree

63 files changed

+1482
-1158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1482
-1158
lines changed

arch/alpha/include/asm/irqflags.h

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#ifndef __ALPHA_IRQFLAGS_H
2+
#define __ALPHA_IRQFLAGS_H
3+
4+
#include <asm/system.h>
5+
6+
#define IPL_MIN 0
7+
#define IPL_SW0 1
8+
#define IPL_SW1 2
9+
#define IPL_DEV0 3
10+
#define IPL_DEV1 4
11+
#define IPL_TIMER 5
12+
#define IPL_PERF 6
13+
#define IPL_POWERFAIL 6
14+
#define IPL_MCHECK 7
15+
#define IPL_MAX 7
16+
17+
#ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
18+
#undef IPL_MIN
19+
#define IPL_MIN __min_ipl
20+
extern int __min_ipl;
21+
#endif
22+
23+
#define getipl() (rdps() & 7)
24+
#define setipl(ipl) ((void) swpipl(ipl))
25+
26+
static inline unsigned long arch_local_save_flags(void)
27+
{
28+
return rdps();
29+
}
30+
31+
static inline void arch_local_irq_disable(void)
32+
{
33+
setipl(IPL_MAX);
34+
barrier();
35+
}
36+
37+
static inline unsigned long arch_local_irq_save(void)
38+
{
39+
unsigned long flags = swpipl(IPL_MAX);
40+
barrier();
41+
return flags;
42+
}
43+
44+
static inline void arch_local_irq_enable(void)
45+
{
46+
barrier();
47+
setipl(IPL_MIN);
48+
}
49+
50+
static inline void arch_local_irq_restore(unsigned long flags)
51+
{
52+
barrier();
53+
setipl(flags);
54+
barrier();
55+
}
56+
57+
static inline bool arch_irqs_disabled_flags(unsigned long flags)
58+
{
59+
return flags == IPL_MAX;
60+
}
61+
62+
static inline bool arch_irqs_disabled(void)
63+
{
64+
return arch_irqs_disabled_flags(getipl());
65+
}
66+
67+
#endif /* __ALPHA_IRQFLAGS_H */

arch/alpha/include/asm/system.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -259,34 +259,6 @@ __CALL_PAL_RW2(wrperfmon, unsigned long, unsigned long, unsigned long);
259259
__CALL_PAL_W1(wrusp, unsigned long);
260260
__CALL_PAL_W1(wrvptptr, unsigned long);
261261

262-
#define IPL_MIN 0
263-
#define IPL_SW0 1
264-
#define IPL_SW1 2
265-
#define IPL_DEV0 3
266-
#define IPL_DEV1 4
267-
#define IPL_TIMER 5
268-
#define IPL_PERF 6
269-
#define IPL_POWERFAIL 6
270-
#define IPL_MCHECK 7
271-
#define IPL_MAX 7
272-
273-
#ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
274-
#undef IPL_MIN
275-
#define IPL_MIN __min_ipl
276-
extern int __min_ipl;
277-
#endif
278-
279-
#define getipl() (rdps() & 7)
280-
#define setipl(ipl) ((void) swpipl(ipl))
281-
282-
#define local_irq_disable() do { setipl(IPL_MAX); barrier(); } while(0)
283-
#define local_irq_enable() do { barrier(); setipl(IPL_MIN); } while(0)
284-
#define local_save_flags(flags) ((flags) = rdps())
285-
#define local_irq_save(flags) do { (flags) = swpipl(IPL_MAX); barrier(); } while(0)
286-
#define local_irq_restore(flags) do { barrier(); setipl(flags); barrier(); } while(0)
287-
288-
#define irqs_disabled() (getipl() == IPL_MAX)
289-
290262
/*
291263
* TB routines..
292264
*/

arch/arm/include/asm/irqflags.h

Lines changed: 84 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -10,66 +10,85 @@
1010
*/
1111
#if __LINUX_ARM_ARCH__ >= 6
1212

13-
#define raw_local_irq_save(x) \
14-
({ \
15-
__asm__ __volatile__( \
16-
"mrs %0, cpsr @ local_irq_save\n" \
17-
"cpsid i" \
18-
: "=r" (x) : : "memory", "cc"); \
19-
})
13+
static inline unsigned long arch_local_irq_save(void)
14+
{
15+
unsigned long flags;
16+
17+
asm volatile(
18+
" mrs %0, cpsr @ arch_local_irq_save\n"
19+
" cpsid i"
20+
: "=r" (flags) : : "memory", "cc");
21+
return flags;
22+
}
23+
24+
static inline void arch_local_irq_enable(void)
25+
{
26+
asm volatile(
27+
" cpsie i @ arch_local_irq_enable"
28+
:
29+
:
30+
: "memory", "cc");
31+
}
32+
33+
static inline void arch_local_irq_disable(void)
34+
{
35+
asm volatile(
36+
" cpsid i @ arch_local_irq_disable"
37+
:
38+
:
39+
: "memory", "cc");
40+
}
2041

21-
#define raw_local_irq_enable() __asm__("cpsie i @ __sti" : : : "memory", "cc")
22-
#define raw_local_irq_disable() __asm__("cpsid i @ __cli" : : : "memory", "cc")
2342
#define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc")
2443
#define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc")
25-
2644
#else
2745

2846
/*
2947
* Save the current interrupt enable state & disable IRQs
3048
*/
31-
#define raw_local_irq_save(x) \
32-
({ \
33-
unsigned long temp; \
34-
(void) (&temp == &x); \
35-
__asm__ __volatile__( \
36-
"mrs %0, cpsr @ local_irq_save\n" \
37-
" orr %1, %0, #128\n" \
38-
" msr cpsr_c, %1" \
39-
: "=r" (x), "=r" (temp) \
40-
: \
41-
: "memory", "cc"); \
42-
})
43-
49+
static inline unsigned long arch_local_irq_save(void)
50+
{
51+
unsigned long flags, temp;
52+
53+
asm volatile(
54+
" mrs %0, cpsr @ arch_local_irq_save\n"
55+
" orr %1, %0, #128\n"
56+
" msr cpsr_c, %1"
57+
: "=r" (flags), "=r" (temp)
58+
:
59+
: "memory", "cc");
60+
return flags;
61+
}
62+
4463
/*
4564
* Enable IRQs
4665
*/
47-
#define raw_local_irq_enable() \
48-
({ \
49-
unsigned long temp; \
50-
__asm__ __volatile__( \
51-
"mrs %0, cpsr @ local_irq_enable\n" \
52-
" bic %0, %0, #128\n" \
53-
" msr cpsr_c, %0" \
54-
: "=r" (temp) \
55-
: \
56-
: "memory", "cc"); \
57-
})
66+
static inline void arch_local_irq_enable(void)
67+
{
68+
unsigned long temp;
69+
asm volatile(
70+
" mrs %0, cpsr @ arch_local_irq_enable\n"
71+
" bic %0, %0, #128\n"
72+
" msr cpsr_c, %0"
73+
: "=r" (temp)
74+
:
75+
: "memory", "cc");
76+
}
5877

5978
/*
6079
* Disable IRQs
6180
*/
62-
#define raw_local_irq_disable() \
63-
({ \
64-
unsigned long temp; \
65-
__asm__ __volatile__( \
66-
"mrs %0, cpsr @ local_irq_disable\n" \
67-
" orr %0, %0, #128\n" \
68-
" msr cpsr_c, %0" \
69-
: "=r" (temp) \
70-
: \
71-
: "memory", "cc"); \
72-
})
81+
static inline void arch_local_irq_disable(void)
82+
{
83+
unsigned long temp;
84+
asm volatile(
85+
" mrs %0, cpsr @ arch_local_irq_disable\n"
86+
" orr %0, %0, #128\n"
87+
" msr cpsr_c, %0"
88+
: "=r" (temp)
89+
:
90+
: "memory", "cc");
91+
}
7392

7493
/*
7594
* Enable FIQs
@@ -106,27 +125,31 @@
106125
/*
107126
* Save the current interrupt enable state.
108127
*/
109-
#define raw_local_save_flags(x) \
110-
({ \
111-
__asm__ __volatile__( \
112-
"mrs %0, cpsr @ local_save_flags" \
113-
: "=r" (x) : : "memory", "cc"); \
114-
})
128+
static inline unsigned long arch_local_save_flags(void)
129+
{
130+
unsigned long flags;
131+
asm volatile(
132+
" mrs %0, cpsr @ local_save_flags"
133+
: "=r" (flags) : : "memory", "cc");
134+
return flags;
135+
}
115136

116137
/*
117138
* restore saved IRQ & FIQ state
118139
*/
119-
#define raw_local_irq_restore(x) \
120-
__asm__ __volatile__( \
121-
"msr cpsr_c, %0 @ local_irq_restore\n" \
122-
: \
123-
: "r" (x) \
124-
: "memory", "cc")
140+
static inline void arch_local_irq_restore(unsigned long flags)
141+
{
142+
asm volatile(
143+
" msr cpsr_c, %0 @ local_irq_restore"
144+
:
145+
: "r" (flags)
146+
: "memory", "cc");
147+
}
125148

126-
#define raw_irqs_disabled_flags(flags) \
127-
({ \
128-
(int)((flags) & PSR_I_BIT); \
129-
})
149+
static inline int arch_irqs_disabled_flags(unsigned long flags)
150+
{
151+
return flags & PSR_I_BIT;
152+
}
130153

131154
#endif
132155
#endif

arch/avr32/include/asm/irqflags.h

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,61 +8,54 @@
88
#ifndef __ASM_AVR32_IRQFLAGS_H
99
#define __ASM_AVR32_IRQFLAGS_H
1010

11+
#include <linux/types.h>
1112
#include <asm/sysreg.h>
1213

13-
static inline unsigned long __raw_local_save_flags(void)
14+
static inline unsigned long arch_local_save_flags(void)
1415
{
1516
return sysreg_read(SR);
1617
}
1718

18-
#define raw_local_save_flags(x) \
19-
do { (x) = __raw_local_save_flags(); } while (0)
20-
2119
/*
2220
* This will restore ALL status register flags, not only the interrupt
2321
* mask flag.
2422
*
2523
* The empty asm statement informs the compiler of this fact while
2624
* also serving as a barrier.
2725
*/
28-
static inline void raw_local_irq_restore(unsigned long flags)
26+
static inline void arch_local_irq_restore(unsigned long flags)
2927
{
3028
sysreg_write(SR, flags);
3129
asm volatile("" : : : "memory", "cc");
3230
}
3331

34-
static inline void raw_local_irq_disable(void)
32+
static inline void arch_local_irq_disable(void)
3533
{
3634
asm volatile("ssrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory");
3735
}
3836

39-
static inline void raw_local_irq_enable(void)
37+
static inline void arch_local_irq_enable(void)
4038
{
4139
asm volatile("csrf %0" : : "n"(SYSREG_GM_OFFSET) : "memory");
4240
}
4341

44-
static inline int raw_irqs_disabled_flags(unsigned long flags)
42+
static inline bool arch_irqs_disabled_flags(unsigned long flags)
4543
{
4644
return (flags & SYSREG_BIT(GM)) != 0;
4745
}
4846

49-
static inline int raw_irqs_disabled(void)
47+
static inline bool arch_irqs_disabled(void)
5048
{
51-
unsigned long flags = __raw_local_save_flags();
52-
53-
return raw_irqs_disabled_flags(flags);
49+
return arch_irqs_disabled_flags(arch_local_save_flags());
5450
}
5551

56-
static inline unsigned long __raw_local_irq_save(void)
52+
static inline unsigned long arch_local_irq_save(void)
5753
{
58-
unsigned long flags = __raw_local_save_flags();
54+
unsigned long flags = arch_local_save_flags();
5955

60-
raw_local_irq_disable();
56+
arch_local_irq_disable();
6157

6258
return flags;
6359
}
6460

65-
#define raw_local_irq_save(flags) \
66-
do { (flags) = __raw_local_irq_save(); } while (0)
67-
6861
#endif /* __ASM_AVR32_IRQFLAGS_H */

arch/blackfin/include/asm/irqflags.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -218,16 +218,4 @@ static inline void hard_local_irq_restore(unsigned long flags)
218218

219219

220220
#endif /* !CONFIG_IPIPE */
221-
222-
/*
223-
* Raw interface to linux/irqflags.h.
224-
*/
225-
#define raw_local_save_flags(flags) do { (flags) = arch_local_save_flags(); } while (0)
226-
#define raw_local_irq_save(flags) do { (flags) = arch_local_irq_save(); } while (0)
227-
#define raw_local_irq_restore(flags) arch_local_irq_restore(flags)
228-
#define raw_local_irq_enable() arch_local_irq_enable()
229-
#define raw_local_irq_disable() arch_local_irq_disable()
230-
#define raw_irqs_disabled_flags(flags) arch_irqs_disabled_flags(flags)
231-
#define raw_irqs_disabled() arch_irqs_disabled()
232-
233221
#endif

arch/blackfin/kernel/trace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/kallsyms.h>
1616
#include <linux/err.h>
1717
#include <linux/fs.h>
18+
#include <linux/irq.h>
1819
#include <asm/dma.h>
1920
#include <asm/trace.h>
2021
#include <asm/fixed_code.h>

0 commit comments

Comments
 (0)