lkml.org 
[lkml]   [2011]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [cpuops cmpxchg double V3 3/5] Generic support for this_cpu_cmpxchg_double
On Fri, Feb 25, 2011 at 11:38:53AM -0600, Christoph Lameter wrote:
>
> +/*
> + * Special handling for cmpxchg_double. cmpxchg_double is passed two
> + * percpu variables. The first has to be aligned to a double word
> + * boundary and the second has to follow directly thereafter.
> + */
> +#define __pcpu_double_call_return_int(stem, pcp1, pcp2, ...) \
> +({ \
> + int ret__; \
> + __verify_pcpu_ptr(&pcp1); \
> + VM_BUG_ON((unsigned long)(&pcp1) % (2 * sizeof(pcp1))); \
> + VM_BUG_ON((unsigned long)(&pcp2) != (unsigned long)(&pcp1) + sizeof(pcp1));\
> + VM_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \

Since this is a macro, and it looks like all these are constants (sizeof
and addresses), couldn't you just do a BUILD_BUG_ON() instead?

-- Steve


> + switch(sizeof(pcp1)) { \
> + case 1: ret__ = stem##1(pcp1, pcp2, __VA_ARGS__);break; \
> + case 2: ret__ = stem##2(pcp1, pcp2, __VA_ARGS__);break; \
> + case 4: ret__ = stem##4(pcp1, pcp2, __VA_ARGS__);break; \
> + case 8: ret__ = stem##8(pcp1, pcp2, __VA_ARGS__);break; \
> + default: \
> + __bad_size_call_parameter();break; \
> + } \
> + ret__; \
> +})
> +


\
 
 \ /
  Last update: 2011-02-25 21:31    [from the cache]
©2003-2011 Jasper Spaans