summaryrefslogtreecommitdiffstats
path: root/include/linux/processor.h
blob: 94a458c3d197db3702970bb6a9b65a2f5e98c0d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* SPDX-License-Identifier: GPL-2.0 */
/* Misc low level processor primitives */
#ifndef _LINUX_PROCESSOR_H
#define _LINUX_PROCESSOR_H

#include <linux/barebox-wrapper.h>

/*
 * spin_until_cond can be used to wait for a condition to become true. It
 * may be expected that the first iteration will true in the common case
 * (no spinning), so that callers should not require a first "likely" test
 * for the uncontended case before using this primitive.
 *
 * Usage and implementation guidelines are the same as for the spin_begin
 * primitives, above.
 */
#ifndef spin_until_cond
#define spin_until_cond(cond)					\
do {								\
	if (unlikely(!(cond))) {				\
		do {						\
			cpu_relax();				\
		} while (!(cond));				\
	}							\
} while (0)

#endif

#endif /* _LINUX_PROCESSOR_H */