xref: /linux/scripts/atomic/fallbacks/read_acquire (revision 9257959a6e5b4fca6fc8e985790bff62c2046f20)
1ace9bad4SMark Rutlandcat <<EOF
2765dcd20SMarco Elverstatic __always_inline ${ret}
3*9257959aSMark Rutlandraw_${atomic}_read_acquire(const ${atomic}_t *v)
4ace9bad4SMark Rutland{
5dc1b4df0SMark Rutland	${int} ret;
6dc1b4df0SMark Rutland
7dc1b4df0SMark Rutland	if (__native_word(${atomic}_t)) {
8dc1b4df0SMark Rutland		ret = smp_load_acquire(&(v)->counter);
9dc1b4df0SMark Rutland	} else {
10*9257959aSMark Rutland		ret = raw_${atomic}_read(v);
11dc1b4df0SMark Rutland		__atomic_acquire_fence();
12dc1b4df0SMark Rutland	}
13dc1b4df0SMark Rutland
14dc1b4df0SMark Rutland	return ret;
15ace9bad4SMark Rutland}
16ace9bad4SMark RutlandEOF
17