Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753570AbdHXTGs (ORCPT ); Thu, 24 Aug 2017 15:06:48 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:38196 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753470AbdHXTGn (ORCPT ); Thu, 24 Aug 2017 15:06:43 -0400 Subject: Re: [PATCH 3/3] staging: rtlwifi: simplify logical operation To: Arnd Bergmann , Greg Kroah-Hartman Cc: Ping-Ke Shih , Yan-Hsuan Chuang , Birming Chiu , Shaofu , Steven Ting , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org References: <20170823132337.517466-1-arnd@arndb.de> <20170823132337.517466-3-arnd@arndb.de> From: Larry Finger Message-ID: Date: Thu, 24 Aug 2017 14:06:41 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170823132337.517466-3-arnd@arndb.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1932 Lines: 46 On 08/23/2017 08:22 AM, Arnd Bergmann wrote: > gcc notices a very complicated way to check a value > for being equal to one, and warns about it: > > drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c: In function 'halbtc8822b1ant_set_ext_ant_switch': > drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c:2105:9: error: '~' on a boolean expression [-Werror=bool-operation] > ~switch_polatiry_inverse : > ^ > drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c:2105:9: note: did you mean to use logical not? > ~switch_polatiry_inverse : > ^ > > This simplifies this expression to make it more readable > and to make gcc happy. > > Fixes: 56bde846304e ("staging: r8822be: Add existing rtlwifi and rtl_pci parts for new driver") > Signed-off-by: Arnd Bergmann Yes, it should have bee logical not rather than a bitwise inversion. Your version is much more readable. In a followup, I will fix the spelling of polarity, but yours is fine. Acked-by: Larry Finger Larry > --- > drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c b/drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c > index 933d188d52b4..157395b85405 100644 > --- a/drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c > +++ b/drivers/staging/rtlwifi/btcoexist/halbtc8822b1ant.c > @@ -2101,9 +2101,7 @@ static void halbtc8822b1ant_set_ext_ant_switch(struct btc_coexist *btcoexist, > * 0xcbd[1:0] = 2b'01 => Ant to BTG, > * 0xcbd[1:0] = 2b'10 => Ant to WLG > */ > - switch_polatiry_inverse = (rfe_type->ext_ant_switch_ctrl_polarity == 1 ? > - ~switch_polatiry_inverse : > - switch_polatiry_inverse); > + switch_polatiry_inverse = rfe_type->ext_ant_switch_ctrl_polarity == 1; > > switch (pos_type) { > default: >