File Fix-the-layout-changes-after-linux-6.patch of Package msr-safe

From cd350fbb0786c478099dd6030a01515a5d3360e7 Mon Sep 17 00:00:00 2001
From: Jeffrey Cheung <jcheung@suse.com>
Date: Sat, 1 Apr 2023 03:37:38 +0000
Subject: [PATCH] Fix the layout changes after linux 6

---
 msr_allowlist.c | 4 ++++
 msr_batch.c     | 4 ++++
 msr_entry.c     | 4 ++++
 msr_version.c   | 4 ++++
 4 files changed, 16 insertions(+)

diff --git a/msr_allowlist.c b/msr_allowlist.c
index ba95b1c..77ed8c1 100644
--- a/msr_allowlist.c
+++ b/msr_allowlist.c
@@ -362,7 +362,11 @@ static int parse_next_allowlist_entry(char *inbuf, char **nextinbuf, struct allo
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39)
 static char *msr_allowlist_nodename(struct device *dev, mode_t *mode)
 #else
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6,2,0)
 static char *msr_allowlist_nodename(struct device *dev, umode_t *mode)
+#else
+static char *msr_allowlist_nodename(const struct device *dev, umode_t *mode)
+#endif
 #endif
 {
     return kasprintf(GFP_KERNEL, "cpu/msr_allowlist");
diff --git a/msr_batch.c b/msr_batch.c
index 316a0dc..ba1228b 100644
--- a/msr_batch.c
+++ b/msr_batch.c
@@ -183,7 +183,11 @@ void msrbatch_cleanup(int majordev)
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39)
 static char *msrbatch_nodename(struct device *dev, mode_t *mode)
 #else
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6,2,0)
 static char *msrbatch_nodename(struct device *dev, umode_t *mode)
+#else
+static char *msrbatch_nodename(const struct device *dev, umode_t *mode)
+#endif
 #endif
 {
     return kasprintf(GFP_KERNEL, "cpu/msr_batch");
diff --git a/msr_entry.c b/msr_entry.c
index 93db1b8..0974aa8 100644
--- a/msr_entry.c
+++ b/msr_entry.c
@@ -257,7 +257,11 @@ static struct notifier_block __refdata msr_class_cpu_notifier =
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39)
 static char *msr_devnode(struct device *dev, mode_t *mode)
 #else
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6,2,0)
 static char *msr_devnode(struct device *dev, umode_t *mode)
+#else
+static char *msr_devnode(const struct device *dev, umode_t *mode)
+#endif
 #endif
 {
     return kasprintf(GFP_KERNEL, "cpu/%u/msr_safe", MINOR(dev->devt));
diff --git a/msr_version.c b/msr_version.c
index df7dffb..72fe8dd 100644
--- a/msr_version.c
+++ b/msr_version.c
@@ -53,7 +53,11 @@ static const struct file_operations fops =
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,39)
 static char *msr_version_nodename(struct device *dev, mode_t *mode)
 #else
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(6,2,0)
 static char *msr_version_nodename(struct device *dev, umode_t *mode)
+#else
+static char *msr_version_nodename(const struct device *dev, umode_t *mode)
+#endif
 #endif
 {
     if (mode)
-- 
2.41.0

openSUSE Build Service is sponsored by