mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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]
This commit is contained in:
parent
ca4d3e6746
commit
df9ee29270
63 changed files with 1482 additions and 1158 deletions
|
|
@ -28,7 +28,7 @@
|
|||
* M68K COLDFIRE
|
||||
*/
|
||||
|
||||
#define ALLOWINT 0xf8ff
|
||||
#define ALLOWINT (~0x700)
|
||||
|
||||
#ifdef __ASSEMBLY__
|
||||
|
||||
|
|
|
|||
76
arch/m68k/include/asm/irqflags.h
Normal file
76
arch/m68k/include/asm/irqflags.h
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
#ifndef _M68K_IRQFLAGS_H
|
||||
#define _M68K_IRQFLAGS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/preempt.h>
|
||||
#include <asm/thread_info.h>
|
||||
#include <asm/entry.h>
|
||||
|
||||
static inline unsigned long arch_local_save_flags(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
asm volatile ("movew %%sr,%0" : "=d" (flags) : : "memory");
|
||||
return flags;
|
||||
}
|
||||
|
||||
static inline void arch_local_irq_disable(void)
|
||||
{
|
||||
#ifdef CONFIG_COLDFIRE
|
||||
asm volatile (
|
||||
"move %/sr,%%d0 \n\t"
|
||||
"ori.l #0x0700,%%d0 \n\t"
|
||||
"move %%d0,%/sr \n"
|
||||
: /* no outputs */
|
||||
:
|
||||
: "cc", "%d0", "memory");
|
||||
#else
|
||||
asm volatile ("oriw #0x0700,%%sr" : : : "memory");
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void arch_local_irq_enable(void)
|
||||
{
|
||||
#if defined(CONFIG_COLDFIRE)
|
||||
asm volatile (
|
||||
"move %/sr,%%d0 \n\t"
|
||||
"andi.l #0xf8ff,%%d0 \n\t"
|
||||
"move %%d0,%/sr \n"
|
||||
: /* no outputs */
|
||||
:
|
||||
: "cc", "%d0", "memory");
|
||||
#else
|
||||
# if defined(CONFIG_MMU)
|
||||
if (MACH_IS_Q40 || !hardirq_count())
|
||||
# endif
|
||||
asm volatile (
|
||||
"andiw %0,%%sr"
|
||||
:
|
||||
: "i" (ALLOWINT)
|
||||
: "memory");
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned long arch_local_irq_save(void)
|
||||
{
|
||||
unsigned long flags = arch_local_save_flags();
|
||||
arch_local_irq_disable();
|
||||
return flags;
|
||||
}
|
||||
|
||||
static inline void arch_local_irq_restore(unsigned long flags)
|
||||
{
|
||||
asm volatile ("movew %0,%%sr" : : "d" (flags) : "memory");
|
||||
}
|
||||
|
||||
static inline bool arch_irqs_disabled_flags(unsigned long flags)
|
||||
{
|
||||
return (flags & ~ALLOWINT) != 0;
|
||||
}
|
||||
|
||||
static inline bool arch_irqs_disabled(void)
|
||||
{
|
||||
return arch_irqs_disabled_flags(arch_local_save_flags());
|
||||
}
|
||||
|
||||
#endif /* _M68K_IRQFLAGS_H */
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/irqflags.h>
|
||||
#include <asm/segment.h>
|
||||
#include <asm/entry.h>
|
||||
|
||||
|
|
@ -62,30 +63,6 @@ asmlinkage void resume(void);
|
|||
#define smp_wmb() barrier()
|
||||
#define smp_read_barrier_depends() ((void)0)
|
||||
|
||||
/* interrupt control.. */
|
||||
#if 0
|
||||
#define local_irq_enable() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory")
|
||||
#else
|
||||
#include <linux/hardirq.h>
|
||||
#define local_irq_enable() ({ \
|
||||
if (MACH_IS_Q40 || !hardirq_count()) \
|
||||
asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory"); \
|
||||
})
|
||||
#endif
|
||||
#define local_irq_disable() asm volatile ("oriw #0x0700,%%sr": : : "memory")
|
||||
#define local_save_flags(x) asm volatile ("movew %%sr,%0":"=d" (x) : : "memory")
|
||||
#define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory")
|
||||
|
||||
static inline int irqs_disabled(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
local_save_flags(flags);
|
||||
return flags & ~ALLOWINT;
|
||||
}
|
||||
|
||||
/* For spinlocks etc */
|
||||
#define local_irq_save(x) ({ local_save_flags(x); local_irq_disable(); })
|
||||
|
||||
#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
|
||||
|
||||
struct __xchg_dummy { unsigned long a[100]; };
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#define _M68KNOMMU_SYSTEM_H
|
||||
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/irqflags.h>
|
||||
#include <asm/segment.h>
|
||||
#include <asm/entry.h>
|
||||
|
||||
|
|
@ -46,54 +47,6 @@ asmlinkage void resume(void);
|
|||
(last) = _last; \
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COLDFIRE
|
||||
#define local_irq_enable() __asm__ __volatile__ ( \
|
||||
"move %/sr,%%d0\n\t" \
|
||||
"andi.l #0xf8ff,%%d0\n\t" \
|
||||
"move %%d0,%/sr\n" \
|
||||
: /* no outputs */ \
|
||||
: \
|
||||
: "cc", "%d0", "memory")
|
||||
#define local_irq_disable() __asm__ __volatile__ ( \
|
||||
"move %/sr,%%d0\n\t" \
|
||||
"ori.l #0x0700,%%d0\n\t" \
|
||||
"move %%d0,%/sr\n" \
|
||||
: /* no outputs */ \
|
||||
: \
|
||||
: "cc", "%d0", "memory")
|
||||
/* For spinlocks etc */
|
||||
#define local_irq_save(x) __asm__ __volatile__ ( \
|
||||
"movew %%sr,%0\n\t" \
|
||||
"movew #0x0700,%%d0\n\t" \
|
||||
"or.l %0,%%d0\n\t" \
|
||||
"movew %%d0,%/sr" \
|
||||
: "=d" (x) \
|
||||
: \
|
||||
: "cc", "%d0", "memory")
|
||||
#else
|
||||
|
||||
/* portable version */ /* FIXME - see entry.h*/
|
||||
#define ALLOWINT 0xf8ff
|
||||
|
||||
#define local_irq_enable() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory")
|
||||
#define local_irq_disable() asm volatile ("oriw #0x0700,%%sr": : : "memory")
|
||||
#endif
|
||||
|
||||
#define local_save_flags(x) asm volatile ("movew %%sr,%0":"=d" (x) : : "memory")
|
||||
#define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory")
|
||||
|
||||
/* For spinlocks etc */
|
||||
#ifndef local_irq_save
|
||||
#define local_irq_save(x) do { local_save_flags(x); local_irq_disable(); } while (0)
|
||||
#endif
|
||||
|
||||
#define irqs_disabled() \
|
||||
({ \
|
||||
unsigned long flags; \
|
||||
local_save_flags(flags); \
|
||||
((flags & 0x0700) == 0x0700); \
|
||||
})
|
||||
|
||||
#define iret() __asm__ __volatile__ ("rte": : :"memory", "sp", "cc")
|
||||
|
||||
/*
|
||||
|
|
@ -206,12 +159,4 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
|
|||
#define arch_align_stack(x) (x)
|
||||
|
||||
|
||||
static inline int irqs_disabled_flags(unsigned long flags)
|
||||
{
|
||||
if (flags & 0x0700)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif /* _M68KNOMMU_SYSTEM_H */
|
||||
|
|
|
|||
Loading…
Reference in a new issue