mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user