diff options
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r-- | include/linux/compiler.h | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 7d7b77da9716..5a1cab48442c 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -346,24 +346,4 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s | |||
346 | (volatile typeof(x) *)&(x); }) | 346 | (volatile typeof(x) *)&(x); }) |
347 | #define ACCESS_ONCE(x) (*__ACCESS_ONCE(x)) | 347 | #define ACCESS_ONCE(x) (*__ACCESS_ONCE(x)) |
348 | 348 | ||
349 | /** | ||
350 | * lockless_dereference() - safely load a pointer for later dereference | ||
351 | * @p: The pointer to load | ||
352 | * | ||
353 | * Similar to rcu_dereference(), but for situations where the pointed-to | ||
354 | * object's lifetime is managed by something other than RCU. That | ||
355 | * "something other" might be reference counting or simple immortality. | ||
356 | * | ||
357 | * The seemingly unused variable ___typecheck_p validates that @p is | ||
358 | * indeed a pointer type by using a pointer to typeof(*p) as the type. | ||
359 | * Taking a pointer to typeof(*p) again is needed in case p is void *. | ||
360 | */ | ||
361 | #define lockless_dereference(p) \ | ||
362 | ({ \ | ||
363 | typeof(p) _________p1 = READ_ONCE(p); \ | ||
364 | typeof(*(p)) *___typecheck_p __maybe_unused; \ | ||
365 | smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ | ||
366 | (_________p1); \ | ||
367 | }) | ||
368 | |||
369 | #endif /* __LINUX_COMPILER_H */ | 349 | #endif /* __LINUX_COMPILER_H */ |