powerpc: use spin loop primitives in some functions
Use the different spin loop primitives in some simple powerpc spin loops, including those which will spin as a common case. This will help to test the spin loop primitives before more conversions are done. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [mpe: Add some includes of <linux/processor.h>] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

parent
ede8e2bbb0
commit
4e287e655e
@@ -2,6 +2,7 @@
|
||||
#define _ASM_POWERPC_DELAY_H
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/processor.h>
|
||||
#include <asm/time.h>
|
||||
|
||||
/*
|
||||
@@ -58,11 +59,18 @@ extern void udelay(unsigned long usecs);
|
||||
typeof(condition) __ret; \
|
||||
unsigned long __loops = tb_ticks_per_usec * timeout; \
|
||||
unsigned long __start = get_tbl(); \
|
||||
while (!(__ret = (condition)) && (tb_ticks_since(__start) <= __loops)) \
|
||||
if (delay) \
|
||||
\
|
||||
if (delay) { \
|
||||
while (!(__ret = (condition)) && \
|
||||
(tb_ticks_since(__start) <= __loops)) \
|
||||
udelay(delay); \
|
||||
else \
|
||||
cpu_relax(); \
|
||||
} else { \
|
||||
spin_begin(); \
|
||||
while (!(__ret = (condition)) && \
|
||||
(tb_ticks_since(__start) <= __loops)) \
|
||||
spin_cpu_relax(); \
|
||||
spin_end(); \
|
||||
} \
|
||||
if (!__ret) \
|
||||
__ret = (condition); \
|
||||
__ret; \
|
||||
|
Reference in New Issue
Block a user