Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/include/linux Revert "Rename private m...
details: https://anonhg.NetBSD.org/src/rev/7390b5ed846e
branches: trunk
changeset: 365817:7390b5ed846e
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 27 06:51:52 2018 +0000
description:
Revert "Rename private member of kref, because Linux abuses the abstraction."
This reverts commit d45132a71ee3c2570db2f10eac27283d3ac5b392.
Linux's abuse will be fixed.
diffstat:
sys/external/bsd/drm2/include/linux/kref.h | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diffs (102 lines):
diff -r 37975a6c5440 -r 7390b5ed846e sys/external/bsd/drm2/include/linux/kref.h
--- a/sys/external/bsd/drm2/include/linux/kref.h Mon Aug 27 06:51:38 2018 +0000
+++ b/sys/external/bsd/drm2/include/linux/kref.h Mon Aug 27 06:51:52 2018 +0000
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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_ */
Home |
Main Index |
Thread Index |
Old Index