Skip to content

Commit ab3a1ff

Browse files
author
Matthew Wilcox
committed
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>
1 parent 7a4f11b commit ab3a1ff

3 files changed

Lines changed: 12 additions & 39 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/* An empty file stub that allows radix-tree.c to compile. */
1+
#define __init
Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#ifndef _KERNEL_H
22
#define _KERNEL_H
33

4-
#include <assert.h>
4+
#include "../../include/linux/kernel.h"
55
#include <string.h>
66
#include <stdio.h>
7-
#include <stddef.h>
87
#include <limits.h>
98

109
#include <linux/compiler.h>
@@ -19,47 +18,11 @@
1918
#define RADIX_TREE_MAP_SHIFT 3
2019
#endif
2120

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)
3021
#define printk printf
31-
#define __force
32-
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
3322
#define pr_debug printk
3423

35-
#define smp_rmb() barrier()
36-
#define smp_wmb() barrier()
37-
#define cpu_relax() barrier()
38-
3924
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
4025

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-
48-
static 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-
6326
#define xchg(ptr, x) uatomic_xchg(ptr, x)
6427

6528
#endif /* _KERNEL_H */
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1+
#ifndef __LINUX_PREEMPT_H
2+
#define __LINUX_PREEMPT_H
3+
14
extern int preempt_count;
25

36
#define preempt_disable() uatomic_inc(&preempt_count)
47
#define preempt_enable() uatomic_dec(&preempt_count)
8+
9+
static inline int in_interrupt(void)
10+
{
11+
return 0;
12+
}
13+
14+
#endif /* __LINUX_PREEMPT_H */

0 commit comments

Comments
 (0)