From 7ecad01e71cd6f2b4b4f1709db4f693e89fe868c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 21 Jun 2020 16:27:05 +0000 Subject: [PATCH] scst, percpu_ref backport: For older kernels, use atomic instead of atomic_long git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9030 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scst/include/backport.h b/scst/include/backport.h index 431855c18..8262575b6 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -1143,7 +1143,7 @@ struct percpu_ref; typedef void (percpu_ref_func_t)(struct percpu_ref *); struct percpu_ref { - atomic_long_t count; + atomic_t count; percpu_ref_func_t *release; }; @@ -1152,7 +1152,7 @@ static inline int __must_check percpu_ref_init(struct percpu_ref *ref, gfp_t gfp) { WARN_ON_ONCE(flags != 0); - atomic_long_set(&ref->count, 1); + atomic_set(&ref->count, 1); ref->release = release; return 0; } @@ -1163,12 +1163,12 @@ static inline void percpu_ref_exit(struct percpu_ref *ref) static inline void percpu_ref_get(struct percpu_ref *ref) { - atomic_long_inc(&ref->count); + atomic_inc(&ref->count); } static inline void percpu_ref_put(struct percpu_ref *ref) { - if (unlikely(atomic_long_dec_and_test(&ref->count))) + if (unlikely(atomic_dec_and_test(&ref->count))) ref->release(ref); } @@ -1179,7 +1179,7 @@ static inline void percpu_ref_kill(struct percpu_ref *ref) static inline bool percpu_ref_is_zero(struct percpu_ref *ref) { - return !atomic_long_read(&ref->count); + return !atomic_read(&ref->count); } #endif