Commit 5f4affe8 authored by Russell King's avatar Russell King

[ARM] Cleanup fallout from global IRQ changes.

Replace local_save_flags_cli with local_irq_save.  Remove duplicate
cli, sti, save_flags and restore_flags definitions.
parent 1276ac60
......@@ -36,7 +36,7 @@ static inline void atomic_add(int i, volatile atomic_t *v)
{
unsigned long flags;
local_save_flags_cli(flags);
local_irq_save(flags);
v->counter += i;
local_irq_restore(flags);
}
......@@ -45,7 +45,7 @@ static inline void atomic_sub(int i, volatile atomic_t *v)
{
unsigned long flags;
local_save_flags_cli(flags);
local_irq_save(flags);
v->counter -= i;
local_irq_restore(flags);
}
......@@ -54,7 +54,7 @@ static inline void atomic_inc(volatile atomic_t *v)
{
unsigned long flags;
local_save_flags_cli(flags);
local_irq_save(flags);
v->counter += 1;
local_irq_restore(flags);
}
......@@ -63,7 +63,7 @@ static inline void atomic_dec(volatile atomic_t *v)
{
unsigned long flags;
local_save_flags_cli(flags);
local_irq_save(flags);
v->counter -= 1;
local_irq_restore(flags);
}
......@@ -73,7 +73,7 @@ static inline int atomic_dec_and_test(volatile atomic_t *v)
unsigned long flags;
int val;
local_save_flags_cli(flags);
local_irq_save(flags);
val = v->counter;
v->counter = val -= 1;
local_irq_restore(flags);
......@@ -86,7 +86,7 @@ static inline int atomic_add_negative(int i, volatile atomic_t *v)
unsigned long flags;
int val;
local_save_flags_cli(flags);
local_irq_save(flags);
val = v->counter;
v->counter = val += i;
local_irq_restore(flags);
......@@ -98,7 +98,7 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
{
unsigned long flags;
local_save_flags_cli(flags);
local_irq_save(flags);
*addr &= ~mask;
local_irq_restore(flags);
}
......
......@@ -43,17 +43,23 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */
#endif
/*
* A couple of speedups for the ARM
* Save the current interrupt enable state.
*/
#define local_save_flags(x) \
({ \
__asm__ __volatile__( \
"mrs %0, cpsr @ local_save_flags" \
: "=r" (x) : : "memory"); \
})
/*
* Save the current interrupt enable state & disable IRQs
*/
#define local_save_flags_cli(x) \
#define local_irq_save(x) \
({ \
unsigned long temp; \
__asm__ __volatile__( \
"mrs %0, cpsr @ save_flags_cli\n" \
"mrs %0, cpsr @ local_irq_save\n" \
" orr %1, %0, #128\n" \
" msr cpsr_c, %1" \
: "=r" (x), "=r" (temp) \
......@@ -64,11 +70,11 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */
/*
* Enable IRQs
*/
#define local_irq_enable() \
#define local_irq_enable() \
({ \
unsigned long temp; \
__asm__ __volatile__( \
"mrs %0, cpsr @ sti\n" \
"mrs %0, cpsr @ local_irq_enable\n" \
" bic %0, %0, #128\n" \
" msr cpsr_c, %0" \
: "=r" (temp) \
......@@ -79,11 +85,11 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */
/*
* Disable IRQs
*/
#define local_irq_disable() \
#define local_irq_disable() \
({ \
unsigned long temp; \
__asm__ __volatile__( \
"mrs %0, cpsr @ cli\n" \
"mrs %0, cpsr @ local_irq_disable\n" \
" orr %0, %0, #128\n" \
" msr cpsr_c, %0" \
: "=r" (temp) \
......@@ -121,22 +127,12 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */
: "memory"); \
})
/*
* save current IRQ & FIQ state
*/
#define local_save_flags(x) \
__asm__ __volatile__( \
"mrs %0, cpsr @ save_flags\n" \
: "=r" (x) \
: \
: "memory")
/*
* restore saved IRQ & FIQ state
*/
#define local_irq_restore(x) \
__asm__ __volatile__( \
"msr cpsr_c, %0 @ restore_flags\n" \
"msr cpsr_c, %0 @ local_irq_restore\n" \
: \
: "r" (x) \
: "memory")
......@@ -168,14 +164,14 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size
switch (size) {
#ifdef swp_is_buggy
case 1:
local_save_flags_cli(flags);
local_irq_save(flags);
ret = *(volatile unsigned char *)ptr;
*(volatile unsigned char *)ptr = x;
local_irq_restore(flags);
break;
case 4:
local_save_flags_cli(flags);
local_irq_save(flags);
ret = *(volatile unsigned long *)ptr;
*(volatile unsigned long *)ptr = x;
local_irq_restore(flags);
......
......@@ -75,9 +75,6 @@ extern struct task_struct *__switch_to(struct thread_info *, struct thread_info
mb(); \
} while (0)
/* For spinlocks etc */
#define local_irq_save(x) local_save_flags_cli(x)
#ifdef CONFIG_SMP
#error SMP not supported
......@@ -91,12 +88,8 @@ extern struct task_struct *__switch_to(struct thread_info *, struct thread_info
#define smp_rmb() barrier()
#define smp_wmb() barrier()
#define cli() local_irq_disable()
#define sti() local_irq_enable()
#define clf() __clf()
#define stf() __stf()
#define save_flags(x) local_save_flags(x)
#define restore_flags(x) local_irq_restore(x)
#endif /* CONFIG_SMP */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment