1 Author: Luca Boccassi <bluca@debian.org>
2 Description: Fix timer API calls for kernel >= 4.15
3 From kernel 4.15 and newer (commit 7eeb6b893bd28c) the init_timer APIs have
4 been retired and replaced by new timer_list APIs.
11 +#include <linux/version.h>
13 #if defined(MODULE_LICENSE)
14 MODULE_LICENSE("NVIDIA");
18 irqreturn_t nv_kern_isr(int, void *);
20 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
21 void nv_kern_rc_timer(unsigned long);
23 +void nv_kern_rc_timer(struct timer_list *);
25 #if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
26 static int nv_kern_apm_event(struct pm_dev *, pm_request_t, void *);
28 @@ -2075,10 +2081,18 @@
31 void nv_kern_rc_timer(
32 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
35 + struct timer_list *t_list
39 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
40 nv_linux_state_t *nvl = (nv_linux_state_t *) data;
42 + nv_linux_state_t *nvl = from_timer(nvl, t_list, rc_timer);
44 nv_state_t *nv = NV_STATE_PTR(nvl);
46 NV_CHECK_PCI_CONFIG_SPACE(nvl->timer_sp, nv, TRUE, TRUE, FALSE);
47 @@ -3029,9 +3043,13 @@
50 nv_printf(NV_DBG_INFO, "NVRM: initializing rc timer\n");
51 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
52 init_timer(&nvl->rc_timer);
53 nvl->rc_timer.function = nv_kern_rc_timer;
54 nvl->rc_timer.data = (unsigned long) nv;
56 + timer_setup(&nvl->rc_timer, nv_kern_rc_timer, 0);
58 nv->rc_timer_enabled = 1;
59 mod_timer(&nvl->rc_timer, jiffies + HZ); /* set our timeout for 1 second */
60 nv_printf(NV_DBG_INFO, "NVRM: rc timer initialized\n");