Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+12 -39
+1 -1
tools/testing/radix-tree/linux/init.h
··· 1 - /* An empty file stub that allows radix-tree.c to compile. */ 1 + #define __init
+1 -38
tools/testing/radix-tree/linux/kernel.h
··· 1 1 #ifndef _KERNEL_H 2 2 #define _KERNEL_H 3 3 4 - #include <assert.h> 4 + #include "../../include/linux/kernel.h" 5 5 #include <string.h> 6 6 #include <stdio.h> 7 - #include <stddef.h> 8 7 #include <limits.h> 9 8 10 9 #include <linux/compiler.h> ··· 18 19 #define RADIX_TREE_MAP_SHIFT 3 19 20 #endif 20 21 21 - #ifndef NULL 22 - #define NULL 0 23 - #endif 24 - 25 - #define BUG_ON(expr) assert(!(expr)) 26 - #define __init 27 - #define __must_check 28 - #define panic(expr) 29 22 #define printk printf 30 - #define __force 31 - #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 32 23 #define pr_debug printk 33 24 34 - #define smp_rmb() barrier() 35 - #define smp_wmb() barrier() 36 - #define cpu_relax() barrier() 37 - 38 25 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 39 - 40 - #define container_of(ptr, type, member) ({ \ 41 - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 42 - (type *)( (char *)__mptr - offsetof(type, member) );}) 43 - #define min(a, b) ((a) < (b) ? (a) : (b)) 44 - 45 - #define cond_resched() sched_yield() 46 - 47 - static inline int in_interrupt(void) 48 - { 49 - return 0; 50 - } 51 - 52 - /* 53 - * This looks more complex than it should be. But we need to 54 - * get the type for the ~ right in round_down (it needs to be 55 - * as wide as the result!), and we want to evaluate the macro 56 - * arguments just once each. 57 - */ 58 - #define __round_mask(x, y) ((__typeof__(x))((y)-1)) 59 - #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) 60 - #define round_down(x, y) ((x) & ~__round_mask(x, y)) 61 26 62 27 #define xchg(ptr, x) uatomic_xchg(ptr, x) 63 28
+10
tools/testing/radix-tree/linux/preempt.h
··· 1 + #ifndef __LINUX_PREEMPT_H 2 + #define __LINUX_PREEMPT_H 3 + 1 4 extern int preempt_count; 2 5 3 6 #define preempt_disable() uatomic_inc(&preempt_count) 4 7 #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 */