Patch to fix bulds with kernel version >= 6.4 OBS-URL: https://build.opensuse.org/request/show/1099600 OBS-URL: https://build.opensuse.org/package/show/hardware/gasket-driver?expand=0&rev=11
44 lines
1.6 KiB
Diff
44 lines
1.6 KiB
Diff
From 83cbe8264fc63511e4e6250f2426749951a340c8 Mon Sep 17 00:00:00 2001
|
|
From: Chris Bradbury <chris@binaryspanner.com>
|
|
Date: Fri, 14 Jul 2023 18:55:56 +0100
|
|
Subject: [PATCH] Amend use of `class_create()` for kernels >= 6.4
|
|
|
|
The function signature for `class_create()` was changed in kernels >= 6.4.x to only accept a single argument (see kernel commit #dcfbb67).
|
|
|
|
This change will conditionally modify how `class_create()` is called depending on the kernel version.
|
|
---
|
|
src/gasket_core.c | 12 ++++++++++--
|
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/gasket_core.c b/src/gasket_core.c
|
|
index 139616b..b1c2726 100644
|
|
--- a/src/gasket_core.c
|
|
+++ b/src/gasket_core.c
|
|
@@ -27,6 +27,7 @@
|
|
#include <linux/platform_device.h>
|
|
#include <linux/printk.h>
|
|
#include <linux/sched.h>
|
|
+#include <linux/version.h>
|
|
|
|
#ifdef GASKET_KERNEL_TRACE_SUPPORT
|
|
#define CREATE_TRACE_POINTS
|
|
@@ -1837,8 +1838,15 @@ int gasket_register_device(const struct gasket_driver_desc *driver_desc)
|
|
internal = &g_descs[desc_idx];
|
|
mutex_init(&internal->mutex);
|
|
memset(internal->devs, 0, sizeof(struct gasket_dev *) * GASKET_DEV_MAX);
|
|
- internal->class =
|
|
- class_create(driver_desc->module, driver_desc->name);
|
|
+
|
|
+ /* Function signature for `class_create()` is changed in kernel >= 6.4.x
|
|
+ * to only accept a single argument.
|
|
+ * */
|
|
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
|
|
+ internal->class = class_create(driver_desc->module, driver_desc->name);
|
|
+#else
|
|
+ internal->class = class_create(driver_desc->name);
|
|
+#endif
|
|
|
|
if (IS_ERR(internal->class)) {
|
|
pr_err("Cannot register %s class [ret=%ld]\n",
|
|
|