[PATCH v1 1/3] Move struct cpu_feature to <linux/cpufeature.h>
From: Uwe Kleine-König (The Capable Hub)
Date: Mon Sep 21 2026 - 11:45:48 EST
struct cpu_feature used to be defined in <linux/mod_devicetable.h>. It's
much better located in <linux/cpufeature.h>. The only downside is that
modpost and devicetable-offsets.h need the definition and thus
<linux/cpufeature.h> must be included explicitly there.
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@xxxxxxxxxxxx>
---
arch/loongarch/kvm/main.c | 2 +-
include/linux/cpufeature.h | 12 +++++++++++-
include/linux/mod_devicetable.h | 13 -------------
scripts/mod/devicetable-offsets.c | 1 +
scripts/mod/file2alias.c | 1 +
5 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/arch/loongarch/kvm/main.c b/arch/loongarch/kvm/main.c
index 236523d2449d..d082dae61971 100644
--- a/arch/loongarch/kvm/main.c
+++ b/arch/loongarch/kvm/main.c
@@ -5,7 +5,7 @@
#include <linux/err.h>
#include <linux/module.h>
-#include <linux/mod_devicetable.h>
+#include <linux/cpufeature.h>
#include <linux/kvm_host.h>
#include <asm/cacheflush.h>
#include <asm/cpufeature.h>
diff --git a/include/linux/cpufeature.h b/include/linux/cpufeature.h
index 6aff540ee9e5..93c1da38aaf6 100644
--- a/include/linux/cpufeature.h
+++ b/include/linux/cpufeature.h
@@ -6,10 +6,20 @@
#ifndef __LINUX_CPUFEATURE_H
#define __LINUX_CPUFEATURE_H
+#include <linux/types.h>
+
+/*
+ * Generic table type for matching CPU features.
+ * @feature: the bit number of the feature (0 - 65535)
+ */
+
+struct cpu_feature {
+ __u16 feature;
+};
+
#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
#include <linux/init.h>
-#include <linux/mod_devicetable.h>
#include <asm/cpufeature.h>
/*
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index a397213bedac..9ce2429b455f 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -8,10 +8,6 @@
#ifndef LINUX_MOD_DEVICETABLE_H
#define LINUX_MOD_DEVICETABLE_H
-#ifdef __KERNEL__
-#include <linux/types.h>
-#endif
-
#include "device-id/acpi.h"
#include "device-id/amba.h"
#include "device-id/ap.h"
@@ -69,13 +65,4 @@
#include "device-id/x86_cpu.h"
#include "device-id/zorro.h"
-/*
- * Generic table type for matching CPU features.
- * @feature: the bit number of the feature (0 - 65535)
- */
-
-struct cpu_feature {
- __u16 feature;
-};
-
#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index b4178c42d08f..b57dbbef8777 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#define COMPILE_OFFSETS
+#include <linux/cpufeature.h>
#include <linux/kbuild.h>
#include <linux/mod_devicetable.h>
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 8d36c74dec2d..88bff3207277 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -121,6 +121,7 @@ typedef struct {
/* Big exception to the "don't include kernel headers into userspace, which
* even potentially has different endianness and word sizes, since
* we handle those differences explicitly below */
+#include "../../include/linux/cpufeature.h"
#include "../../include/linux/mod_devicetable.h"
struct devtable {
--
2.56.0.rc1