diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/compiler.h | 12 | ||||
| -rw-r--r-- | include/linux/hardirq.h | 18 | ||||
| -rw-r--r-- | include/linux/of_i2c.h | 4 | ||||
| -rw-r--r-- | include/linux/rcupdate.h | 12 | ||||
| -rw-r--r-- | include/linux/vermagic.h | 8 |
5 files changed, 29 insertions, 25 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index dcae0c8d97e6..c8bd2daf95ec 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
| @@ -182,4 +182,16 @@ extern void __chk_io_ptr(const volatile void __iomem *); | |||
| 182 | # define __section(S) __attribute__ ((__section__(#S))) | 182 | # define __section(S) __attribute__ ((__section__(#S))) |
| 183 | #endif | 183 | #endif |
| 184 | 184 | ||
| 185 | /* | ||
| 186 | * Prevent the compiler from merging or refetching accesses. The compiler | ||
| 187 | * is also forbidden from reordering successive instances of ACCESS_ONCE(), | ||
| 188 | * but only when the compiler is aware of some particular ordering. One way | ||
| 189 | * to make the compiler aware of ordering is to put the two invocations of | ||
| 190 | * ACCESS_ONCE() in different C statements. | ||
| 191 | * | ||
| 192 | * This macro does absolutely -nothing- to prevent the CPU from reordering, | ||
| 193 | * merging, or refetching absolutely anything at any time. | ||
| 194 | */ | ||
| 195 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) | ||
| 196 | |||
| 185 | #endif /* __LINUX_COMPILER_H */ | 197 | #endif /* __LINUX_COMPILER_H */ |
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 897f723bd222..181006cc94a0 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
| @@ -72,6 +72,14 @@ | |||
| 72 | #define in_softirq() (softirq_count()) | 72 | #define in_softirq() (softirq_count()) |
| 73 | #define in_interrupt() (irq_count()) | 73 | #define in_interrupt() (irq_count()) |
| 74 | 74 | ||
| 75 | #if defined(CONFIG_PREEMPT) | ||
| 76 | # define PREEMPT_INATOMIC_BASE kernel_locked() | ||
| 77 | # define PREEMPT_CHECK_OFFSET 1 | ||
| 78 | #else | ||
| 79 | # define PREEMPT_INATOMIC_BASE 0 | ||
| 80 | # define PREEMPT_CHECK_OFFSET 0 | ||
| 81 | #endif | ||
| 82 | |||
| 75 | /* | 83 | /* |
| 76 | * Are we running in atomic context? WARNING: this macro cannot | 84 | * Are we running in atomic context? WARNING: this macro cannot |
| 77 | * always detect atomic context; in particular, it cannot know about | 85 | * always detect atomic context; in particular, it cannot know about |
| @@ -79,17 +87,11 @@ | |||
| 79 | * used in the general case to determine whether sleeping is possible. | 87 | * used in the general case to determine whether sleeping is possible. |
| 80 | * Do not use in_atomic() in driver code. | 88 | * Do not use in_atomic() in driver code. |
| 81 | */ | 89 | */ |
| 82 | #define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) | 90 | #define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_INATOMIC_BASE) |
| 83 | |||
| 84 | #ifdef CONFIG_PREEMPT | ||
| 85 | # define PREEMPT_CHECK_OFFSET 1 | ||
| 86 | #else | ||
| 87 | # define PREEMPT_CHECK_OFFSET 0 | ||
| 88 | #endif | ||
| 89 | 91 | ||
| 90 | /* | 92 | /* |
| 91 | * Check whether we were atomic before we did preempt_disable(): | 93 | * Check whether we were atomic before we did preempt_disable(): |
| 92 | * (used by the scheduler) | 94 | * (used by the scheduler, *after* releasing the kernel lock) |
| 93 | */ | 95 | */ |
| 94 | #define in_atomic_preempt_off() \ | 96 | #define in_atomic_preempt_off() \ |
| 95 | ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET) | 97 | ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET) |
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h index 2e5a96732042..bd2a870ec296 100644 --- a/include/linux/of_i2c.h +++ b/include/linux/of_i2c.h | |||
| @@ -14,11 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | #include <linux/i2c.h> | 15 | #include <linux/i2c.h> |
| 16 | 16 | ||
| 17 | #ifdef CONFIG_OF_I2C | ||
| 18 | |||
| 19 | void of_register_i2c_devices(struct i2c_adapter *adap, | 17 | void of_register_i2c_devices(struct i2c_adapter *adap, |
| 20 | struct device_node *adap_node); | 18 | struct device_node *adap_node); |
| 21 | 19 | ||
| 22 | #endif /* CONFIG_OF_I2C */ | ||
| 23 | |||
| 24 | #endif /* __LINUX_OF_I2C_H */ | 20 | #endif /* __LINUX_OF_I2C_H */ |
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 8082d6587a0f..d42dbec06083 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
| @@ -131,18 +131,6 @@ struct rcu_head { | |||
| 131 | */ | 131 | */ |
| 132 | #define rcu_read_unlock_bh() __rcu_read_unlock_bh() | 132 | #define rcu_read_unlock_bh() __rcu_read_unlock_bh() |
| 133 | 133 | ||
| 134 | /* | ||
| 135 | * Prevent the compiler from merging or refetching accesses. The compiler | ||
| 136 | * is also forbidden from reordering successive instances of ACCESS_ONCE(), | ||
| 137 | * but only when the compiler is aware of some particular ordering. One way | ||
| 138 | * to make the compiler aware of ordering is to put the two invocations of | ||
| 139 | * ACCESS_ONCE() in different C statements. | ||
| 140 | * | ||
| 141 | * This macro does absolutely -nothing- to prevent the CPU from reordering, | ||
| 142 | * merging, or refetching absolutely anything at any time. | ||
| 143 | */ | ||
| 144 | #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) | ||
| 145 | |||
| 146 | /** | 134 | /** |
| 147 | * rcu_dereference - fetch an RCU-protected pointer in an | 135 | * rcu_dereference - fetch an RCU-protected pointer in an |
| 148 | * RCU read-side critical section. This pointer may later | 136 | * RCU read-side critical section. This pointer may later |
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h index 4d0909e53595..79b9837d9ca0 100644 --- a/include/linux/vermagic.h +++ b/include/linux/vermagic.h | |||
| @@ -17,6 +17,11 @@ | |||
| 17 | #else | 17 | #else |
| 18 | #define MODULE_VERMAGIC_MODULE_UNLOAD "" | 18 | #define MODULE_VERMAGIC_MODULE_UNLOAD "" |
| 19 | #endif | 19 | #endif |
| 20 | #ifdef CONFIG_MODVERSIONS | ||
| 21 | #define MODULE_VERMAGIC_MODVERSIONS "modversions " | ||
| 22 | #else | ||
| 23 | #define MODULE_VERMAGIC_MODVERSIONS "" | ||
| 24 | #endif | ||
| 20 | #ifndef MODULE_ARCH_VERMAGIC | 25 | #ifndef MODULE_ARCH_VERMAGIC |
| 21 | #define MODULE_ARCH_VERMAGIC "" | 26 | #define MODULE_ARCH_VERMAGIC "" |
| 22 | #endif | 27 | #endif |
| @@ -24,5 +29,6 @@ | |||
| 24 | #define VERMAGIC_STRING \ | 29 | #define VERMAGIC_STRING \ |
| 25 | UTS_RELEASE " " \ | 30 | UTS_RELEASE " " \ |
| 26 | MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ | 31 | MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ |
| 27 | MODULE_VERMAGIC_MODULE_UNLOAD MODULE_ARCH_VERMAGIC | 32 | MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \ |
| 33 | MODULE_ARCH_VERMAGIC | ||
| 28 | 34 | ||
