Driver 390.67 not compiling in kernel 4.18-rc2

This is from xubuntu 18.04

In file included from ./include/drm/drmP.h:82:0,
from /var/lib/dkms/nvidia/390.67/build/nvidia-drm/nvidia-drm-priv.h:30,
from /var/lib/dkms/nvidia/390.67/build/nvidia-drm/nvidia-drm-drv.c:25:
/var/lib/dkms/nvidia/390.67/build/nvidia-drm/nvidia-drm-drv.c:637:23: error: ‘DRM_CONTROL_ALLOW’ undeclared here (not in a function); did you mean ‘DRM_RENDER_ALLOW’?
DRM_CONTROL_ALLOW|DRM_UNLOCKED),
^
./include/drm/drm_ioctl.h:162:12: note: in definition of macro ‘DRM_IOCTL_DEF_DRV’
.flags = _flags,
^~~~~~
scripts/Makefile.build:317: recipe for target ‘/var/lib/dkms/nvidia/390.67/build/nvidia-drm/nvidia-drm-drv.o’ failed
make[2]: *** [/var/lib/dkms/nvidia/390.67/build/nvidia-drm/nvidia-drm-drv.o] Error 1
make[2]: *** Waiting for unfinished jobs…
Makefile:1505: recipe for target ‘module/var/lib/dkms/nvidia/390.67/build’ failed
make[1]: *** [module/var/lib/dkms/nvidia/390.67/build] Error 2
make[1]: Leaving directory ‘/usr/src/linux-headers-4.18.0-041800rc2-generic’
Makefile:79: recipe for target ‘modules’ failed
make: *** [modules] Error 2

When that is fixed by removing DRM_CONTROL_ALLOW in /var/lib/dkms/nvidia/390.67/build/nvidia-drm/nvidia-drm-drv.c fix from http://mom.hlmjr.com/2018/06/11/nvidia-drivers-390-67-vs-kernel-4-17/

We get this error
make -f ./scripts/Makefile.modpost
find /var/lib/dkms/nvidia/390.67/build/.tmp_versions -name ‘*.mod’ | xargs -r grep -h ‘.ko$’ | sort -u | sed ‘s/.ko$/.o/’ | scripts/mod/modpost -a -i ./Module.symvers -I /var/lib/dkms/nvidia/390.67/build/Module.symvers -o /var/lib/dkms/nvidia/390.67/build/Module.symvers -S -w -s -T -
FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol ‘__put_devmap_managed_page’
scripts/Makefile.modpost:92: recipe for target ‘__modpost’ failed
make[2]: *** [__modpost] Error 1
Makefile:1508: recipe for target ‘modules’ failed
make[1]: *** [modules] Error 2
make[1]: Leaving directory ‘/usr/src/linux-headers-4.18.0-041800rc2-generic’
Makefile:79: recipe for target ‘modules’ failed
make: *** [modules] Error 2

The link to the patch seems to be dead. Here’s the link from the wayback machine – https://web.archive.org/web/20180628055740/mom.hlmjr.com/2018/06/11/nvidia-drivers-390-67-vs-kernel-4-17/

diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
index 9a8f9f6..22ec88b 100644
--- a/kernel/nvidia-drm/nvidia-drm-drv.c
+++ b/kernel/nvidia-drm/nvidia-drm-drv.c
@@ -634,26 +634,26 @@ static const struct drm_ioctl_desc nv_drm_ioctls[] = {
 #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
     DRM_IOCTL_DEF_DRV(NVIDIA_GEM_IMPORT_NVKMS_MEMORY,
                       nv_drm_gem_import_nvkms_memory_ioctl,
-                      DRM_CONTROL_ALLOW|DRM_UNLOCKED),
+                      DRM_UNLOCKED),
 #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
 
     DRM_IOCTL_DEF_DRV(NVIDIA_GEM_IMPORT_USERSPACE_MEMORY,
                       nv_drm_gem_import_userspace_memory_ioctl,
-                      DRM_CONTROL_ALLOW|DRM_RENDER_ALLOW|DRM_UNLOCKED),
+                      DRM_RENDER_ALLOW|DRM_UNLOCKED),
     DRM_IOCTL_DEF_DRV(NVIDIA_GET_DEV_INFO,
                       nv_drm_get_dev_info_ioctl,
-                      DRM_CONTROL_ALLOW|DRM_RENDER_ALLOW|DRM_UNLOCKED),
+                      DRM_RENDER_ALLOW|DRM_UNLOCKED),
 
 #if defined(NV_DRM_DRIVER_HAS_GEM_PRIME_RES_OBJ)
     DRM_IOCTL_DEF_DRV(NVIDIA_FENCE_SUPPORTED,
                       nv_drm_fence_supported_ioctl,
-                      DRM_CONTROL_ALLOW|DRM_RENDER_ALLOW|DRM_UNLOCKED),
+                      DRM_RENDER_ALLOW|DRM_UNLOCKED),
     DRM_IOCTL_DEF_DRV(NVIDIA_FENCE_CONTEXT_CREATE,
                       nv_drm_fence_context_create_ioctl,
-                      DRM_CONTROL_ALLOW|DRM_RENDER_ALLOW|DRM_UNLOCKED),
+                      DRM_RENDER_ALLOW|DRM_UNLOCKED),
     DRM_IOCTL_DEF_DRV(NVIDIA_GEM_FENCE_ATTACH,
                       nv_drm_gem_fence_attach_ioctl,
-                      DRM_CONTROL_ALLOW|DRM_RENDER_ALLOW|DRM_UNLOCKED),
+                      DRM_RENDER_ALLOW|DRM_UNLOCKED),
 #endif
 
     DRM_IOCTL_DEF_DRV(NVIDIA_GET_CLIENT_CAPABILITY,
@@ -662,7 +662,7 @@ static const struct drm_ioctl_desc nv_drm_ioctls[] = {
 #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
     DRM_IOCTL_DEF_DRV(NVIDIA_GET_CRTC_CRC32,
                       nv_drm_get_crtc_crc32_ioctl,
-                      DRM_CONTROL_ALLOW|DRM_RENDER_ALLOW|DRM_UNLOCKED),
+                      DRM_RENDER_ALLOW|DRM_UNLOCKED),
 #endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
 };