Hello!

Problem solved. Error in conftest drm_device_has_pdev.

TL;DR; Just replace file in /usr/src/nvidia-legacy-340xx-340.108/patches with included in this mail and rebuild module.

Orig conftest try include #include <drm/drm_device.h> instead of #include <drm/drm_drv.h> and not include #include <stddef.h>

So drm_device_has_pdev conf test fail. Modified file included in this mail. I hope maintainers release new version
From fbb8d0e78a8e4a23588ed4956a6084a0a4b4aca6 Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <a...@debian.org>
Date: Sun, 19 Sep 2021 15:19:46 +0200
Subject: [PATCH 32/34] backport drm_device_has_pdev changes from 470.63.01

store the pci_dev pointer in dev->dev_private if dev->pdev is no longer
available
---
 Makefile    |  1 +
 conftest.sh | 23 +++++++++++++++++++++++
 nv-drm.c    | 12 ++++++++++++
 3 files changed, 36 insertions(+)

diff --git a/Makefile b/Makefile
index 8c0bfc2..8b64faa 100644
--- a/Makefile
+++ b/Makefile
@@ -164,6 +164,7 @@ COMPILE_TESTS = \
 	drm_driver_has_gem_free_object \
 	drm_prime_pages_to_sg_has_drm_device_arg \
 	drm_driver_has_gem_prime_callbacks \
+	drm_device_has_pdev \
 
 #
 # CFLAGS dependent on the type of builds (e.g. single/muliple module, debug)
diff --git a/conftest.sh b/conftest.sh
index 425a067..07253b5 100755
--- a/conftest.sh
+++ b/conftest.sh
@@ -2471,6 +2471,31 @@ compile_test() {
             compile_check_conftest "$CODE" "NV_DRM_DRIVER_HAS_GEM_PRIME_CALLBACKS" "" "types"
         ;;
 
+        drm_device_has_pdev)
+            #
+            # Determine if the 'drm_device' structure has a 'pdev' field.
+            #
+            # Removed by commit b347e04452ff ("drm: Remove pdev field from
+            # struct drm_device") in v5.14-rc1.
+            #
+            CODE="
+            #if defined(NV_DRM_DRMP_H_PRESENT)
+            #include <drm/drmP.h>
+            #endif
+
+            #if defined(NV_DRM_DRM_DRV_H_PRESENT)
+            #include <drm/drm_drv.h>
+            #endif
+
+            #include <stddef.h>
+
+            int conftest_drm_device_has_pdev(void) {
+                return offsetof(struct drm_device, pdev);
+            }"
+
+            compile_check_conftest "$CODE" "NV_DRM_DEVICE_HAS_PDEV" "" "types"
+        ;;
+
         # When adding a new conftest entry, please use the correct format for
         # specifying the relevant upstream Linux kernel commit.
         #
diff --git a/nv-drm.c b/nv-drm.c
index a4518da..7c1d700 100644
--- a/nv-drm.c
+++ b/nv-drm.c
@@ -244,7 +244,11 @@ static int nv_drm_get_pci_dev(struct pci_dev *pdev,
 	if (ret)
 		goto err_free;
 
+#if defined(NV_DRM_DEVICE_HAS_PDEV)
 	dev->pdev = pdev;
+#else
+	dev->dev_private = pdev;
+#endif
 #ifdef __alpha__
 	dev->hose = pdev->sysdata;
 #endif
@@ -373,7 +377,11 @@ static int nv_drm_load(
 
     for (nvl = nv_linux_devices; nvl != NULL; nvl = nvl->next)
     {
+#if defined(NV_DRM_DEVICE_HAS_PDEV)
         if (nvl->dev == dev->pdev)
+#else
+        if (nvl->dev == dev->dev_private)
+#endif
         {
             nvl->drm = dev;
             return 0;
@@ -397,7 +405,11 @@ static int __nv_drm_unload(
 
     for (nvl = nv_linux_devices; nvl != NULL; nvl = nvl->next)
     {
+#if defined(NV_DRM_DEVICE_HAS_PDEV)
         if (nvl->dev == dev->pdev)
+#else
+        if (nvl->dev == dev->dev_private)
+#endif
         {
             BUG_ON(nvl->drm != dev);
             nvl->drm = NULL;
-- 
2.20.1

Reply via email to