提交 1bb858f2 编写于 作者: L lepton 提交者: Linus Torvalds

[PATCH] asm-i386/atomic.h: local_irq_save should be used instead of local_irq_disable

atomic_add_return() if CONFIG_M386 can accidentally enable local interrupts.
Signed-off-by: NLepton Wu <ytht.net@gmail.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 ab5703b3
...@@ -183,6 +183,7 @@ static __inline__ int atomic_add_return(int i, atomic_t *v) ...@@ -183,6 +183,7 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
{ {
int __i; int __i;
#ifdef CONFIG_M386 #ifdef CONFIG_M386
unsigned long flags;
if(unlikely(boot_cpu_data.x86==3)) if(unlikely(boot_cpu_data.x86==3))
goto no_xadd; goto no_xadd;
#endif #endif
...@@ -196,10 +197,10 @@ static __inline__ int atomic_add_return(int i, atomic_t *v) ...@@ -196,10 +197,10 @@ static __inline__ int atomic_add_return(int i, atomic_t *v)
#ifdef CONFIG_M386 #ifdef CONFIG_M386
no_xadd: /* Legacy 386 processor */ no_xadd: /* Legacy 386 processor */
local_irq_disable(); local_irq_save(flags);
__i = atomic_read(v); __i = atomic_read(v);
atomic_set(v, i + __i); atomic_set(v, i + __i);
local_irq_enable(); local_irq_restore(flags);
return i + __i; return i + __i;
#endif #endif
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册