From: Cliff Wickman <cpw@sgi.com>
Provide atomic operations for increment of a 16-bit integer and
logical OR into a 64-bit integer.
[ This patch was split off of patch:
SGI UV: TLB shootdown using broadcast assist unit
and improved with advice from Jeremy Fitzhardinge <jeremy@goop.org> ]
Diffed against 2.6.26-rc4
Signed-off-by: Cliff Wickman <cpw@sgi.com>
---
include/asm-x86/atomic_64.h | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
Index: linux/include/asm-x86/atomic_64.h
===================================================================
--- linux.orig/include/asm-x86/atomic_64.h
+++ linux/include/asm-x86/atomic_64.h
@@ -431,6 +431,32 @@ static inline int atomic64_add_unless(at
return c != (u);
}
+/**
+ * atomic_inc_short - increment of a short integer
+ * @v: pointer to type int
+ *
+ * Atomically adds 1 to @v
+ * Returns the new value of @u
+ */
+static inline short int atomic_inc_short(short int *v)
+{
+ asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v));
+ return *v;
+}
+
+/**
+ * atomic_or_long - OR of two long integers
+ * @v1: pointer to type unsigned long
+ * @v2: pointer to type unsigned long
+ *
+ * Atomically ORs @v1 and @v2
+ * Returns the result of the OR
+ */
+static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
+{
+ asm(LOCK_PREFIX "orq %1, %0" : "+m" (*v1) : "r" (v2));
+}
+
#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
/* These are x86-specific, used by some header files */
--
| Andy Whitcroft | clam |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
| David Miller | Re: Slow DOWN, please!!! |
git: | |
| Arjan van de Ven | Re: [GIT]: Networking |
| Lennert Buytenhek | [PATCH 08/39] mv643xx_eth: nuke port status register bit defines |
| Jarek Poplawski | Re: HTB accuracy for high speed |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
