370.23 - incompatible-pointer-types with nvidia_drm_gem_prime_soft_fence_event on 32bit with 4.6.7+

Currently it seems we face this issue with the latest beta driver and kernel 4.6.7+ on 32 bit …

/home/phil/dev/git/manjaro/repositories/extra/linux46-extramodules/nvidia/src/NVIDIA-Linux-x86-370.23/kernel/nvidia-drm/nvidia-drm-fence.c: In function 'nvidia_drm_gem_prime_create_soft_fence_event':
/home/phil/dev/git/manjaro/repositories/extra/linux46-extramodules/nvidia/src/NVIDIA-Linux-x86-370.23/kernel/nvidia-drm/nvidia-drm-fence.c:414:37: error: passing argument 2 of 'nvKms->allocateChannelEvent' from incompatible pointer type [-Werror=incompatible-pointer-types]
                                     nvidia_drm_gem_prime_soft_fence_event,
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/phil/dev/git/manjaro/repositories/extra/linux46-extramodules/nvidia/src/NVIDIA-Linux-x86-370.23/kernel/nvidia-drm/nvidia-drm-fence.c:414:37: note: expected 'void (__attribute__((regparm(0))) *)(void *, NvU32)' but argument is of type 'void (*)(void *, NvU32) {aka void (*)(void *, unsigned int)}'
  LD [M]  /home/phil/dev/git/manjaro/repositories/extra/linux46-extramodules/nvidia/src/NVIDIA-Linux-x86-370.23/kernel/nvidia-modeset.o
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:291: /home/phil/dev/git/manjaro/repositories/extra/linux46-extramodules/nvidia/src/NVIDIA-Linux-x86-370.23/kernel/nvidia-drm/nvidia-drm-fence.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:1429: _module_/home/phil/dev/git/manjaro/repositories/extra/linux46-extramodules/nvidia/src/NVIDIA-Linux-x86-370.23/kernel] Error 2
make[1]: Leaving directory '/usr/lib/modules/4.6.7-1-MANJARO/build'
make: *** [Makefile:81: modules] Error 2

The error still exists, however you can compile it with GCC v4.9 series. Seems GCC 6.1.1 forces it to be an error.

Unsurprisingly the same issue manifested itself on i686 Arch Linux.

https://bugs.archlinux.org/task/50503

4.7.1-1-ARCH and 4.7.2-1-ARCH with the NVIDIA-Linux-x86-370.23 driver are affected

This should be right:

diff -u -r kernel/nvidia-drm/nvidia-drm-fence.c kernel-patched/nvidia-drm/nvidia-drm-fence.c
--- kernel/nvidia-drm/nvidia-drm-fence.c	2016-08-09 01:43:19.000000000 +0200
+++ kernel-patched/nvidia-drm/nvidia-drm-fence.c	2016-08-25 14:31:34.419655564 +0200
@@ -325,7 +325,7 @@
     struct nvidia_drm_gem_object *nv_gem;
 };
 
-static void nvidia_drm_gem_prime_soft_fence_event
+static void NVKMS_KAPI_CALL nvidia_drm_gem_prime_soft_fence_event
 (
     void *dataPtr,
     NvU32 dataU32

Thanks for reporting this.

That exact above fix will be in the stable release, but you can apply it as suggested if you need to use 370.23 on x86 in the meantime.

Bypassing the warning is inadvisable if you are using PRIME Synchronization, exercising this path, as it could cause some strange bugs from incorrect calling conventions.