Module Name: src
Committed By: riastradh
Date: Mon Aug 27 06:51:53 UTC 2018
Modified Files:
src/sys/external/bsd/drm2/include/linux: kref.h
Log Message:
Revert "Rename private member of kref, because Linux abuses the abstraction."
This reverts commit d45132a71ee3c2570db2f10eac27283d3ac5b392.
Linux's abuse will be fixed.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/kref.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/external/bsd/drm2/include/linux/kref.h
diff -u src/sys/external/bsd/drm2/include/linux/kref.h:1.5 src/sys/external/bsd/drm2/include/linux/kref.h:1.6
--- src/sys/external/bsd/drm2/include/linux/kref.h:1.5 Mon Aug 27 06:46:17 2018
+++ src/sys/external/bsd/drm2/include/linux/kref.h Mon Aug 27 06:51:52 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: kref.h,v 1.5 2018/08/27 06:46:17 riastradh Exp $ */
+/* $NetBSD: kref.h,v 1.6 2018/08/27 06:51:52 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -39,20 +39,20 @@
#include <linux/mutex.h>
struct kref {
- unsigned int refcount;
+ unsigned int kr_count;
};
static inline void
kref_init(struct kref *kref)
{
- kref->refcount = 1;
+ kref->kr_count = 1;
}
static inline void
kref_get(struct kref *kref)
{
const unsigned int count __unused =
- atomic_inc_uint_nv(&kref->refcount);
+ atomic_inc_uint_nv(&kref->kr_count);
KASSERTMSG((count > 1), "getting released kref");
}
@@ -63,10 +63,10 @@ kref_get_unless_zero(struct kref *kref)
unsigned count;
do {
- count = kref->refcount;
+ count = kref->kr_count;
if ((count == 0) || (count == UINT_MAX))
return false;
- } while (atomic_cas_uint(&kref->refcount, count, (count + 1)) !=
+ } while (atomic_cas_uint(&kref->kr_count, count, (count + 1)) !=
count);
return true;
@@ -78,11 +78,11 @@ kref_sub(struct kref *kref, unsigned int
unsigned int old, new;
do {
- old = kref->refcount;
+ old = kref->kr_count;
KASSERTMSG((count <= old), "overreleasing kref: %u - %u",
old, count);
new = (old - count);
- } while (atomic_cas_uint(&kref->refcount, old, new) != old);
+ } while (atomic_cas_uint(&kref->kr_count, old, new) != old);
if (new == 0) {
(*release)(kref);
@@ -106,11 +106,11 @@ kref_put_mutex(struct kref *kref, void (
unsigned int old, new;
do {
- old = kref->refcount;
+ old = kref->kr_count;
KASSERT(old > 0);
if (old == 1) {
mutex_lock(interlock);
- if (atomic_add_int_nv(&kref->refcount, -1) == 0) {
+ if (atomic_add_int_nv(&kref->kr_count, -1) == 0) {
(*release)(kref);
return 1;
}
@@ -118,7 +118,7 @@ kref_put_mutex(struct kref *kref, void (
return 0;
}
new = (old - 1);
- } while (atomic_cas_uint(&kref->refcount, old, new) != old);
+ } while (atomic_cas_uint(&kref->kr_count, old, new) != old);
return 0;
}
@@ -131,15 +131,15 @@ static inline bool
kref_referenced_p(struct kref *kref)
{
- return (0 < kref->refcount);
+ return (0 < kref->kr_count);
}
static inline bool
kref_exclusive_p(struct kref *kref)
{
- KASSERT(0 < kref->refcount);
- return (kref->refcount == 1);
+ KASSERT(0 < kref->kr_count);
+ return (kref->kr_count == 1);
}
#endif /* _LINUX_KREF_H_ */