| .. | .. |
|---|
| 66 | 66 | #include <linux/seqlock.h> |
|---|
| 67 | 67 | |
|---|
| 68 | 68 | struct u64_stats_sync { |
|---|
| 69 | | -#if BITS_PER_LONG==32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)) |
|---|
| 69 | +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) |
|---|
| 70 | 70 | seqcount_t seq; |
|---|
| 71 | 71 | #endif |
|---|
| 72 | 72 | }; |
|---|
| .. | .. |
|---|
| 115 | 115 | } |
|---|
| 116 | 116 | #endif |
|---|
| 117 | 117 | |
|---|
| 118 | | -#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)) |
|---|
| 118 | +#if BITS_PER_LONG == 32 && defined(CONFIG_SMP) |
|---|
| 119 | 119 | #define u64_stats_init(syncp) seqcount_init(&(syncp)->seq) |
|---|
| 120 | 120 | #else |
|---|
| 121 | 121 | static inline void u64_stats_init(struct u64_stats_sync *syncp) |
|---|
| .. | .. |
|---|
| 125 | 125 | |
|---|
| 126 | 126 | static inline void u64_stats_update_begin(struct u64_stats_sync *syncp) |
|---|
| 127 | 127 | { |
|---|
| 128 | | -#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)) |
|---|
| 129 | | - if (IS_ENABLED(CONFIG_PREEMPT_RT)) |
|---|
| 130 | | - preempt_disable(); |
|---|
| 128 | +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) |
|---|
| 131 | 129 | write_seqcount_begin(&syncp->seq); |
|---|
| 132 | 130 | #endif |
|---|
| 133 | 131 | } |
|---|
| 134 | 132 | |
|---|
| 135 | 133 | static inline void u64_stats_update_end(struct u64_stats_sync *syncp) |
|---|
| 136 | 134 | { |
|---|
| 137 | | -#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)) |
|---|
| 135 | +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) |
|---|
| 138 | 136 | write_seqcount_end(&syncp->seq); |
|---|
| 139 | | - if (IS_ENABLED(CONFIG_PREEMPT_RT)) |
|---|
| 140 | | - preempt_enable(); |
|---|
| 141 | 137 | #endif |
|---|
| 142 | 138 | } |
|---|
| 143 | 139 | |
|---|
| .. | .. |
|---|
| 146 | 142 | { |
|---|
| 147 | 143 | unsigned long flags = 0; |
|---|
| 148 | 144 | |
|---|
| 149 | | -#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)) |
|---|
| 150 | | - if (IS_ENABLED(CONFIG_PREEMPT_RT)) |
|---|
| 151 | | - preempt_disable(); |
|---|
| 152 | | - else |
|---|
| 153 | | - local_irq_save(flags); |
|---|
| 145 | +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) |
|---|
| 146 | + local_irq_save(flags); |
|---|
| 154 | 147 | write_seqcount_begin(&syncp->seq); |
|---|
| 155 | 148 | #endif |
|---|
| 156 | 149 | return flags; |
|---|
| .. | .. |
|---|
| 160 | 153 | u64_stats_update_end_irqrestore(struct u64_stats_sync *syncp, |
|---|
| 161 | 154 | unsigned long flags) |
|---|
| 162 | 155 | { |
|---|
| 163 | | -#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)) |
|---|
| 156 | +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) |
|---|
| 164 | 157 | write_seqcount_end(&syncp->seq); |
|---|
| 165 | | - if (IS_ENABLED(CONFIG_PREEMPT_RT)) |
|---|
| 166 | | - preempt_enable(); |
|---|
| 167 | | - else |
|---|
| 168 | | - local_irq_restore(flags); |
|---|
| 158 | + local_irq_restore(flags); |
|---|
| 169 | 159 | #endif |
|---|
| 170 | 160 | } |
|---|
| 171 | 161 | |
|---|
| 172 | 162 | static inline unsigned int __u64_stats_fetch_begin(const struct u64_stats_sync *syncp) |
|---|
| 173 | 163 | { |
|---|
| 174 | | -#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)) |
|---|
| 164 | +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) |
|---|
| 175 | 165 | return read_seqcount_begin(&syncp->seq); |
|---|
| 176 | 166 | #else |
|---|
| 177 | 167 | return 0; |
|---|
| .. | .. |
|---|
| 180 | 170 | |
|---|
| 181 | 171 | static inline unsigned int u64_stats_fetch_begin(const struct u64_stats_sync *syncp) |
|---|
| 182 | 172 | { |
|---|
| 183 | | -#if BITS_PER_LONG == 32 && (!defined(CONFIG_SMP) && !defined(CONFIG_PREEMPT_RT)) |
|---|
| 173 | +#if BITS_PER_LONG==32 && !defined(CONFIG_SMP) |
|---|
| 184 | 174 | preempt_disable(); |
|---|
| 185 | 175 | #endif |
|---|
| 186 | 176 | return __u64_stats_fetch_begin(syncp); |
|---|
| .. | .. |
|---|
| 189 | 179 | static inline bool __u64_stats_fetch_retry(const struct u64_stats_sync *syncp, |
|---|
| 190 | 180 | unsigned int start) |
|---|
| 191 | 181 | { |
|---|
| 192 | | -#if BITS_PER_LONG == 32 && (defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)) |
|---|
| 182 | +#if BITS_PER_LONG==32 && defined(CONFIG_SMP) |
|---|
| 193 | 183 | return read_seqcount_retry(&syncp->seq, start); |
|---|
| 194 | 184 | #else |
|---|
| 195 | 185 | return false; |
|---|
| .. | .. |
|---|
| 199 | 189 | static inline bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp, |
|---|
| 200 | 190 | unsigned int start) |
|---|
| 201 | 191 | { |
|---|
| 202 | | -#if BITS_PER_LONG == 32 && (!defined(CONFIG_SMP) && !defined(CONFIG_PREEMPT_RT)) |
|---|
| 192 | +#if BITS_PER_LONG==32 && !defined(CONFIG_SMP) |
|---|
| 203 | 193 | preempt_enable(); |
|---|
| 204 | 194 | #endif |
|---|
| 205 | 195 | return __u64_stats_fetch_retry(syncp, start); |
|---|
| .. | .. |
|---|
| 213 | 203 | */ |
|---|
| 214 | 204 | static inline unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync *syncp) |
|---|
| 215 | 205 | { |
|---|
| 216 | | -#if BITS_PER_LONG == 32 && defined(CONFIG_PREEMPT_RT) |
|---|
| 217 | | - preempt_disable(); |
|---|
| 218 | | -#elif BITS_PER_LONG == 32 && !defined(CONFIG_SMP) |
|---|
| 206 | +#if BITS_PER_LONG==32 && !defined(CONFIG_SMP) |
|---|
| 219 | 207 | local_irq_disable(); |
|---|
| 220 | 208 | #endif |
|---|
| 221 | 209 | return __u64_stats_fetch_begin(syncp); |
|---|
| .. | .. |
|---|
| 224 | 212 | static inline bool u64_stats_fetch_retry_irq(const struct u64_stats_sync *syncp, |
|---|
| 225 | 213 | unsigned int start) |
|---|
| 226 | 214 | { |
|---|
| 227 | | -#if BITS_PER_LONG == 32 && defined(CONFIG_PREEMPT_RT) |
|---|
| 228 | | - preempt_enable(); |
|---|
| 229 | | -#elif BITS_PER_LONG == 32 && !defined(CONFIG_SMP) |
|---|
| 215 | +#if BITS_PER_LONG==32 && !defined(CONFIG_SMP) |
|---|
| 230 | 216 | local_irq_enable(); |
|---|
| 231 | 217 | #endif |
|---|
| 232 | 218 | return __u64_stats_fetch_retry(syncp, start); |
|---|