File 0003-nvidia-drm-pci-init-4.14.patch of Package x11-video-nvidiaG02

--- a/nv-drm.c
+++ b/nv-drm.c
@@ -22,6 +22,8 @@
 #include <drm/drm_gem.h>
 #endif
 
+#include <linux/version.h>
+
 extern nv_linux_state_t *nv_linux_devices;
 
 static int nv_drm_load(
@@ -121,7 +123,11 @@
 {
     int ret = 0;
 #if defined(NV_DRM_AVAILABLE)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
     ret = drm_pci_init(&nv_drm_driver, pci_driver);
+#else
+    ret = drm_legacy_pci_init(&nv_drm_driver, pci_driver);
+#endif
 #endif
     return ret;
 }
@@ -131,6 +137,10 @@
 )
 {
 #if defined(NV_DRM_AVAILABLE)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)
     drm_pci_exit(&nv_drm_driver, pci_driver);
+#else
+    drm_legacy_pci_exit(&nv_drm_driver, pci_driver);
+#endif
 #endif
 }
openSUSE Build Service is sponsored by