Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/riastradh-drm2]: src/sys/external/bsd/drm2/include/linux Add Linux ATOMI...
details: https://anonhg.NetBSD.org/src/rev/a8561e0c4f83
branches: riastradh-drm2
changeset: 788547:a8561e0c4f83
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Sep 08 16:07:29 2013 +0000
description:
Add Linux ATOMIC_INIT, atomic_inc_return, and atomic_dec_return.
diffstat:
sys/external/bsd/drm2/include/linux/atomic.h | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diffs (37 lines):
diff -r c4693a8f8daa -r a8561e0c4f83 sys/external/bsd/drm2/include/linux/atomic.h
--- a/sys/external/bsd/drm2/include/linux/atomic.h Sun Sep 08 16:06:35 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/atomic.h Sun Sep 08 16:07:29 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic.h,v 1.1.2.10 2013/09/08 15:37:04 riastradh Exp $ */
+/* $NetBSD: atomic.h,v 1.1.2.11 2013/09/08 16:07:29 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -43,6 +43,8 @@
} a_u;
};
+#define ATOMIC_INIT(i) { .a_u = { .au_int = (i) } }
+
typedef struct atomic atomic_t;
static inline int
@@ -88,6 +90,18 @@
}
static inline int
+atomic_inc_return(atomic_t *atomic)
+{
+ return (int)atomic_inc_uint_nv(&atomic->a_u.au_uint);
+}
+
+static inline int
+atomic_dec_return(atomic_t *atomic)
+{
+ return (int)atomic_dec_uint_nv(&atomic->a_u.au_uint);
+}
+
+static inline int
atomic_dec_and_test(atomic_t *atomic)
{
return (-1 == (int)atomic_dec_uint_nv(&atomic->a_u.au_uint));
Home |
Main Index |
Thread Index |
Old Index