new file mode 100644
@@ -0,0 +1,11 @@
+#ifndef __ASM_SPINLOCK_H
+#define __ASM_SPINLOCK_H
+
+struct spinlock {
+ int v;
+};
+
+void spin_lock(struct spinlock *lock);
+void spin_unlock(struct spinlock *lock);
+
+#endif
@@ -1,21 +1,16 @@
#ifndef __SMP_H
#define __SMP_H
+#include <asm/spinlock.h>
#define mb() asm volatile("mfence":::"memory")
#define rmb() asm volatile("lfence":::"memory")
#define wmb() asm volatile("sfence" ::: "memory")
-struct spinlock {
- int v;
-};
-
void smp_init(void);
int cpu_count(void);
int smp_id(void);
void on_cpu(int cpu, void (*function)(void *data), void *data);
void on_cpu_async(int cpu, void (*function)(void *data), void *data);
-void spin_lock(struct spinlock *lock);
-void spin_unlock(struct spinlock *lock);
#endif
Move the spin_lock/unlock declarations to lib/x86/asm/spinlock.h, allowing lib code, e.g. lib/report.c, to use spinlocks. Signed-off-by: Andrew Jones <drjones@redhat.com> --- lib/x86/asm/spinlock.h | 11 +++++++++++ lib/x86/smp.h | 7 +------ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 lib/x86/asm/spinlock.h