linuxPackages.kvmfr: fix for linux 6.4

This commit is contained in:
chayleaf 2023-07-12 14:44:30 +07:00
parent e2078e747c
commit 3a9c8b6c61
2 changed files with 21 additions and 2 deletions

View File

@ -1,11 +1,14 @@
{ lib, stdenv, fetchFromGitHub, kernel, kmod, looking-glass-client }: { lib, stdenv, kernel, looking-glass-client }:
stdenv.mkDerivation rec { stdenv.mkDerivation {
pname = "kvmfr"; pname = "kvmfr";
version = looking-glass-client.version; version = looking-glass-client.version;
src = looking-glass-client.src; src = looking-glass-client.src;
sourceRoot = "source/module"; sourceRoot = "source/module";
patches = lib.optional (kernel.kernelAtLeast "6.4") [
./linux-6-4-compat.patch
];
hardeningDisable = [ "pic" "format" ]; hardeningDisable = [ "pic" "format" ];
nativeBuildInputs = kernel.moduleBuildDependencies; nativeBuildInputs = kernel.moduleBuildDependencies;

View File

@ -0,0 +1,16 @@
diff --git a/kvmfr.c b/kvmfr.c
index 121aae5b..2f4c9e1a 100644
--- a/kvmfr.c
+++ b/kvmfr.c
@@ -539,7 +539,11 @@ static int __init kvmfr_module_init(void)
if (kvmfr->major < 0)
goto out_free;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
kvmfr->pClass = class_create(THIS_MODULE, KVMFR_DEV_NAME);
+#else
+ kvmfr->pClass = class_create(KVMFR_DEV_NAME);
+#endif
if (IS_ERR(kvmfr->pClass))
goto out_unreg;