]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
generic swap(): introduce global macro swap(a, b)
authorWu Fengguang <fengguang.wu@intel.com>
Thu, 8 Jan 2009 02:09:12 +0000 (18:09 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 8 Jan 2009 16:31:15 +0000 (08:31 -0800)
There have been some local definitions of swap(), it's time to replace
them all with a uniform one.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/kernel.h

index 6b8e2027165eb9e810978dfaaf363174ab767cf4..343df9ef2412393020e90c1ef5227135b3b5a07f 100644 (file)
@@ -476,6 +476,12 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
        __val = __val < __min ? __min: __val;   \
        __val > __max ? __max: __val; })
 
+
+/*
+ * swap - swap value of @a and @b
+ */
+#define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; })
+
 /**
  * container_of - cast a member of a structure out to the containing structure
  * @ptr:       the pointer to the member.