From d015d284c20bd4a57985c56b6da4d564eb7dcbce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Wed, 20 Dec 2023 21:52:35 +0100 Subject: [PATCH] - build fixes for kernel 6.5+ --- kernel-6.5.patch | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ vpb-driver.spec | 2 ++ 2 files changed, 64 insertions(+) create mode 100644 kernel-6.5.patch diff --git a/kernel-6.5.patch b/kernel-6.5.patch new file mode 100644 index 0000000..a706ddf --- /dev/null +++ b/kernel-6.5.patch @@ -0,0 +1,62 @@ +--- vpb-driver-4.2.58/src/vtcore/vtcore_main.c.orig 2023-12-20 21:05:22.000000000 +0100 ++++ vpb-driver-4.2.58/src/vtcore/vtcore_main.c 2023-12-20 21:32:27.930068617 +0100 +@@ -120,8 +120,11 @@ + static struct class *vt_class; + #define device_create(c,p,n,d,u,...) device_create_drvdata(c,p,n,d,u , ## __VA_ARGS__) + +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(6,5,0) + static struct class *vt_class; ++#else ++ static const struct class __vt_class; ++ static const struct class *vt_class = &__vt_class; + + #endif + +@@ -335,11 +335,17 @@ + } + + /* register the vtcore class for sysfs and udev */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6,5,0) + vt_class = class_create( THIS_MODULE, NAME ); + if( IS_ERR(vt_class) ) { + ret = PTR_ERR(vt_class); + goto hell_5; + } ++#else ++ ret = class_register(vt_class); ++ if (ret) ++ goto hell_5; ++#endif + d = device_create(vt_class, NULL, vtcore->dev, NULL, "vt0"); + if( IS_ERR(d) ) { + ret = PTR_ERR(d); +--- vpb-driver-4.2.58/src/vpb/vpb.c.orig 2023-12-20 21:48:28.444029156 +0100 ++++ vpb-driver-4.2.58/src/vpb/vpb.c 2023-12-20 21:51:21.398373018 +0100 +@@ -182,8 +182,11 @@ + static struct class *vpb_class; + #define device_create(c,p,n,d,u,...) device_create_drvdata(c,p,n,d,u , ## __VA_ARGS__) + +- #else ++ #elif LINUX_VERSION_CODE < KERNEL_VERSION(6,5,0) + static struct class *vpb_class; ++ #else ++ static const struct class __vpb_class; ++ static const struct class *vpb_class = &__vpb_class; + + #endif + #endif +@@ -358,7 +361,13 @@ + #ifdef USE_UDEV + printk(KERN_INFO NAME": Setting up udev...\n"); + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6,5,0) + vpb_class = class_create(THIS_MODULE, NAME); ++#else ++ ret = class_register(vpb_class); ++ if (ret) ++ goto hell; ++#endif + + { + struct device *d = device_create(vpb_class, NULL, MKDEV(major, 0), NULL, "vpb0"); diff --git a/vpb-driver.spec b/vpb-driver.spec index 225a799..49ded06 100644 --- a/vpb-driver.spec +++ b/vpb-driver.spec @@ -42,6 +42,7 @@ Patch6: kernel-5.13.patch Patch7: kernel-5.17.patch Patch8: kernel-5.18.patch Patch9: pthread.patch +Patch10: kernel-6.5.patch URL: http://www.voicetronix.com.au/downloads.htm#linux BuildRequires: rpmbuild(macros) >= 1.701 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}} @@ -159,6 +160,7 @@ p=`pwd`\ %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 %if %{without kernel} %{__sed} -i -e 's,subdirs += $(srcdir)/vtcore $(srcdir)/vpb,,' src/Makefile.in -- 2.44.0