lkml.org 
[lkml]   [2008]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/5 ver2] rt2x00: Compiler warning unmasked by fix of BUILD_BUG_ON
On Mon, Sep 1, 2008 at 3:44 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:
>
> A "Set" of a sign-bit in an "&" operation causes a compiler warning.
> Make calculations unsigned.
>
> [ The warning was masked by the use of (void)() cast in the old
> BUILD_BUG_ON() ]
>
> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
> TO: Ivo van Doorn <IvDoorn@gmail.com>
> TO: John W. Linville <linville@tuxdriver.com>
> CC: Ingo Molnar <mingo@elte.hu>
> CC: Rusty Russell <rusty@rustcorp.com.au>
> ---
> drivers/net/wireless/rt2x00/rt2x00reg.h | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h
> index 7e88ce5..e71b793 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00reg.h
> +++ b/drivers/net/wireless/rt2x00/rt2x00reg.h
> @@ -136,8 +136,8 @@ struct rt2x00_field32 {
> */
> #define is_power_of_two(x) ( !((x) & ((x)-1)) )
> #define low_bit_mask(x) ( ((x)-1) & ~(x) )
> -#define is_valid_mask(x) is_power_of_two(1 + (x) + low_bit_mask(x))
> -
> +#define is_valid_mask(x) is_power_of_two(1 + (x) + \
> + low_bit_mask((unsigned long)x))

I know I typed it wrong, but you are missing the unsigned long cast for the
is_power_of_two argument here (Which could also be done in the
is_valid_mask() definition).

> /*
> * Macro's to find first set bit in a variable.
> * These macro's behaves the same as the __ffs() function with
> --
> 1.5.6.rc1.5.gadf6
>
>
>


\
 
 \ /
  Last update: 2008-09-01 16:05    [from the cache]
©2003-2011 Jasper Spaans