aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/radix-tree/linux/kernel.h
diff options
context:
space:
mode:
authorMatthew Wilcox <mawilcox@microsoft.com>2016-12-16 15:11:05 -0500
committerMatthew Wilcox <mawilcox@microsoft.com>2017-02-13 16:09:42 -0500
commitab3a1ffd11d90583c71bd606bf0fd5bfef30bce9 (patch)
treed8b274be60b3177b7524e670fb8331286d1ae630 /tools/testing/radix-tree/linux/kernel.h
parent7a4f11b88981f47d79eb64267e8a2989a18ce831 (diff)
radix tree test suite: Reduce kernel.h
Many of the definitions in the radix-tree kernel.h are redundant with others in tools/include, or are no longer used, such as panic(). Move the definition of __init to init.h and in_interrupt() to preempt.h Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Diffstat (limited to 'tools/testing/radix-tree/linux/kernel.h')
-rw-r--r--tools/testing/radix-tree/linux/kernel.h39
1 files changed, 1 insertions, 38 deletions
diff --git a/tools/testing/radix-tree/linux/kernel.h b/tools/testing/radix-tree/linux/kernel.h
index 9681463c91e2..dd1d9aefb14f 100644
--- a/tools/testing/radix-tree/linux/kernel.h
+++ b/tools/testing/radix-tree/linux/kernel.h
@@ -1,10 +1,9 @@
1#ifndef _KERNEL_H 1#ifndef _KERNEL_H
2#define _KERNEL_H 2#define _KERNEL_H
3 3
4#include <assert.h> 4#include "../../include/linux/kernel.h"
5#include <string.h> 5#include <string.h>
6#include <stdio.h> 6#include <stdio.h>
7#include <stddef.h>
8#include <limits.h> 7#include <limits.h>
9 8
10#include <linux/compiler.h> 9#include <linux/compiler.h>
@@ -19,47 +18,11 @@
19#define RADIX_TREE_MAP_SHIFT 3 18#define RADIX_TREE_MAP_SHIFT 3
20#endif 19#endif
21 20
22#ifndef NULL
23#define NULL 0
24#endif
25
26#define BUG_ON(expr) assert(!(expr))
27#define __init
28#define __must_check
29#define panic(expr)
30#define printk printf 21#define printk printf
31#define __force
32#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
33#define pr_debug printk 22#define pr_debug printk
34 23
35#define smp_rmb() barrier()
36#define smp_wmb() barrier()
37#define cpu_relax() barrier()
38
39#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 24#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
40 25
41#define container_of(ptr, type, member) ({ \
42 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
43 (type *)( (char *)__mptr - offsetof(type, member) );})
44#define min(a, b) ((a) < (b) ? (a) : (b))
45
46#define cond_resched() sched_yield()
47
48static inline int in_interrupt(void)
49{
50 return 0;
51}
52
53/*
54 * This looks more complex than it should be. But we need to
55 * get the type for the ~ right in round_down (it needs to be
56 * as wide as the result!), and we want to evaluate the macro
57 * arguments just once each.
58 */
59#define __round_mask(x, y) ((__typeof__(x))((y)-1))
60#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
61#define round_down(x, y) ((x) & ~__round_mask(x, y))
62
63#define xchg(ptr, x) uatomic_xchg(ptr, x) 26#define xchg(ptr, x) uatomic_xchg(ptr, x)
64 27
65#endif /* _KERNEL_H */ 28#endif /* _KERNEL_H */