From ae7eb0c978c810745a78460ae78aaf98cf19187f Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 3 Dec 2020 03:32:32 +0000 Subject: [PATCH] scst, percpu_ref backport: For older kernels, use atomic instead of atomic_long (merge r9030 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.4.x@9201 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 357e9bec2..c352365d4 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -1091,7 +1091,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; }; @@ -1100,7 +1100,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; } @@ -1111,12 +1111,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); } @@ -1127,7 +1127,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