From 6f492d440ab12c76f64e7209eaac052f9cf11fda Mon Sep 17 00:00:00 2001 From: Helmut Pozimski Date: Sat, 27 May 2017 12:02:58 +0200 Subject: [PATCH] nvidia340: fix building with linux-4.11 patch via pld-linux/xorg-driver-video-nvidia-legacy-340xx --- srcpkgs/nvidia340/files/linux-4.11.patch | 108 +++++++++++++++++++++++ srcpkgs/nvidia340/template | 3 +- 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/nvidia340/files/linux-4.11.patch diff --git a/srcpkgs/nvidia340/files/linux-4.11.patch b/srcpkgs/nvidia340/files/linux-4.11.patch new file mode 100644 index 0000000000..f533f08e51 --- /dev/null +++ b/srcpkgs/nvidia340/files/linux-4.11.patch @@ -0,0 +1,108 @@ +--- kernel/nv-drm.c 2017-03-31 03:42:21.000000000 +0200 ++++ kernel/nv-drm.c 2017-04-06 23:53:14.273356795 +0200 +@@ -48,7 +48,11 @@ + return -ENODEV; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + static int nv_drm_unload( ++#else ++static void nv_drm_unload( ++#endif + struct drm_device *dev + ) + { +@@ -60,7 +60,11 @@ + { + BUG_ON(nvl->drm != dev); + nvl->drm = NULL; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + return 0; ++#else ++ return; ++#endif + } + } + +@@ -64,7 +64,11 @@ + } + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + return -ENODEV; ++#else ++ return; ++#endif + } + + static void nv_gem_free( +--- kernel/uvm/nvidia_uvm_linux.h 2017-03-31 03:42:21.000000000 +0200 ++++ kernel/uvm/nvidia_uvm_linux.h 2017-04-06 23:53:14.273356795 +0200 +@@ -124,6 +124,9 @@ + #include /* mdelay, udelay */ + + #include /* suser(), capable() replacement */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) ++#include ++#endif + #include /* module_param() */ + #if !defined(NV_VMWARE) + #include /* flush_tlb(), flush_tlb_all() */ +@@ -362,17 +363,19 @@ + void address_space_init_once(struct address_space *mapping); + #endif + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + #if !defined(NV_FATAL_SIGNAL_PENDING_PRESENT) + static inline int __fatal_signal_pending(struct task_struct *p) + { + return unlikely(sigismember(&p->pending.signal, SIGKILL)); + } + + static inline int fatal_signal_pending(struct task_struct *p) + { + return signal_pending(p) && __fatal_signal_pending(p); + } + #endif ++#endif + + // + // Before the current->cred structure was introduced, current->euid, +--- kernel/uvm/nvidia_uvm_lite.c 2017-03-31 03:42:21.000000000 +0200 ++++ kernel/uvm/nvidia_uvm_lite.c 2017-04-06 23:53:14.273356795 +0200 +@@ -818,7 +818,11 @@ + } + + #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + int _fault(struct vm_area_struct *vma, struct vm_fault *vmf) ++#else ++int _fault(struct vm_fault *vmf) ++#endif + { + unsigned long vaddr = (unsigned long)vmf->virtual_address; + struct page *page = NULL; +@@ -828,7 +828,11 @@ + struct page *page = NULL; + int retval; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + retval = _fault_common(vma, vaddr, &page, vmf->flags); ++#else ++ retval = _fault_common(NULL, vaddr, &page, vmf->flags); ++#endif + + vmf->page = page; + +@@ -866,7 +866,11 @@ + // it's dealing with anonymous mapping (see handle_pte_fault). + // + #if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ++#else ++int _sigbus_fault(struct vm_fault *vmf) ++#endif + { + vmf->page = NULL; + return VM_FAULT_SIGBUS; diff --git a/srcpkgs/nvidia340/template b/srcpkgs/nvidia340/template index f0cb52bb88..b8c3089d2c 100644 --- a/srcpkgs/nvidia340/template +++ b/srcpkgs/nvidia340/template @@ -4,7 +4,7 @@ _desc="NVIDIA drivers (GeForce 8, 9, 9M, 100, 100M, 200, 300 series)" pkgname=nvidia340 version=340.102 -revision=3 +revision=4 maintainer="Juan RP " license="Proprietary NVIDIA license" homepage="http://www.nvidia.com" @@ -42,6 +42,7 @@ do_configure() { cd ${_pkg} patch -p0 < ${FILESDIR}/patch_nv1.diff patch -p0 < ${FILESDIR}/4.10.0_kernel.patch + patch -p0 < ${FILESDIR}/linux-4.11.patch } do_install() {