dahdi-linux: include linux/uaccess.h rather than asm/uaccess.h 270/head
authorSebastian Kemper <sebastian_ml@gmx.net>
Mon, 12 Feb 2018 20:57:04 +0000 (21:57 +0100)
committerSebastian Kemper <sebastian_ml@gmx.net>
Mon, 12 Feb 2018 20:57:06 +0000 (21:57 +0100)
Starting with 4.12 there are module build errors due to the
arch-specific uaccess.h using a macro defined in the generic include.
The generic include has been around since 2.6.18 and has always included
asm/uaccess.h, so switch to using the generic include for all kernels
which have it.

Example build failure:

    CC [M]  /data/bowl-builder/mips64_octeon/build/sdk/build_dir/target-mips64_octeon_64_musl/linux-octeon/dahdi-linux-2.11.1-20180111/drivers/dahdi/wcb4xxp/base.o
  In file included from ../dahdi-linux-2.11.1-20180111/drivers/dahdi/wcb4xxp/base.c:38:0:
  ./arch/mips/include/asm/uaccess.h: In function 'eva_kernel_access':
  ./arch/mips/include/asm/uaccess.h:91:9: error: implicit declaration of function 'uaccess_kernel' [-Werror=implicit-function-declaration]
    return uaccess_kernel();
           ^
  cc1: some warnings being treated as errors

The same can currently be seen on arc_archs where also kernel 4.14.18 is
used.

The patch just follows what Ubuntu's Seth Forshee suggested for openafs,
which ran into the same problem. The commit message is largely just
copied from Seth's commit message as well :)

The issue has been reported to upstream here:

https://issues.asterisk.org/jira/browse/DAHLIN-360

The same patch has been uploaded there.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
libs/dahdi-linux/patches/110-fix-uaccess_h-include.patch [new file with mode: 0644]

diff --git a/libs/dahdi-linux/patches/110-fix-uaccess_h-include.patch b/libs/dahdi-linux/patches/110-fix-uaccess_h-include.patch
new file mode 100644 (file)
index 0000000..5357fa7
--- /dev/null
@@ -0,0 +1,77 @@
+--- a/drivers/dahdi/datamods/syncppp.c
++++ b/drivers/dahdi/datamods/syncppp.c
+@@ -39,6 +39,7 @@
+ #include <linux/config.h>
+ #include <linux/module.h>
++#include <linux/version.h>
+ #include <linux/kernel.h>
+ #include <linux/errno.h>
+ #include <linux/init.h>
+@@ -56,7 +57,11 @@
+ #include <net/syncppp.h>
+ #include <asm/byteorder.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+ #include <asm/uaccess.h>
++#else
++#include <linux/uaccess.h>
++#endif
+ #define MAXALIVECNT     6               /* max. alive packets */
+--- a/drivers/dahdi/wcb4xxp/base.c
++++ b/drivers/dahdi/wcb4xxp/base.c
+@@ -22,6 +22,7 @@
+ #include <linux/init.h>
++#include <linux/version.h>
+ #include <linux/kernel.h>     /* printk() */
+ #include <linux/errno.h>      /* error codes */
+ #include <linux/module.h>
+@@ -35,7 +36,11 @@
+ #include <linux/spinlock.h>
+ #include <linux/device.h>     /* dev_err() */
+ #include <linux/interrupt.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+ #include <asm/uaccess.h>      /* copy_*_user */
++#else
++#include <linux/uaccess.h>
++#endif
+ #include <linux/workqueue.h>  /* work_struct */
+ #include <linux/timer.h>      /* timer_struct */
+ #include <linux/moduleparam.h>
+--- a/drivers/dahdi/xpp/mmapdrv.c
++++ b/drivers/dahdi/xpp/mmapdrv.c
+@@ -1,3 +1,4 @@
++#include <linux/version.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/delay.h>
+@@ -10,7 +11,11 @@
+ #include <asm/blackfin.h>
+ #include <asm/dma.h>
+ #include <asm/cacheflush.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+ #include <asm/uaccess.h>
++#else
++#include <linux/uaccess.h>
++#endif
+ #include <dahdi/kernel.h>
+ #include "mmapbus.h"
+ #include "xbus-core.h"
+--- a/drivers/dahdi/xpp/xpp_usb.c
++++ b/drivers/dahdi/xpp/xpp_usb.c
+@@ -27,7 +27,11 @@
+ #include <linux/interrupt.h>
+ #include <linux/delay.h>      /* for udelay */
+ #include <linux/seq_file.h>
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+ #include <asm/uaccess.h>
++#else
++#include <linux/uaccess.h>
++#endif
+ #include <asm/atomic.h>
+ #include <asm/timex.h>
+ #include <linux/proc_fs.h>