matrix-io / matrixio-kernel-modules

MATRIX HAL in kernel space
22 stars 23 forks source link

Remove unused <asm/uaccess.h> header #50

Closed HinTak closed 3 years ago

HinTak commented 3 years ago

<asm/uaccess.h> is not actually used, and causes problem on x86_64. Note that src/matrixio-pwm.c is not actually compiled into the kernel module, and is unused; modifying for completeness only.

The error message looks like this:

In file included from matrixio-kernel-modules/src/matrixio-gpio.c:1: ./arch/x86/include/asm/uaccess.h:29:27: error: unknown type name ‘mm_segment_t’ 29 | static inline void set_fs(mm_segment_t fs) | ^~~~ In file included from ./arch/x86/include/asm/uaccess.h:7, from matrixio-kernel-modules/src/matrixio-gpio.c:1: ./arch/x86/include/asm/uaccess.h: In function ‘user_access_begin’: ./arch/x86/include/asm/uaccess.h:37:26: error: ‘current’ undeclared (first use in this function) 37 | #define user_addr_max() (current->thread.addr_limit.seg) | ^~~ ./include/linux/compiler.h:78:42: note: in definition of macro ‘unlikely’ 78 | # define unlikely(x) builtin_expect(!!(x), 0) | ^ ./arch/x86/include/asm/uaccess.h:96:2: note: in expansion of macro ‘likely’ 96 | likely(!range_not_ok(addr, size, user_addr_max())); \ | ^~ ./arch/x86/include/asm/uaccess.h:96:10: note: in expansion of macro ‘range_not_ok’ 96 | likely(!range_not_ok(addr, size, user_addr_max())); \ | ^~~~~~ ./arch/x86/include/asm/uaccess.h:96:37: note: in expansion of macro ‘user_addr_max’ 96 | likely(!range_not_ok(addr, size, user_addr_max())); \ | ^~~~~ ./arch/x86/include/asm/uaccess.h:483:16: note: in expansion of macro ‘access_ok’ 483 | if (unlikely(!access_ok(ptr,len))) | ^~~~~ ./arch/x86/include/asm/uaccess.h:37:26: note: each undeclared identifier is reported only once for each function it appears in 37 | #define user_addr_max() (current->thread.addr_limit.seg) | ^~~ ./include/linux/compiler.h:78:42: note: in definition of macro ‘unlikely’ 78 | # define unlikely(x) builtin_expect(!!(x), 0) | ^ ./arch/x86/include/asm/uaccess.h:96:2: note: in expansion of macro ‘likely’ 96 | likely(!range_not_ok(addr, size, user_addr_max())); \ | ^~ ./arch/x86/include/asm/uaccess.h:96:10: note: in expansion of macro ‘range_not_ok’ 96 | likely(!range_not_ok(addr, size, user_addr_max())); \ | ^~~~~~ ./arch/x86/include/asm/uaccess.h:96:37: note: in expansion of macro ‘user_addr_max’ 96 | likely(!range_not_ok(addr, size, user_addr_max())); \ | ^~~~~ ./arch/x86/include/asm/uaccess.h:483:16: note: in expansion of macro ‘access_ok’ 483 | if (unlikely(!access_ok(ptr,len))) | ^~~~~ make[2]: *** [scripts/Makefile.build:281: matrixio-kernel-modules/src/matrixio-gpio.o] Error 1

HinTak commented 3 years ago

Compiled okay against ubuntu 20.04.1 on the Pi 4 with 5.4.0-1022-raspi aarch64 headers.