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 Rename private member of...



details:   https://anonhg.NetBSD.org/src/rev/68f6e68ee02b
branches:  trunk
changeset: 992492:68f6e68ee02b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 06:46:17 2018 +0000

description:
Rename private member of kref, because Linux abuses the abstraction.

diffstat:

 sys/external/bsd/drm2/include/linux/kref.h |  28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diffs (102 lines):

diff -r 57cb9f7f0745 -r 68f6e68ee02b sys/external/bsd/drm2/include/linux/kref.h
--- a/sys/external/bsd/drm2/include/linux/kref.h        Mon Aug 27 06:46:02 2018 +0000
+++ b/sys/external/bsd/drm2/include/linux/kref.h        Mon Aug 27 06:46:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kref.h,v 1.4 2014/07/16 20:59:58 riastradh Exp $       */
+/*     $NetBSD: kref.h,v 1.5 2018/08/27 06:46:17 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -39,20 +39,20 @@
 #include <linux/mutex.h>
 
 struct kref {
-       unsigned int kr_count;
+       unsigned int refcount;
 };
 
 static inline void
 kref_init(struct kref *kref)
 {
-       kref->kr_count = 1;
+       kref->refcount = 1;
 }
 
 static inline void
 kref_get(struct kref *kref)
 {
        const unsigned int count __unused =
-           atomic_inc_uint_nv(&kref->kr_count);
+           atomic_inc_uint_nv(&kref->refcount);
 
        KASSERTMSG((count > 1), "getting released kref");
 }
@@ -63,10 +63,10 @@
        unsigned count;
 
        do {
-               count = kref->kr_count;
+               count = kref->refcount;
                if ((count == 0) || (count == UINT_MAX))
                        return false;
-       } while (atomic_cas_uint(&kref->kr_count, count, (count + 1)) !=
+       } while (atomic_cas_uint(&kref->refcount, count, (count + 1)) !=
            count);
 
        return true;
@@ -78,11 +78,11 @@
        unsigned int old, new;
 
        do {
-               old = kref->kr_count;
+               old = kref->refcount;
                KASSERTMSG((count <= old), "overreleasing kref: %u - %u",
                    old, count);
                new = (old - count);
-       } while (atomic_cas_uint(&kref->kr_count, old, new) != old);
+       } while (atomic_cas_uint(&kref->refcount, old, new) != old);
 
        if (new == 0) {
                (*release)(kref);
@@ -106,11 +106,11 @@
        unsigned int old, new;
 
        do {
-               old = kref->kr_count;
+               old = kref->refcount;
                KASSERT(old > 0);
                if (old == 1) {
                        mutex_lock(interlock);
-                       if (atomic_add_int_nv(&kref->kr_count, -1) == 0) {
+                       if (atomic_add_int_nv(&kref->refcount, -1) == 0) {
                                (*release)(kref);
                                return 1;
                        }
@@ -118,7 +118,7 @@
                        return 0;
                }
                new = (old - 1);
-       } while (atomic_cas_uint(&kref->kr_count, old, new) != old);
+       } while (atomic_cas_uint(&kref->refcount, old, new) != old);
 
        return 0;
 }
@@ -131,15 +131,15 @@
 kref_referenced_p(struct kref *kref)
 {
 
-       return (0 < kref->kr_count);
+       return (0 < kref->refcount);
 }
 
 static inline bool
 kref_exclusive_p(struct kref *kref)
 {
 
-       KASSERT(0 < kref->kr_count);
-       return (kref->kr_count == 1);
+       KASSERT(0 < kref->refcount);
+       return (kref->refcount == 1);
 }
 
 #endif  /* _LINUX_KREF_H_ */



Home | Main Index | Thread Index | Old Index