]> git.pld-linux.org Git - packages/xorg-driver-video-nvidia-legacy-304xx.git/blob - kernel-4.15.patch
- build fix for kernel 4.15 from Debian
[packages/xorg-driver-video-nvidia-legacy-304xx.git] / kernel-4.15.patch
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.
5 --- a/kernel/nv.c
6 +++ b/kernel/nv.c
7 @@ -17,6 +17,8 @@
8  #include "rmil.h"
9  #include "nv-pat.h"
10  
11 +#include <linux/version.h>
12 +
13  #if defined(MODULE_LICENSE)
14  MODULE_LICENSE("NVIDIA");
15  #endif
16 @@ -301,7 +303,11 @@
17  #else
18  irqreturn_t   nv_kern_isr(int, void *);
19  #endif
20 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
21  void          nv_kern_rc_timer(unsigned long);
22 +#else
23 +void          nv_kern_rc_timer(struct timer_list *);
24 +#endif
25  #if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
26  static int    nv_kern_apm_event(struct pm_dev *, pm_request_t, void *);
27  #endif
28 @@ -2075,10 +2081,18 @@
29  }
30  
31  void nv_kern_rc_timer(
32 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
33      unsigned long data
34 +#else
35 +    struct timer_list *t_list
36 +#endif
37  )
38  {
39 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
40      nv_linux_state_t *nvl = (nv_linux_state_t *) data;
41 +#else
42 +    nv_linux_state_t *nvl = from_timer(nvl, t_list, rc_timer);
43 +#endif
44      nv_state_t *nv = NV_STATE_PTR(nvl);
45  
46      NV_CHECK_PCI_CONFIG_SPACE(nvl->timer_sp, nv, TRUE, TRUE, FALSE);
47 @@ -3029,9 +3043,13 @@
48          return -1;
49  
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;
55 +#else
56 +    timer_setup(&nvl->rc_timer, nv_kern_rc_timer, 0);
57 +#endif
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");
This page took 0.057458 seconds and 3 git commands to generate.