Permalink
Browse files

lm32: simplify irq handling even more

Save and restore whole IE register instead of just the lower bit.
  • Loading branch information...
1 parent 8c38f72 commit 00a52b0c1baac629016d18cf9d6da81199ac8f50 @mwalle mwalle committed Aug 1, 2011
Showing with 15 additions and 24 deletions.
  1. +15 −24 arch/lm32/include/asm/irqflags.h
@@ -3,38 +3,36 @@
static inline void arch_local_irq_disable(void)
{
- unsigned int ie;
+ unsigned long ie;
asm volatile (
- "rcsr %0, IE\n" \
- "andi %0, %0, 0xfffe\n" \
- "wcsr IE, %0\n" \
- : "=r"(ie) \
+ "rcsr %0, IE\n"
+ "andi %0, %0, 0xfffe\n"
+ "wcsr IE, %0\n"
+ : "=r"(ie)
);
}
static inline unsigned long arch_local_save_flags(void)
{
- unsigned long ie;
- asm volatile ("rcsr %0, IE\n" : "=r" (ie));
- return ie;
+ unsigned long flags;
+ asm volatile ("rcsr %0, IE\n" : "=r" (flags));
+ return flags;
}
static inline unsigned long arch_local_irq_save(void)
{
- unsigned int old_ie, new_ie;
+ unsigned long flags;
asm volatile (
- "rcsr %1, IE\n" \
- "andi %0, %1, 0xfffe\n" \
- "wcsr IE, %0\n" \
- "andi %1, %1, 1\n" \
- : "=r"(new_ie), "=r"(old_ie) \
+ "rcsr %0, IE\n"
+ "wcsr IE, r0\n"
+ : "=r"(flags)
);
- return old_ie;
+ return flags;
}
static inline void arch_local_irq_enable(void)
{
- unsigned int ie;
+ unsigned long ie;
asm volatile (
"rcsr %0, IE\n"
"ori %0, %0, 1\n"
@@ -44,14 +42,7 @@ static inline void arch_local_irq_enable(void)
static inline void arch_local_irq_restore(unsigned long flags)
{
- unsigned int ie;
- asm volatile ( \
- "andi %1, %1, 0x0001\n" \
- "rcsr %0, IE\n" \
- "andi %0, %0, 0xfffe\n" \
- "or %0, %0, %1\n" \
- "wcsr IE, %0\n": \
- "=&r" (ie): "r" (flags) );
+ asm volatile ("wcsr IE, %0\n" : : "r"(flags));
}
static inline int arch_irqs_disabled_flags(unsigned long flags)

0 comments on commit 00a52b0

Please sign in to comment.