radix-tree: Replace kernel.h with the necessary inclusions
PATCH 1/1 radix-tree: Replace kernel.h with the necessary inclusions
When kernel.h is used in the headers it adds a lot into dependency hell, especially when there are circular dependencies are involved.
Replace kernel.h inclusion with the list of what is really being used.
--- include/linux/radix-tree.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/linux/radix-tree.h +3 -1
@@ -9,8 +9,10 @@#define _LINUX_RADIX_TREE_H#include <linux/bitops.h> -#include <linux/kernel.h> +#include <linux/gfp.h> #include <linux/list.h> +#include <linux/lockdep.h> +#include <linux/math.h> #include <linux/percpu.h> #include <linux/preempt.h> #include <linux/rcupdate.h>
Signature · 1 line
2.33.0
On Wed, Nov 17, 2021 at 03:01:12PM +0800, Li Wang wrote:
Thanks for the report! And do not top post next time, please.
Quoted 1 line
This patch breaks the radix tree test building.
Yes and no. The dirty tricks with kernel headers that tools/ do is what has been revealed by this patch.
Quoted 13 lines
# make -C tools/testing/radix-tree/
make: Entering directory '/root/linux-5.16-rc1/tools/testing/radix-tree'
cc -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address
-fsanitize=undefined -c -o main.o main.c
In file included from ./linux/../../../../include/linux/radix-tree.h:14,
from ./linux/radix-tree.h:5,
from main.c:10:
./linux/lockdep.h:7:38: error: unknown type name ‘spinlock_t’; did you mean
‘clock_t’?
7 | static inline void lockdep_set_class(spinlock_t *lock,
| ^~~~~~~~~~
| clock_t
In file included from ./linux/radix-tree.h:5,Quoted 8 lines
from main.c:10:
./linux/../../../../include/linux/radix-tree.h:15:10: fatal error:
linux/math.h: No such file or directory
15 | #include <linux/math.h>
| ^~~~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: main.o] Error 1
make: Leaving directory '/root/linux-5.16-rc1/tools/testing/radix-tree'So, add that header to the bunch of others in the tools/
Something like this? (not even compile-tested)
tools/testing/radix-tree/Makefile +1 -0
@@ -40,6 +40,7 @@ $(OFILES): Makefile *.h */*.h generated/map-shift.h \ ../../include/asm/*.h \ ../../../include/linux/xarray.h \ ../../../include/linux/radix-tree.h \ + ../../../include/linux/math.h \ ../../../include/linux/idr.h radix-tree.c: ../../../lib/radix-tree.c
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 8 lines · Andy Shevchenko
On Wed, Nov 17, 2021 at 03:01:12PM +0800, Li Wang wrote:
Thanks for the report! And do not top post next time, please.
Quoted 1 line
This patch breaks the radix tree test building.
Yes and no. The dirty tricks with kernel headers that
tools/do is what has been revealed by this patch.
Should be fixed by Matthew's patch.
Signature · 2 lines
With Best Regards, Andy Shevchenko