LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File kernel-4.6.patch of Package dkms-nvidia (Project home:Bumblebee-Project:nVidia:304.135)

diff -urN nv-linux.h.orig nv-linux.h
--- nv-linux.h.orig	2015-11-09 06:44:13.000000000 +0100
+++ nv-linux.h	2016-05-27 10:34:30.000000000 +0200
@@ -254,6 +254,16 @@
 #include <linux/seq_file.h>
 #endif
 
+/*
+ * As of version 304.131, os-agp.c and os-mtrr.c still use deprecated
+ * kernel APIs for mtrr which are no longer exported since 4.3, causing
+ * the module to error out when loaded.
+ */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
+#undef CONFIG_MTRR
+#endif
+
+
 #if !defined(NV_VMWARE) && defined(CONFIG_MTRR)
 #include <asm/mtrr.h>
 #endif
diff -urN nv-mlock.c.orig nv-mlock.c
--- nv-mlock.c.orig	2015-11-09 06:44:13.000000000 +0100
+++ nv-mlock.c	2016-05-27 10:34:30.000000000 +0200
@@ -49,8 +49,13 @@
     }
 
     down_read(&mm->mmap_sem);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
     ret = get_user_pages(current, mm, (unsigned long)address,
             page_count, write, force, user_pages, NULL);
+#else
+    ret = get_user_pages_remote(current, mm, (unsigned long)address,
+            page_count, write, force, user_pages, NULL);
+#endif
     up_read(&mm->mmap_sem);
     pinned = ret;
 
@@ -62,7 +67,11 @@
     else if (pinned < page_count)
     {
         for (i = 0; i < pinned; i++)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
             page_cache_release(user_pages[i]);
+#else
+            put_page(user_pages[i]);
+#endif
         os_free_mem(user_pages);
         return RM_ERR_INVALID_ADDRESS;
     }
@@ -80,7 +89,11 @@
             {
                 pci_unmap_page(dev, pte_array[j],
                         PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
-                page_cache_release(user_pages[j]);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
+            page_cache_release(user_pages[j]);
+#else
+            put_page(user_pages[j]);
+#endif
             }
             os_free_mem(user_pages);
             return RM_ERR_OPERATING_SYSTEM;
@@ -114,7 +127,11 @@
                 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
         if (write)
             set_page_dirty_lock(user_pages[i]);
-        page_cache_release(user_pages[i]);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
+            page_cache_release(user_pages[i]);
+#else
+            put_page(user_pages[i]);
+#endif
     }
 
     os_free_mem(user_pages);