Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Nicolas Schier <nsc@kernel.org>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Sasha Levin" <sashal@kernel.org>
Cc: Nicolas Schier <nsc@kernel.org>,
	Harald Freudenberger <freude@linux.ibm.com>,
	Holger Dengler <dengler@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Huacai Chen <chenhuacai@kernel.org>,
	WANG Xuerui <kernel@xen0n.name>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-kbuild@vger.kernel.org, linux-s390@vger.kernel.org,
	loongarch@lists.linux.dev, linux-mips@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"kernelci.org bot" <bot@kernelci.org>,
	Nicolas Schier <n.schier@fritz.com>
Subject: [PATCH] Move struct cpu_feature to a <linux/device-id/cpu_feature.h>
Date: Fri, 20 Nov 2026 21:27:11 +0100	[thread overview]
Message-ID: <20261120202712.3377691-1-nsc@kernel.org> (raw)
In-Reply-To: <awCruYkI2TkxJfPC@levanger>

From: Nicolas Schier <n.schier@fritz.com>

struct cpu_feature used to be defined in <linux/mod_devicetable.h>. Move
it to <linux/device-id/cpu_feature.h> to let users of mod_devicetable.h
that only need struct cpu_feature switch to the new include file, and
to reduce the number of users of mod_devicetable.h.

While moving struct cpu_feature to <linux/cpufeature.h> instead sounds
reasonable, it would break defconfig on loongarch and mips [1].

Link: https://lore.kernel.org/r/f610c07f39df15f3e7ebdc63bfcd759ca7a687a8.1794233316.git.sashal@kernel.org # [1]
Original-patch-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Original-patch-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Nicolas Schier <n.schier@fritz.com>
---
This patch is a combination of [1] and [2]; both patches have been
merged to prevent failures during bisecting.

Acked-by, Reported-by and Closes tags have been dropped due to the
rewrite.

Thanks to Uwe and Sasha!

[2]: https://patch.msgid.link/bc9fbf5784f6788e10c749a05d56c42bdb68f3d9.1792144769.git.u.kleine-koenig@baylibre.com
---
 arch/loongarch/kvm/main.c             |  2 +-
 include/linux/cpufeature.h            |  3 ++-
 include/linux/device-id/cpu_feature.h | 23 +++++++++++++++++++++++
 include/linux/mod_devicetable.h       | 14 +-------------
 4 files changed, 27 insertions(+), 15 deletions(-)
 create mode 100644 include/linux/device-id/cpu_feature.h

diff --git a/arch/loongarch/kvm/main.c b/arch/loongarch/kvm/main.c
index c65ae2fa4c4b..fb3dc8237499 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/device-id/cpu_feature.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..cd470987777f 100644
--- a/include/linux/cpufeature.h
+++ b/include/linux/cpufeature.h
@@ -6,10 +6,11 @@
 #ifndef __LINUX_CPUFEATURE_H
 #define __LINUX_CPUFEATURE_H
 
+#include <linux/device-id/cpu_feature.h>
+
 #ifdef CONFIG_GENERIC_CPU_AUTOPROBE
 
 #include <linux/init.h>
-#include <linux/mod_devicetable.h>
 #include <asm/cpufeature.h>
 
 /*
diff --git a/include/linux/device-id/cpu_feature.h b/include/linux/device-id/cpu_feature.h
new file mode 100644
index 000000000000..e14fe8bba85a
--- /dev/null
+++ b/include/linux/device-id/cpu_feature.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef LINUX_DEVICE_ID_CPU_FEATURE_H
+#define LINUX_DEVICE_ID_CPU_FEATURE_H
+
+/*
+ * This file is included by scripts/mod/file2alias.c which is compiled
+ * using the host compiler which might not have <linux/types.h> but the
+ * __u{8,16,32} types are defined there locally.
+ */
+#ifdef __KERNEL__
+#include <linux/types.h>
+#endif
+
+/*
+ * Generic table type for matching CPU features.
+ * @feature:	the bit number of the feature (0 - 65535)
+ */
+
+struct cpu_feature {
+	__u16	feature;
+};
+
+#endif /* ifndef LINUX_DEVICE_ID_CPU_FEATURE_H */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index d1581bb64729..a69947f2c1dc 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"
@@ -21,6 +17,7 @@
 #include "device-id/ccw.h"
 #include "device-id/cdx.h"
 #include "device-id/coreboot.h"
+#include "device-id/cpu_feature.h"
 #include "device-id/css.h"
 #include "device-id/dfl.h"
 #include "device-id/dmi.h"
@@ -69,13 +66,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 */
-- 
2.47.3


  reply	other threads:[~2026-11-20 20:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1792144769.git.u.kleine-koenig@baylibre.com>
     [not found] ` <179416565740.60865.16102443399828949110.b4-review@b4>
2026-11-09 14:14   ` [PATCH 1/2] s390/pkey: Include <linux/device-id/ap.h> for struct ap_device_id Sasha Levin
2026-11-09 14:14     ` [PATCH 2/2] devicetable-offsets: Get struct cpu_feature from a device-id header Sasha Levin
2026-11-09 15:57       ` Uwe Kleine-König
2026-11-09 16:07       ` Nicolas Schier
2026-11-19 15:24         ` Nicolas Schier
2026-11-19 19:47           ` Nathan Chancellor
2026-11-20 11:25             ` Uwe Kleine-König
2026-11-20 20:21               ` Nicolas Schier
2026-11-20 20:27                 ` Nicolas Schier [this message]
2026-11-09 15:48     ` [PATCH 1/2] s390/pkey: Include <linux/device-id/ap.h> for struct ap_device_id Uwe Kleine-König
2026-11-13 13:38       ` Harald Freudenberger
2026-11-09 16:07     ` Nicolas Schier
2026-11-13 13:30     ` Harald Freudenberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261120202712.3377691-1-nsc@kernel.org \
    --to=nsc@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=bot@kernelci.org \
    --cc=chenhuacai@kernel.org \
    --cc=dengler@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=kernel@xen0n.name \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=n.schier@fritz.com \
    --cc=nathan@kernel.org \
    --cc=sashal@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=u.kleine-koenig@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox