Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/mm: define types using typedef in pkey-helpers.h

Using #define to define types should be avoided. Use typedef instead.
Also ensure that __u* types are actually defined by including
<linux/types.h>.

Link: https://lkml.kernel.org/r/20241209095019.1732120-8-kevin.brodsky@arm.com
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: Aruna Ramakrishna <aruna.ramakrishna@oracle.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Joey Gouly <joey.gouly@arm.com>
Cc: Keith Lucas <keith.lucas@oracle.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Kevin Brodsky and committed by
Andrew Morton
f7ed8331 31fdc965

+6 -4
+6 -4
tools/testing/selftests/mm/pkey-helpers.h
··· 13 13 #include <ucontext.h> 14 14 #include <sys/mman.h> 15 15 16 + #include <linux/types.h> 17 + 16 18 #include "../kselftest.h" 17 19 18 20 /* Define some kernel-like types */ 19 - #define u8 __u8 20 - #define u16 __u16 21 - #define u32 __u32 22 - #define u64 __u64 21 + typedef __u8 u8; 22 + typedef __u16 u16; 23 + typedef __u32 u32; 24 + typedef __u64 u64; 23 25 24 26 #define PTR_ERR_ENOTSUP ((void *)-ENOTSUP) 25 27