NVidia driver 418.67 installation on kernel 5.1.9-1.el7 fail: implicit declaration of function ‘drm_kms_helper_poll_init’

Hello
I’ve tried to install driver 418.67-4 from http://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/ on my Centos 7 with kernel 5.1.9-1.el7.elrepo.x86_64. The driver is built and installed by DKMS system.

During the building process DKMS fails with:

$ sudo dkms autoinstall

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
'make' -j2 module SYSSRC=/lib/modules/5.1.9-1.el7.elrepo.x86_64/build IGNORE_XEN_PRESENCE=1 IGNORE_PREEMPT_RT_PRESENCE=1 IGNORE_CC_MISMATCH=1....................(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.1.9-1.el7.elrepo.x86_64 (x86_64)
Consult /var/lib/dkms/nvidia/418.67/build/make.log for more information.

In that make.log there’s a gcc error:

implicit declaration of function ‘drm_kms_helper_poll_init’

That can be easily fixed by adding:

#include <drm/drm_probe_helper.h>

to:

  • /usr/src/nvidia-418.67/nvidia-drm/nvidia-drm-drv.c
  • /usr/src/nvidia-418.67/nvidia-drm/nvidia-drm-encoder.c
  • /usr/src/nvidia-418.67/nvidia-drm/nvidia-drm-connector.c

Can NVidia Team please add that missing #include to above files and release it?

Similar issue was reported here: https://devtalk.nvidia.com/default/topic/1048342/linux/-fix-driver-418-43-with-kernel-5/