Created
March 13, 2023 15:05
-
-
Save vejeta/86e570b0a431b3f8d26911be506323ae to your computer and use it in GitHub Desktop.
Tentative fix for nvidia-legacy-340xx-kernel-dkms 340.108-17 module for Linux 6.2.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From: Juan Manuel Méndez Rey <vejeta@gmail.com> | |
Date: Mon, 13 Mar 2023 15:49:30 +0000 | |
Subject: [PATCH] Tentative fix for NVIDIA 340.108 DKMS source for Linux 6.2 | |
Credit goes to Joan Bruguera <joanbrugeram@gmail.com> for the inspiration patch: | |
"Tentative fix for NVIDIA 470.161.03 driver for Linux 6.2" | |
--- | |
nv-acpi.c | 19 ++++++++++++++++--- | |
1 file changed, 19 insertions(+), 3 deletions(-) | |
diff --git a/nv-acpi.c b/nv-acpi.c | |
index 07501eb..1fdf71c 100644 | |
--- a/nv-acpi.c | |
+++ b/nv-acpi.c | |
@@ -8,6 +8,7 @@ | |
* _NVRM_COPYRIGHT_END_ | |
*/ | |
+#include <linux/version.h> | |
#define __NO_VERSION__ | |
#include "os-interface.h" | |
@@ -24,7 +25,10 @@ static NV_STATUS nv_acpi_extract_object (const union acpi_object *, void *, N | |
static int nv_acpi_add (struct acpi_device *); | |
-#if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2) | |
+// Rel. commit "ACPI: make remove callback of ACPI driver void" (Dawei Li, 14 Nov 2022) | |
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)) | |
+static void nv_acpi_remove_one_arg_void(struct acpi_device *device); | |
+#elif !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2) | |
static int nv_acpi_remove_two_args(struct acpi_device *device, int type); | |
#else | |
static int nv_acpi_remove_one_arg(struct acpi_device *device); | |
@@ -80,7 +84,10 @@ static const struct acpi_driver nv_acpi_driver_template = { | |
.ids = nv_video_device_ids, | |
.ops = { | |
.add = nv_acpi_add, | |
-#if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2) | |
+// Rel. commit "ACPI: make remove callback of ACPI driver void" (Dawei Li, 14 Nov 2022) | |
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)) | |
+ .remove = nv_acpi_remove_one_arg_void, | |
+#elif !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2) | |
.remove = nv_acpi_remove_two_args, | |
#else | |
.remove = nv_acpi_remove_one_arg, | |
@@ -342,7 +349,10 @@ static int nv_acpi_add(struct acpi_device *device) | |
return 0; | |
} | |
-#if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2) | |
+// Rel. commit "ACPI: make remove callback of ACPI driver void" (Dawei Li, 14 Nov 2022) | |
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)) | |
+static void nv_acpi_remove_one_arg_void(struct acpi_device *device) | |
+#elif !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2) | |
static int nv_acpi_remove_two_args(struct acpi_device *device, int type) | |
#else | |
static int nv_acpi_remove_one_arg(struct acpi_device *device) | |
@@ -396,7 +406,10 @@ static int nv_acpi_remove_one_arg(struct acpi_device *device) | |
device->driver_data = NULL; | |
} | |
+// Rel. commit "ACPI: make remove callback of ACPI driver void" (Dawei Li, 14 Nov 2022) | |
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)) | |
return status; | |
+#endif | |
} | |
/* | |
-- | |
2.39.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment