From 98175155e120f21e69896ff99426ef491375c531 Mon Sep 17 00:00:00 2001 From: Seth Forshee Date: Thu, 14 Dec 2017 09:04:41 -0600 Subject: [PATCH] Build fixes for Linux 4.15 --- Makefile | 3 ++- conftest.sh | 12 ++++++++++++ nv.c | 13 ++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 75c73b94ea19..0b687c16c9d9 100644 --- a/Makefile +++ b/Makefile @@ -145,7 +145,8 @@ COMPILE_TESTS = \ cpuhp_setup_state \ vm_fault_present \ vm_fault_has_address \ - drm_driver_unload_has_int_return_type + drm_driver_unload_has_int_return_type \ + use_timer_setup # # CFLAGS dependent on the type of builds (e.g. single/muliple module, debug) # diff --git a/conftest.sh b/conftest.sh index ca1ddba43de8..22fe2994d433 100755 --- a/conftest.sh +++ b/conftest.sh @@ -1895,6 +1895,18 @@ compile_test() { compile_check_conftest "$CODE" "NV_DRM_DRIVER_UNLOAD_HAS_INT_RETURN_TYPE" "" "types" ;; + use_timer_setup) + # + # Determine if timer_setup() must be used instead of init_timer(). + # + CODE=" + #include + void conftest_use_timer_setup() { + timer_setup(); + }" + + compile_check_conftest "$CODE" "NV_USE_TIMER_SETUP" "" "functions" + ;; esac } diff --git a/nv.c b/nv.c index 829c4a7e7625..adbd568b7743 100644 --- a/nv.c +++ b/nv.c @@ -332,7 +332,6 @@ static irqreturn_t nvidia_isr (int, void *, struct pt_regs *); #else static irqreturn_t nvidia_isr (int, void *); #endif -static void nvidia_rc_timer (unsigned long); static int nvidia_ctl_open (struct inode *, struct file *); static int nvidia_ctl_close (struct inode *, struct file *); @@ -1891,10 +1890,18 @@ nvidia_isr_bh( static void nvidia_rc_timer( +#ifdef NV_USE_TIMER_SETUP + struct timer_list *t +#else unsigned long data +#endif ) { +#ifdef NV_USE_TIMER_SETUP + nv_linux_state_t *nvl = from_timer(nvl, t, rc_timer); +#else nv_linux_state_t *nvl = (nv_linux_state_t *) data; +#endif nv_state_t *nv = NV_STATE_PTR(nvl); NV_CHECK_PCI_CONFIG_SPACE(nvl->timer_sp, nv, TRUE, TRUE, FALSE); @@ -2404,9 +2411,13 @@ int NV_API_CALL nv_start_rc_timer( return -1; nv_printf(NV_DBG_INFO, "NVRM: initializing rc timer\n"); +#ifdef NV_USE_TIMER_SETUP + timer_setup(&nvl->rc_timer, nvidia_rc_timer, 0); +#else init_timer(&nvl->rc_timer); nvl->rc_timer.function = nvidia_rc_timer; nvl->rc_timer.data = (unsigned long) nvl; +#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"); -- 2.14.1