[PATCH 07/17] linux/NULL.h: Move NULL to a separate header

From: Alejandro Colomar
Date: Fri Nov 19 2021 - 06:37:33 EST


Touching files so used for the kernel,
forces 'make' to recompile most of the kernel.

Having those definitions in more granular files
helps avoid recompiling so much of the kernel.

Signed-off-by: Alejandro Colomar <alx.manpages@xxxxxxxxx>
---
include/linux/NULL.h | 10 ++++++++++
include/linux/memberof.h | 2 ++
include/linux/stddef.h | 3 +--
3 files changed, 13 insertions(+), 2 deletions(-)
create mode 100644 include/linux/NULL.h

diff --git a/include/linux/NULL.h b/include/linux/NULL.h
new file mode 100644
index 000000000000..628eacaf598a
--- /dev/null
+++ b/include/linux/NULL.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_NULL_H
+#define _LINUX_NULL_H
+
+
+#undef NULL
+#define NULL ((void *)0)
+
+
+#endif /* _LINUX_NULL_H */
diff --git a/include/linux/memberof.h b/include/linux/memberof.h
index 3853c91d1fb2..6c5eb70bc60f 100644
--- a/include/linux/memberof.h
+++ b/include/linux/memberof.h
@@ -2,6 +2,8 @@
#ifndef _LINUX_MEMBEROF_H
#define _LINUX_MEMBEROF_H

+#include <linux/NULL.h>
+

#define memberof(T, m) (((T *) NULL)->m)

diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index ca507bd5f808..0fbbaa83a9d8 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -3,9 +3,8 @@
#define _LINUX_STDDEF_H

#include <uapi/linux/stddef.h>
+#include <linux/NULL.h>

-#undef NULL
-#define NULL ((void *)0)

enum {
false = 0,
--
2.33.1