PTR_ALIGN
PATCH 1/1 PTR_ALIGN
The AdvanSys driver wants to align some pointers, and the ALIGN macro doesn't work for pointers. Rather than try to make it work, add a new PTR_ALIGN macro which is typesafe.
Signed-off-by Matthew Wilcox <[email protected]>
include/linux/kernel.h +1 -0
@@ -34,6 +34,7 @@ extern const char linux_proc_banner[];#define ALIGN (x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)#define __ALIGN_MASK (x,mask) (((x)+(mask))&~(mask)) +#define PTR_ALIGN (p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))#define ARRAY_SIZE (arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
Signature · 3 lines
"Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."
Quoted 12 lines · On Thu, 23 Aug 2007 05:47:03 -0600 Matthew Wilcox <[email protected]> wrote:
The AdvanSys driver wants to align some pointers, and the ALIGN macro doesn't work for pointers. Rather than try to make it work, add a new
PTR_ALIGNmacro which is typesafe.Signed-off-by Matthew Wilcox <[email protected]>include/linux/kernel.h +0
-0
include/linux/kernel.h extern const char linux_proc_banner[]; · line 40
Quoted 7 lines
include/linux/kernel.h +1
-0@@ -34,6 +34,7 @@ extern const char linux_proc_banner[];#define ALIGN (x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)#define __ALIGN_MASK (x,mask) (((x)+(mask))&~(mask)) +#define PTR_ALIGN (p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))#define ARRAY_SIZE (arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
I'll plan on getting this thing of beauty into mainline in the next week or so, so you can get those advansys changes into James's tree.