Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91f68b73 authored by Wu Fengguang's avatar Wu Fengguang Committed by Linus Torvalds
Browse files

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: default avatarWu Fengguang <fengguang.wu@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b53907c0
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -476,6 +476,12 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
	__val = __val < __min ? __min: __val;	\
	__val = __val < __min ? __min: __val;	\
	__val > __max ? __max: __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
 * container_of - cast a member of a structure out to the containing structure
 * @ptr:	the pointer to the member.
 * @ptr:	the pointer to the member.