[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211119113644.1600-5-alx.manpages@gmail.com>
Date: Fri, 19 Nov 2021 12:36:32 +0100
From: Alejandro Colomar <alx.manpages@...il.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Alejandro Colomar <alx.manpages@...il.com>
Subject: [PATCH 04/17] linux/memberof.h: Move memberof() to separate header
Touching files so used for the kernel,
such as <linux/stddef.h> or <linux/container_of.h>
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@...il.com>
---
drivers/gpu/drm/i915/i915_utils.h | 2 +-
drivers/gpu/drm/i915/intel_runtime_pm.h | 1 +
include/linux/container_of.h | 3 +--
include/linux/memberof.h | 9 +++++++++
include/linux/virtio_config.h | 1 +
5 files changed, 13 insertions(+), 3 deletions(-)
create mode 100644 include/linux/memberof.h
diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 2e3ec28f4f1b..bb91e6763d34 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -25,8 +25,8 @@
#ifndef __I915_UTILS_H
#define __I915_UTILS_H
-#include <linux/container_of.h>
#include <linux/list.h>
+#include <linux/memberof.h>
#include <linux/overflow.h>
#include <linux/sched.h>
#include <linux/types.h>
diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.h b/drivers/gpu/drm/i915/intel_runtime_pm.h
index 6cb04bef62ad..72f5396eea70 100644
--- a/drivers/gpu/drm/i915/intel_runtime_pm.h
+++ b/drivers/gpu/drm/i915/intel_runtime_pm.h
@@ -6,6 +6,7 @@
#ifndef __INTEL_RUNTIME_PM_H__
#define __INTEL_RUNTIME_PM_H__
+#include <linux/memberof.h>
#include <linux/types.h>
#include "intel_wakeref.h"
diff --git a/include/linux/container_of.h b/include/linux/container_of.h
index 227418cb8c99..2f1eb5ddd20a 100644
--- a/include/linux/container_of.h
+++ b/include/linux/container_of.h
@@ -4,10 +4,9 @@
#include <linux/build_bug.h>
#include <linux/err.h>
+#include <linux/memberof.h>
-#define memberof(T, m) (((T *) NULL)->m)
-
#define typeof_member(T, m) typeof(memberof(T, m))
/**
diff --git a/include/linux/memberof.h b/include/linux/memberof.h
new file mode 100644
index 000000000000..3853c91d1fb2
--- /dev/null
+++ b/include/linux/memberof.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_MEMBEROF_H
+#define _LINUX_MEMBEROF_H
+
+
+#define memberof(T, m) (((T *) NULL)->m)
+
+
+#endif /* _LINUX_MEMBEROF_H */
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 4fd659e26450..ddbd51208ce1 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -4,6 +4,7 @@
#include <linux/err.h>
#include <linux/bug.h>
+#include <linux/memberof.h>
#include <linux/virtio.h>
#include <linux/virtio_byteorder.h>
#include <linux/compiler_types.h>
--
2.33.1
Powered by blists - more mailing lists