barrier.h (ecd740c6f2f092b90b95fa35f757973589eaaca2) barrier.h (febdbfe8a91ce0d11939d4940b592eb0dba8d663)
1/*
2 * Generic barrier definitions, originally based on MN10300 definitions.
3 *
4 * It should be possible to use these on really simple architectures,
5 * but it serves more as a starting point for new ports.
6 *
7 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
8 * Written by David Howells (dhowells@redhat.com)

--- 48 unchanged lines hidden (view full) ---

57#define smp_wmb() barrier()
58#define smp_read_barrier_depends() do { } while (0)
59#endif
60
61#ifndef set_mb
62#define set_mb(var, value) do { (var) = (value); mb(); } while (0)
63#endif
64
1/*
2 * Generic barrier definitions, originally based on MN10300 definitions.
3 *
4 * It should be possible to use these on really simple architectures,
5 * but it serves more as a starting point for new ports.
6 *
7 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
8 * Written by David Howells (dhowells@redhat.com)

--- 48 unchanged lines hidden (view full) ---

57#define smp_wmb() barrier()
58#define smp_read_barrier_depends() do { } while (0)
59#endif
60
61#ifndef set_mb
62#define set_mb(var, value) do { (var) = (value); mb(); } while (0)
63#endif
64
65#ifndef smp_mb__before_atomic
66#define smp_mb__before_atomic() smp_mb()
67#endif
68
69#ifndef smp_mb__after_atomic
70#define smp_mb__after_atomic() smp_mb()
71#endif
72
65#define smp_store_release(p, v) \
66do { \
67 compiletime_assert_atomic_type(*p); \
68 smp_mb(); \
69 ACCESS_ONCE(*p) = (v); \
70} while (0)
71
72#define smp_load_acquire(p) \
73({ \
74 typeof(*p) ___p1 = ACCESS_ONCE(*p); \
75 compiletime_assert_atomic_type(*p); \
76 smp_mb(); \
77 ___p1; \
78})
79
80#endif /* !__ASSEMBLY__ */
81#endif /* __ASM_GENERIC_BARRIER_H */
73#define smp_store_release(p, v) \
74do { \
75 compiletime_assert_atomic_type(*p); \
76 smp_mb(); \
77 ACCESS_ONCE(*p) = (v); \
78} while (0)
79
80#define smp_load_acquire(p) \
81({ \
82 typeof(*p) ___p1 = ACCESS_ONCE(*p); \
83 compiletime_assert_atomic_type(*p); \
84 smp_mb(); \
85 ___p1; \
86})
87
88#endif /* !__ASSEMBLY__ */
89#endif /* __ASM_GENERIC_BARRIER_H */