diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2009-01-07 21:09:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-08 11:31:15 -0500 |
commit | 91f68b7359144aa40bb9668124543d15284750b4 (patch) | |
tree | 69f11509a40655c17a44da9b61debdb31209f208 /include/linux/kernel.h | |
parent | b53907c0100a353a7ac53bed260e735e5ccbbbcc (diff) |
generic swap(): introduce global macro swap(a, b)
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>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 6b8e2027165e..343df9ef2412 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -476,6 +476,12 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
476 | __val = __val < __min ? __min: __val; \ | 476 | __val = __val < __min ? __min: __val; \ |
477 | __val > __max ? __max: __val; }) | 477 | __val > __max ? __max: __val; }) |
478 | 478 | ||
479 | |||
480 | /* | ||
481 | * swap - swap value of @a and @b | ||
482 | */ | ||
483 | #define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; }) | ||
484 | |||
479 | /** | 485 | /** |
480 | * container_of - cast a member of a structure out to the containing structure | 486 | * container_of - cast a member of a structure out to the containing structure |
481 | * @ptr: the pointer to the member. | 487 | * @ptr: the pointer to the member. |