From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752582AbYIBOWN (ORCPT ); Tue, 2 Sep 2008 10:22:13 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751336AbYIBOV6 (ORCPT ); Tue, 2 Sep 2008 10:21:58 -0400 Received: from gw-colo-pa.panasas.com ([66.238.117.130]:30473 "EHLO natasha.panasas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751121AbYIBOV5 (ORCPT ); Tue, 2 Sep 2008 10:21:57 -0400 Message-ID: <48BD4BB3.7040808@panasas.com> Date: Tue, 02 Sep 2008 17:20:35 +0300 From: Boaz Harrosh User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: Ivo van Doorn CC: Ingo Molnar , Rusty Russell , "David S. Miller" , "John W. Linville" , Alexey Dobriyan , Andrew Morton , Theodore Tso , Linus Torvalds , Jan Beulich , linux-kernel Subject: Re: [PATCH 4/5 ver2] rt2x00: Compiler warning unmasked by fix of BUILD_BUG_ON References: <48BBE77D.7070007@panasas.com> <48BC077A.9000106@panasas.com> <200809011834.45856.IvDoorn@gmail.com> In-Reply-To: <200809011834.45856.IvDoorn@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 02 Sep 2008 14:19:46.0356 (UTC) FILETIME=[F388BF40:01C90D06] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ivo van Doorn wrote: > On Monday 01 September 2008, Boaz Harrosh wrote: >> Ivo Van Doorn wrote: >> >> Do you want that I send a fix for readability's sake? > > Yes, thanks. > >> 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(1LU + (unsigned long)(x) + \ >> + low_bit_mask((unsigned long)x)) BTW doing only: -#define is_valid_mask(x) is_power_of_two(1 + (x) + low_bit_mask(x)) +#define is_valid_mask(x) is_power_of_two(1LU (x) + low_bit_mask(x)) Also fixes the problem. (By definition of C type promotion rules) Should I do just That? >> /* >> * 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ >> This is my suggested new patch: --- From: Boaz Harrosh Date: Mon, 1 Sep 2008 14:47:19 +0300 Subject: [PATCH] rt2x00: Compiler warning unmasked by fix of BUILD_BUG_ON A "Set" to a sign-bit in an "&" operation causes a compiler warning. Make calculations unsigned. [ The warning was masked by the old definition of BUILD_BUG_ON() ] Also remove __builtin_constant_p from FIELD_CHECK since BUILD_BUG_ON no longer permits non-const values. Signed-off-by: Boaz Harrosh TO: Ivo van Doorn TO: John W. Linville CC: Ingo Molnar CC: Rusty Russell --- drivers/net/wireless/rt2x00/rt2x00reg.h | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/rt2x00/rt2x00reg.h b/drivers/net/wireless/rt2x00/rt2x00reg.h index 7e88ce5..2ea7866 100644 --- a/drivers/net/wireless/rt2x00/rt2x00reg.h +++ b/drivers/net/wireless/rt2x00/rt2x00reg.h @@ -136,7 +136,7 @@ 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(1LU + (x) + low_bit_mask(x)) /* * Macro's to find first set bit in a variable. @@ -173,8 +173,7 @@ struct rt2x00_field32 { * does not exceed the given typelimit. */ #define FIELD_CHECK(__mask, __type) \ - BUILD_BUG_ON(!__builtin_constant_p(__mask) || \ - !(__mask) || \ + BUILD_BUG_ON(!(__mask) || \ !is_valid_mask(__mask) || \ (__mask) != (__type)(__mask)) \ -- 1.5.6.rc1.5.gadf6