kernel.h: Move out a couple of macros and constants
cover kernel.h: Move out a couple of macros and constants
The kernel.h hosts a couple of macros and constants that may have been put to a better place. Do that. Also add missing documentation.
No functional changes intended.
Andy Shevchenko (1):
kernel.h: Move PTR_IF() and u64_to_user_ptr() to util_macros.h
Ingo Molnar (1):
kernel.h: Move READ/WRITE definitions to <linux/types.h>
include/linux/kernel.h | 14 +------- include/linux/types.h | 4 +++ include/linux/util_macros.h | 66 +++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 13 deletions(-)
Signature · 1 line
2.47.2
PATCH 1/2 kernel.h: Move READ/WRITE definitions to <linux/types.h>
From: Ingo Molnar <[email protected]>
Headers shouldn't be forced to include <linux/kernel.h> just to gain these simple constants.
--- include/linux/kernel.h | 4 ---- include/linux/types.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-)
include/linux/kernel.h +0 -4
@@ -41,10 +41,6 @@#define STACK_MAGIC 0xdeadbeef -/* generic data direction definitions */ -#define READ 0 -#define WRITE 1 -#define PTR_IF (cond, ptr) ((cond) ? (ptr) : NULL)#define u64_to_user_ptr (x) ( \
include/linux/types.h +4 -0
@@ -136,6 +136,10 @@ typedef s64 ktime_t;typedef u64 sector_t ;typedef u64 blkcnt_t ; +/* generic data direction definitions */ +#define READ 0 +#define WRITE 1 +/* * The type of an index into the pagecache. */
Signature · 1 line
2.47.2
PATCH 2/2 kernel.h: Move PTR_IF() and u64_to_user_ptr() to util_macros.h
In reply to Andy ShevchenkoWhile the natural choice of PTR_IF() is kconfig.h, the latter is too broad to include C code and actually the macro was moved out from there in the past. But kernel.h is neither a good choice for that. Move it to util_macros.h. Do the same for u64_to_user_ptr().
While moving, add necessary documentation.
--- include/linux/kernel.h | 10 +----- include/linux/util_macros.h | 66 +++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 9 deletions(-)
include/linux/kernel.h +1 -9
@@ -33,6 +33,7 @@#include <linux/sprintf.h> #include <linux/static_call_types.h> #include <linux/instruction_pointer.h> +#include <linux/util_macros.h> #include <linux/wordpart.h> #include <asm/byteorder.h>
@@ -41,15 +42,6 @@#define STACK_MAGIC 0xdeadbeef -#define PTR_IF (cond, ptr) ((cond) ? (ptr) : NULL) - -#define u64_to_user_ptr (x) ( \ -{ \ - typecheck(u64, (x)); \ - (void __user *)(uintptr_t)(x); \ -} \ -) -struct completion ;struct user ;
include/linux/util_macros.h +66 -0
72 lines not on this page · raw message
Signature · 1 line
2.47.2