From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752238AbYIAN1S (ORCPT ); Mon, 1 Sep 2008 09:27:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750762AbYIAN1E (ORCPT ); Mon, 1 Sep 2008 09:27:04 -0400 Received: from rv-out-0506.google.com ([209.85.198.234]:15503 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750800AbYIAN1C (ORCPT ); Mon, 1 Sep 2008 09:27:02 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Eh38LEn7egJLH7EDgvZUVbdMUWI0kRy8ybq5Im8CVSSsgWCSV7lUvpLUG2Nup8zcId hCkMeuwSOu+ound/DytNf50gYe5WRvf6jaCkiJz2VDNFM/x/5H6lFZxgxddJK9gWMIpk ipGY8tq1BloQNdhndtavlA83eziD8e392+C3M= Message-ID: Date: Mon, 1 Sep 2008 15:27:01 +0200 From: "Ivo Van Doorn" To: "Boaz Harrosh" Subject: Re: [PATCH 4/5] rt2x00: Compiler warning unmasked by fix of BUILD_BUG_ON Cc: "Ingo Molnar" , "Rusty Russell" , "David S. Miller" , "John W. Linville" , "Alexey Dobriyan" , "Andrew Morton" , "Theodore Tso" , "Linus Torvalds" , "Jan Beulich" , linux-kernel In-Reply-To: <48BBEC6C.1050301@panasas.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <48BBE77D.7070007@panasas.com> <48BBEC6C.1050301@panasas.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 1, 2008 at 3:21 PM, Boaz Harrosh wrote: > > A "Set" of the 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 > TO: Ivo van Doorn > TO: John W. Linville > CC: Ingo Molnar > CC: Rusty Russell > --- > 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..c0e8706 100644 > --- a/drivers/net/wireless/rt2x00/rt2x00reg.h > +++ b/drivers/net/wireless/rt2x00/rt2x00reg.h > @@ -134,8 +134,8 @@ struct rt2x00_field32 { > * Note that we cannot use the is_power_of_2() function since this > * check must be done at compile-time. > */ > -#define is_power_of_two(x) ( !((x) & ((x)-1)) ) > -#define low_bit_mask(x) ( ((x)-1) & ~(x) ) > +#define is_power_of_two(x) ( !((unsigned)(x) & ((x)-1)) ) > +#define low_bit_mask(x) ( ((unsigned)(x)-1) & ~(x) ) > #define is_valid_mask(x) is_power_of_two(1 + (x) + low_bit_mask(x)) Could the patch not become a lot easier (and perhaps cleaner) when the only change is: #define is_valid_mask(x) is_power_of_two(1 + (x) + low_bit_mask((unsigned)x)) that way all instances of x will be cast to unsigned... Ivo