diff options
| author | Tony Lindgren <tony@atomide.com> | 2017-08-10 09:05:53 -0700 |
|---|---|---|
| committer | Tony Lindgren <tony@atomide.com> | 2017-08-10 09:05:53 -0700 |
| commit | c002c27874faaa170b535d03d7efee89ecdd9be4 (patch) | |
| tree | 70d91eba77a9c374e4f0bf9eb8636acba57ca173 /include/linux/kernel.h | |
| parent | 866b5e447f1ad3a0d72c139fabe3dd71f351f361 (diff) | |
| parent | 5771a8c08880cdca3bfb4a3fc6d309d6bba20877 (diff) | |
| download | cachepc-linux-c002c27874faaa170b535d03d7efee89ecdd9be4.tar.gz cachepc-linux-c002c27874faaa170b535d03d7efee89ecdd9be4.zip | |
Merge tag 'v4.13-rc1' into omap-for-v4.14/mmc-regulator
Linux v4.13-rc1
Diffstat (limited to 'include/linux/kernel.h')
| -rw-r--r-- | include/linux/kernel.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 13bc08aba704..bd6d96cf80b1 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -11,6 +11,7 @@ #include <linux/log2.h> #include <linux/typecheck.h> #include <linux/printk.h> +#include <linux/build_bug.h> #include <asm/byteorder.h> #include <uapi/linux/kernel.h> @@ -490,9 +491,13 @@ extern int root_mountflags; extern bool early_boot_irqs_disabled; -/* Values used for system_state */ +/* + * Values used for system_state. Ordering of the states must not be changed + * as code checks for <, <=, >, >= STATE. + */ extern enum system_states { SYSTEM_BOOTING, + SYSTEM_SCHEDULING, SYSTEM_RUNNING, SYSTEM_HALT, SYSTEM_POWER_OFF, @@ -850,9 +855,12 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } * @member: the name of the member within the struct. * */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) +#define container_of(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()"); \ + ((type *)(__mptr - offsetof(type, member))); }) /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
