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 some atomic...
details: https://anonhg.NetBSD.org/src/rev/343a793e1860
branches: riastradh-drm2
changeset: 788033:343a793e1860
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jul 24 01:55:58 2013 +0000
description:
Add some atomic operations to <linux/atomic.h>.
diffstat:
sys/external/bsd/drm2/include/linux/atomic.h | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diffs (41 lines):
diff -r feb6f50ec7fa -r 343a793e1860 sys/external/bsd/drm2/include/linux/atomic.h
--- a/sys/external/bsd/drm2/include/linux/atomic.h Wed Jul 24 01:55:44 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/atomic.h Wed Jul 24 01:55:58 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic.h,v 1.1.2.2 2013/07/24 00:48:34 riastradh Exp $ */
+/* $NetBSD: atomic.h,v 1.1.2.3 2013/07/24 01:55:58 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,6 +32,8 @@
#ifndef _LINUX_ATOMIC_H_
#define _LINUX_ATOMIC_H_
+#include <sys/atomic.h>
+
typedef struct {
int atomic_value;
} atomic_t;
@@ -42,4 +44,22 @@
return *(volatile int *)&atomic->atomic_value;
}
+static inline void
+atomic_set(atomic_t *atomic, int value)
+{
+ atomic->atomic_value = value;
+}
+
+static inline void
+atomic_inc(atomic_t *atomic)
+{
+ atomic_inc_uint((unsigned int *)&atomic->atomic_value);
+}
+
+static inline int
+atomic_dec_and_test(atomic_t *atomic)
+{
+ return (-1 == (int)atomic_dec_uint_nv(&atomic->atomic_value));
+}
+
#endif /* _LINUX_ATOMIC_H_ */
Home |
Main Index |
Thread Index |
Old Index