diff options
| author | Dmitry Torokhov <[email protected]> | 2023-05-01 15:20:08 -0700 | 
|---|---|---|
| committer | Dmitry Torokhov <[email protected]> | 2023-05-01 15:20:08 -0700 | 
| commit | 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e (patch) | |
| tree | d57f3a63479a07b4e0cece029886e76e04feb984 /include/linux/util_macros.h | |
| parent | 5dc63e56a9cf8df0b59c234a505a1653f1bdf885 (diff) | |
| parent | 53bea86b5712c7491bb3dae12e271666df0a308c (diff) | |
Merge branch 'next' into for-linus
Prepare input updates for 6.4 merge window.
Diffstat (limited to 'include/linux/util_macros.h')
| -rw-r--r-- | include/linux/util_macros.h | 14 | 
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/util_macros.h b/include/linux/util_macros.h index 72299f261b25..6bb460c3e818 100644 --- a/include/linux/util_macros.h +++ b/include/linux/util_macros.h @@ -2,6 +2,8 @@  #ifndef _LINUX_HELPER_MACROS_H_  #define _LINUX_HELPER_MACROS_H_ +#include <linux/math.h> +  #define __find_closest(x, a, as, op)					\  ({									\  	typeof(as) __fc_i, __fc_as = (as) - 1;				\ @@ -38,4 +40,16 @@   */  #define find_closest_descending(x, a, as) __find_closest(x, a, as, >=) +/** + * is_insidevar - check if the @ptr points inside the @var memory range. + * @ptr:	the pointer to a memory address. + * @var:	the variable which address and size identify the memory range. + * + * Evaluates to true if the address in @ptr lies within the memory + * range allocated to @var. + */ +#define is_insidevar(ptr, var)						\ +	((uintptr_t)(ptr) >= (uintptr_t)(var) &&			\ +	 (uintptr_t)(ptr) <  (uintptr_t)(var) + sizeof(var)) +  #endif  |