blob: 31fa510eb0d9794043d77e348aa3aaa9bb0105b0 [file] [log] [blame]
Andrew Jones3df0ccc2014-04-04 14:25:37 +02001#ifndef _ASM_GENERIC_SPINLOCK_H_
2#define _ASM_GENERIC_SPINLOCK_H_
David Hildenbrandf98bf902017-05-15 13:03:46 +02003
4struct spinlock {
5 unsigned int v;
6};
7
8static inline void spin_lock(struct spinlock *lock)
9{
10 while (__sync_lock_test_and_set(&lock->v, 1));
11}
12
13static inline void spin_unlock(struct spinlock *lock)
14{
15 __sync_lock_release(&lock->v);
16}
17
Andrew Jones3df0ccc2014-04-04 14:25:37 +020018#endif