Make lock/unlock in lock.c accord with arch-lock.h

Make both of the lock/unlock function pairs use the same interfaces.
This commit is contained in:
Masamichi Takagi
2014-09-23 11:52:00 +09:00
parent 43e54dcf85
commit 434597e629

View File

@ -19,12 +19,14 @@ void ihk_mc_spinlock_init(ihk_spinlock_t *lock)
*lock = 0; *lock = 0;
} }
void ihk_mc_spinlock_lock(ihk_spinlock_t *lock, unsigned long *flags) unsigned long ihk_mc_spinlock_lock(ihk_spinlock_t *lock)
{ {
int inc = 0x00010000; int inc = 0x00010000;
int tmp; int tmp;
unsigned long flags;
cpu_disable_interrupt_save(flags);
flags = cpu_disable_interrupt_save();
asm volatile("lock ; xaddl %0, %1\n" asm volatile("lock ; xaddl %0, %1\n"
"movzwl %w0, %2\n\t" "movzwl %w0, %2\n\t"
"shrl $16, %0\n\t" "shrl $16, %0\n\t"
@ -36,12 +38,13 @@ void ihk_mc_spinlock_lock(ihk_spinlock_t *lock, unsigned long *flags)
"jmp 1b\n" "jmp 1b\n"
"2:" "2:"
: "+Q" (inc), "+m" (*lock), "=r" (tmp) : : "memory", "cc"); : "+Q" (inc), "+m" (*lock), "=r" (tmp) : : "memory", "cc");
return flags;
} }
void ihk_mc_spinlock_unlock(ihk_spinlock_t *lock, unsigned long *flags) void ihk_mc_spinlock_unlock(ihk_spinlock_t *lock, unsigned long flags)
{ {
asm volatile ("lock incw %0" : "+m"(*lock) : : "memory", "cc"); asm volatile ("lock incw %0" : "+m"(*lock) : : "memory", "cc");
cpu_restore_interrupt(*flags); cpu_restore_interrupt(flags);
} }
#endif #endif