diff -rNau a/Makefile b/Makefile --- a/Makefile 2017-12-04 12:14:36.000000000 +0000 +++ b/Makefile 2018-08-03 03:20:33.377336787 +0000 @@ -129,6 +129,7 @@ efi_enabled \ dom0_kernel_present \ drm_available \ + drm_legacy_available \ proc_create_data \ pde_data \ proc_remove \ @@ -145,7 +146,8 @@ 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 -rNau a/conftest.sh b/conftest.sh --- a/conftest.sh 2017-12-04 12:14:36.000000000 +0000 +++ b/conftest.sh 2018-08-03 03:20:12.013023205 +0000 @@ -1520,6 +1520,23 @@ compile_check_conftest "$CODE" "NV_DRM_AVAILABLE" "" "generic" ;; + drm_legacy_available) + # + # Determine if the DRM subsystem is usable + # + CODE=" + #include + #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE) + void conftest_drm_legacy_available(void) { + (void)drm_legacy_pci_init(); + } + #else + void conftest_drm_legacy_available(void) {} + #endif" + + compile_check_conftest "$CODE" "NV_DRM_LEGACY_AVAILABLE" "" "functions" + ;; + proc_create_data) # # Determine if the proc_create_data() function is present. @@ -1895,6 +1912,18 @@ 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 -rNau a/nv-drm.c b/nv-drm.c --- a/nv-drm.c 2018-08-02 03:28:36.723214195 +0000 +++ b/nv-drm.c 2018-08-03 03:12:14.363259291 +0000 @@ -172,7 +172,9 @@ ) { int ret = 0; -#if defined(NV_DRM_AVAILABLE) +#if defined(NV_DRM_LEGACY_AVAILABLE) + ret = drm_legacy_pci_init(&nv_drm_driver, pci_driver); +#elif defined(NV_DRM_AVAILABLE) ret = drm_pci_init(&nv_drm_driver, pci_driver); #endif return ret; @@ -182,7 +184,9 @@ struct pci_driver *pci_driver ) { -#if defined(NV_DRM_AVAILABLE) +#if defined(NV_DRM_LEGACY_AVAILABLE) + drm_legacy_pci_exit(&nv_drm_driver, pci_driver); +#elif defined(NV_DRM_AVAILABLE) drm_pci_exit(&nv_drm_driver, pci_driver); #endif } diff -rNau a/nv.c b/nv.c --- a/nv.c 2017-12-04 12:14:36.000000000 +0000 +++ b/nv.c 2018-08-02 03:11:42.284373528 +0000 @@ -332,7 +332,11 @@ #else static irqreturn_t nvidia_isr (int, void *); #endif +#ifdef NV_USE_TIMER_SETUP +static void nvidia_rc_timer (struct timer_list *t); +#else static void nvidia_rc_timer (unsigned long); +#endif static int nvidia_ctl_open (struct inode *, struct file *); static int nvidia_ctl_close (struct inode *, struct file *); @@ -1891,10 +1895,18 @@ 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 +2416,13 @@ 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");