From 86a86e4d41c5beea8f41a1434fab940a5ce4615d Mon Sep 17 00:00:00 2001 From: Helmut Pozimski Date: Tue, 5 Mar 2019 23:10:01 +0100 Subject: [PATCH] nvidia340: add patch to fix building with linux-5.0 --- srcpkgs/nvidia340/files/kernel-5.0.patch | 45 ++++++++++++++++++++++++ srcpkgs/nvidia340/template | 3 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/nvidia340/files/kernel-5.0.patch diff --git a/srcpkgs/nvidia340/files/kernel-5.0.patch b/srcpkgs/nvidia340/files/kernel-5.0.patch new file mode 100644 index 00000000000..01650dbfd79 --- /dev/null +++ b/srcpkgs/nvidia340/files/kernel-5.0.patch @@ -0,0 +1,45 @@ +--- kernel/os-interface.c 2019-03-05 22:53:13.298064826 +0100 ++++ kernel/os-interface.c 2019-03-05 23:04:09.064902532 +0100 +@@ -14,6 +14,19 @@ + #include "os-interface.h" + #include "nv-linux.h" + ++#include ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0) ++static inline void do_gettimeofday(struct timeval *tv) { ++ struct timespec64 now; ++ ++ ktime_get_real_ts64(&now); ++ tv->tv_sec = now.tv_sec; ++ tv->tv_usec = now.tv_nsec/1000; ++} ++#endif ++ ++ + RM_STATUS NV_API_CALL os_disable_console_access(void) + { + NV_ACQUIRE_CONSOLE_SEM(); +--- kernel/nv-drm.c 2019-03-05 22:37:07.015611635 +0100 ++++ kernel/nv-drm.c 2019-03-05 22:54:46.448761250 +0100 +@@ -13,6 +13,7 @@ + #include "nv-misc.h" + #include "os-interface.h" + #include "nv-linux.h" ++#include + + #if defined(NV_DRM_AVAILABLE) + +@@ -251,8 +252,11 @@ + status = RM_ERR_OPERATING_SYSTEM; + goto done; + } +- ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) + drm_gem_object_unreference_unlocked(&nv_obj->base); ++#else ++ drm_gem_object_put_unlocked(&nv_obj->base); ++#endif + + status = RM_OK; + diff --git a/srcpkgs/nvidia340/template b/srcpkgs/nvidia340/template index 1d1dd2f0a95..28b80f39034 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.107 -revision=1 +revision=2 maintainer="Juan RP " license="Proprietary NVIDIA license" homepage="http://www.nvidia.com" @@ -41,6 +41,7 @@ do_extract() { do_configure() { cd ${_pkg} patch -p0 < ${FILESDIR}/kernel-4.11.patch + patch -p0 < ${FILESDIR}/kernel-5.0.patch } do_install() {