diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 94aa10f..6cd5269 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -10,8 +10,6 @@
 #include <linux/bitops.h>
 #include <linux/log2.h>
 #include <linux/typecheck.h>
-#include <linux/printk.h>
-#include <linux/dynamic_debug.h>
 #include <asm/byteorder.h>
 #include <uapi/linux/kernel.h>

@@ -29,6 +27,9 @@
 #define ULLONG_MAX     (~0ULL)
 #define SIZE_MAX       (~(size_t)0)

+#include <linux/printk.h>
+#include <linux/dynamic_debug.h>
+
 #define U8_MAX         ((u8)~0U)
 #define S8_MAX         ((s8)(U8_MAX>>1))
 #define S8_MIN         ((s8)(-S8_MAX - 1))

This solves bounds.c. But it doesn't help with other files that don't
automatically pull in kernel.h before string.h. They still complain
about SIZE_MAX being undeclared. So, #include <linux/kernel.h> *does*
need to go into string.h. At this point, we run into the next problem.

$ aarch64-linux-gcc -Wp,-MD,scripts/mod/.devicetable-offsets.s.d
-nostdinc -isystem
/opt/toolchain/stbgcc-4.8-1.5/bin/../lib/gcc/aarch64-linux-gnu/4.8.5/include
-I./arch/arm64/include -Iarch/arm64/include/generated/uapi
-Iarch/arm64/include/generated  -Iinclude -I./arch/arm64/include/uapi
-Iarch/arm64/include/generated/uapi -I./include/uapi
-Iinclude/generated/uapi -include ./include/linux/kconfig.h
-D__KERNEL__ -mlittle-endian -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -Wno-format-security -std=gnu89
-mgeneral-regs-only -fno-asynchronous-unwind-tables
-fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0
-Wframe-larger-than=2048 -fno-stack-protector
-Wno-unused-but-set-variable -fno-omit-frame-pointer
-fno-optimize-sibling-calls -fno-var-tracking-assignments -g
-Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow
-fconserve-stack -Werror=implicit-int -Werror=strict-prototypes
-DKBUILD_BASENAME='"devicetable_offsets"'
-DKBUILD_MODNAME='"devicetable_offsets"'  -fverbose-asm -S -o
scripts/mod/devicetable-offsets.s scripts/mod/devicetable-offsets.c
In file included from include/uapi/linux/uuid.h:21:0,
                 from include/linux/uuid.h:19,
                 from include/linux/mod_devicetable.h:12,
                 from scripts/mod/devicetable-offsets.c:2:
include/linux/string.h:4:2: warning: #warning In string.h [-Wcpp]
 #warning In string.h
  ^
In file included from include/linux/string.h:7:0,
                 from include/uapi/linux/uuid.h:21,
                 from include/linux/uuid.h:19,
                 from include/linux/mod_devicetable.h:12,
                 from scripts/mod/devicetable-offsets.c:2:
include/linux/kernel.h:4:2: warning: #warning In kernel.h [-Wcpp]
 #warning In kernel.h
  ^
In file included from include/linux/printk.h:289:0,
                 from include/linux/kernel.h:31,
                 from include/linux/string.h:7,
                 from include/uapi/linux/uuid.h:21,
                 from include/linux/uuid.h:19,
                 from include/linux/mod_devicetable.h:12,
                 from scripts/mod/devicetable-offsets.c:2:
include/linux/dynamic_debug.h: In function ‘ddebug_dyndbg_module_param_cb’:
include/linux/dynamic_debug.h:122:2: error: implicit declaration of
function ‘strstr’ [-Werror=implicit-function-declaration]
  if (strstr(param, "dyndbg")) {
  ^
include/linux/dynamic_debug.h:122:6: warning: incompatible implicit
declaration of built-in function ‘strstr’ [enabled by default]
  if (strstr(param, "dyndbg")) {
      ^
cc1: some warnings being treated as errors

So, now we have the following sequence:

string.h -> kernel.h -> dynamic_debug.h -> oops, we don't know strstr() yet.

Yes, dynamic_debug.h does include string.h, but because of the include
guard, that second attempt at including string.h is stubbed out and
doesn't do anything.

To get past that issue, I can move "#include <linux/kernel.h>" all the
way down and only include it directly before my new functions. That
way strstr() is declared when dynamic_debug.h wants it.

diff --git a/include/linux/string.h b/include/linux/string.h
index 6cc85dc..eb2d9a8 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -171,6 +171,8 @@ static inline const char *kbasename(const char *path)
        return tail ? tail + 1 : path;
 }

+#include <linux/kernel.h>
+
 /**
  * strcpytoupper - Copy string and convert to uppercase.
  * @dst: The buffer to store the result.
