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
94
arch/ia64/include/asm/irqflags.h
Normal file
94
arch/ia64/include/asm/irqflags.h
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* IRQ flags defines.
|
||||
*
|
||||
* Copyright (C) 1998-2003 Hewlett-Packard Co
|
||||
* David Mosberger-Tang <davidm@hpl.hp.com>
|
||||
* Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
|
||||
* Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
|
||||
*/
|
||||
|
||||
#ifndef _ASM_IA64_IRQFLAGS_H
|
||||
#define _ASM_IA64_IRQFLAGS_H
|
||||
|
||||
#ifdef CONFIG_IA64_DEBUG_IRQ
|
||||
extern unsigned long last_cli_ip;
|
||||
static inline void arch_maybe_save_ip(unsigned long flags)
|
||||
{
|
||||
if (flags & IA64_PSR_I)
|
||||
last_cli_ip = ia64_getreg(_IA64_REG_IP);
|
||||
}
|
||||
#else
|
||||
#define arch_maybe_save_ip(flags) do {} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* - clearing psr.i is implicitly serialized (visible by next insn)
|
||||
* - setting psr.i requires data serialization
|
||||
* - we need a stop-bit before reading PSR because we sometimes
|
||||
* write a floating-point register right before reading the PSR
|
||||
* and that writes to PSR.mfl
|
||||
*/
|
||||
|
||||
static inline unsigned long arch_local_save_flags(void)
|
||||
{
|
||||
ia64_stop();
|
||||
#ifdef CONFIG_PARAVIRT
|
||||
return ia64_get_psr_i();
|
||||
#else
|
||||
return ia64_getreg(_IA64_REG_PSR);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline unsigned long arch_local_irq_save(void)
|
||||
{
|
||||
unsigned long flags = arch_local_save_flags();
|
||||
|
||||
ia64_stop();
|
||||
ia64_rsm(IA64_PSR_I);
|
||||
arch_maybe_save_ip(flags);
|
||||
return flags;
|
||||
}
|
||||
|
||||
static inline void arch_local_irq_disable(void)
|
||||
{
|
||||
#ifdef CONFIG_IA64_DEBUG_IRQ
|
||||
arch_local_irq_save();
|
||||
#else
|
||||
ia64_stop();
|
||||
ia64_rsm(IA64_PSR_I);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void arch_local_irq_enable(void)
|
||||
{
|
||||
ia64_stop();
|
||||
ia64_ssm(IA64_PSR_I);
|
||||
ia64_srlz_d();
|
||||
}
|
||||
|
||||
static inline void arch_local_irq_restore(unsigned long flags)
|
||||
{
|
||||
#ifdef CONFIG_IA64_DEBUG_IRQ
|
||||
unsigned long old_psr = arch_local_save_flags();
|
||||
#endif
|
||||
ia64_intrin_local_irq_restore(flags & IA64_PSR_I);
|
||||
arch_maybe_save_ip(old_psr & ~flags);
|
||||
}
|
||||
|
||||
static inline bool arch_irqs_disabled_flags(unsigned long flags)
|
||||
{
|
||||
return (flags & IA64_PSR_I) == 0;
|
||||
}
|
||||
|
||||
static inline bool arch_irqs_disabled(void)
|
||||
{
|
||||
return arch_irqs_disabled_flags(arch_local_save_flags());
|
||||
}
|
||||
|
||||
static inline void arch_safe_halt(void)
|
||||
{
|
||||
ia64_pal_halt_light(); /* PAL_HALT_LIGHT */
|
||||
}
|
||||
|
||||
|
||||
#endif /* _ASM_IA64_IRQFLAGS_H */
|
||||
|
|
@ -107,87 +107,11 @@ extern struct ia64_boot_param {
|
|||
*/
|
||||
#define set_mb(var, value) do { (var) = (value); mb(); } while (0)
|
||||
|
||||
#define safe_halt() ia64_pal_halt_light() /* PAL_HALT_LIGHT */
|
||||
|
||||
/*
|
||||
* The group barrier in front of the rsm & ssm are necessary to ensure
|
||||
* that none of the previous instructions in the same group are
|
||||
* affected by the rsm/ssm.
|
||||
*/
|
||||
/* For spinlocks etc */
|
||||
|
||||
/*
|
||||
* - clearing psr.i is implicitly serialized (visible by next insn)
|
||||
* - setting psr.i requires data serialization
|
||||
* - we need a stop-bit before reading PSR because we sometimes
|
||||
* write a floating-point register right before reading the PSR
|
||||
* and that writes to PSR.mfl
|
||||
*/
|
||||
#ifdef CONFIG_PARAVIRT
|
||||
#define __local_save_flags() ia64_get_psr_i()
|
||||
#else
|
||||
#define __local_save_flags() ia64_getreg(_IA64_REG_PSR)
|
||||
#endif
|
||||
|
||||
#define __local_irq_save(x) \
|
||||
do { \
|
||||
ia64_stop(); \
|
||||
(x) = __local_save_flags(); \
|
||||
ia64_stop(); \
|
||||
ia64_rsm(IA64_PSR_I); \
|
||||
} while (0)
|
||||
|
||||
#define __local_irq_disable() \
|
||||
do { \
|
||||
ia64_stop(); \
|
||||
ia64_rsm(IA64_PSR_I); \
|
||||
} while (0)
|
||||
|
||||
#define __local_irq_restore(x) ia64_intrin_local_irq_restore((x) & IA64_PSR_I)
|
||||
|
||||
#ifdef CONFIG_IA64_DEBUG_IRQ
|
||||
|
||||
extern unsigned long last_cli_ip;
|
||||
|
||||
# define __save_ip() last_cli_ip = ia64_getreg(_IA64_REG_IP)
|
||||
|
||||
# define local_irq_save(x) \
|
||||
do { \
|
||||
unsigned long __psr; \
|
||||
\
|
||||
__local_irq_save(__psr); \
|
||||
if (__psr & IA64_PSR_I) \
|
||||
__save_ip(); \
|
||||
(x) = __psr; \
|
||||
} while (0)
|
||||
|
||||
# define local_irq_disable() do { unsigned long __x; local_irq_save(__x); } while (0)
|
||||
|
||||
# define local_irq_restore(x) \
|
||||
do { \
|
||||
unsigned long __old_psr, __psr = (x); \
|
||||
\
|
||||
local_save_flags(__old_psr); \
|
||||
__local_irq_restore(__psr); \
|
||||
if ((__old_psr & IA64_PSR_I) && !(__psr & IA64_PSR_I)) \
|
||||
__save_ip(); \
|
||||
} while (0)
|
||||
|
||||
#else /* !CONFIG_IA64_DEBUG_IRQ */
|
||||
# define local_irq_save(x) __local_irq_save(x)
|
||||
# define local_irq_disable() __local_irq_disable()
|
||||
# define local_irq_restore(x) __local_irq_restore(x)
|
||||
#endif /* !CONFIG_IA64_DEBUG_IRQ */
|
||||
|
||||
#define local_irq_enable() ({ ia64_stop(); ia64_ssm(IA64_PSR_I); ia64_srlz_d(); })
|
||||
#define local_save_flags(flags) ({ ia64_stop(); (flags) = __local_save_flags(); })
|
||||
|
||||
#define irqs_disabled() \
|
||||
({ \
|
||||
unsigned long __ia64_id_flags; \
|
||||
local_save_flags(__ia64_id_flags); \
|
||||
(__ia64_id_flags & IA64_PSR_I) == 0; \
|
||||
})
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue