diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2018-06-22 21:20:35 +0200 | 
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2018-06-22 21:20:35 +0200 | 
| commit | 7731b8bc94e599c9a79e428f3359ff2c34b7576a (patch) | |
| tree | 879f18ccbe274122f2d4f095b43cbc7f953e0ada /include/linux/kernel.h | |
| parent | 48e315618dc4dc8904182cd221e3d395d5d97005 (diff) | |
| parent | 9ffc59d57228d74809700be6f7ecb1db10292f05 (diff) | |
Merge branch 'linus' into x86/urgent
Required to queue a dependent fix.
Diffstat (limited to 'include/linux/kernel.h')
| -rw-r--r-- | include/linux/kernel.h | 18 | 
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 6a1eb0b0aad9..d23123238534 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -29,6 +29,7 @@  #define LLONG_MIN	(-LLONG_MAX - 1)  #define ULLONG_MAX	(~0ULL)  #define SIZE_MAX	(~(size_t)0) +#define PHYS_ADDR_MAX	(~(phys_addr_t)0)  #define U8_MAX		((u8)~0U)  #define S8_MAX		((s8)(U8_MAX>>1)) @@ -542,6 +543,7 @@ extern enum system_states {  	SYSTEM_HALT,  	SYSTEM_POWER_OFF,  	SYSTEM_RESTART, +	SYSTEM_SUSPEND,  } system_state;  /* This cannot be an enum because some may be used in assembly source. */ @@ -964,6 +966,22 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }  			 "pointer type mismatch in container_of()");	\  	((type *)(__mptr - offsetof(type, member))); }) +/** + * container_of_safe - cast a member of a structure out to the containing structure + * @ptr:	the pointer to the member. + * @type:	the type of the container struct this is embedded in. + * @member:	the name of the member within the struct. + * + * If IS_ERR_OR_NULL(ptr), ptr is returned unchanged. + */ +#define container_of_safe(ptr, type, member) ({				\ +	void *__mptr = (void *)(ptr);					\ +	BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&	\ +			 !__same_type(*(ptr), void),			\ +			 "pointer type mismatch in container_of()");	\ +	IS_ERR_OR_NULL(__mptr) ? ERR_CAST(__mptr) :			\ +		((type *)(__mptr - offsetof(type, member))); }) +  /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */  #ifdef CONFIG_FTRACE_MCOUNT_RECORD  # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD  | 
