File 0004-timer-4.15.patch of Package x11-video-nvidiaG02

--- a/nv.c
+++ b/nv.c
@@ -17,6 +17,8 @@
 #include "rmil.h"
 #include "nv-pat.h"
 
+#include <linux/version.h>
+
 #if defined(MODULE_LICENSE)
 MODULE_LICENSE("NVIDIA");
 #endif
@@ -301,7 +303,11 @@
 #else
 irqreturn_t   nv_kern_isr(int, void *);
 #endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
 void          nv_kern_rc_timer(unsigned long);
+#else
+void          nv_kern_rc_timer(struct timer_list *);
+#endif
 #if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
 static int    nv_kern_apm_event(struct pm_dev *, pm_request_t, void *);
 #endif
@@ -2075,10 +2081,18 @@
 }
 
 void nv_kern_rc_timer(
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
     unsigned long data
+#else
+    struct timer_list *t_list
+#endif
 )
 {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
     nv_linux_state_t *nvl = (nv_linux_state_t *) data;
+#else
+    nv_linux_state_t *nvl = from_timer(nvl, t_list, rc_timer);
+#endif
     nv_state_t *nv = NV_STATE_PTR(nvl);
 
     NV_CHECK_PCI_CONFIG_SPACE(nvl->timer_sp, nv, TRUE, TRUE, FALSE);
@@ -3029,9 +3043,13 @@
         return -1;
 
     nv_printf(NV_DBG_INFO, "NVRM: initializing rc timer\n");
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
     init_timer(&nvl->rc_timer);
     nvl->rc_timer.function = nv_kern_rc_timer;
     nvl->rc_timer.data = (unsigned long) nv;
+#else
+    timer_setup(&nvl->rc_timer, nv_kern_rc_timer, 0);
+#endif
     nv->rc_timer_enabled = 1;
     mod_timer(&nvl->rc_timer, jiffies + HZ); /* set our timeout for 1 second */
     nv_printf(NV_DBG_INFO, "NVRM: rc timer initialized\n");
openSUSE Build Service is sponsored by