All of lore.kernel.org
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ping-Ke Shih <pkshih@realtek.com>,
	Yan-Hsuan Chuang <yhchuang@realtek.com>,
	Birming Chiu <birming@realtek.com>, Shaofu <shaofu@realtek.com>,
	Steven Ting <steventing@realtek.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] staging: rtlwifi: simplify logical operation
Date: Thu, 24 Aug 2017 14:06:41 -0500	[thread overview]
Message-ID: <becca849-e24f-4bff-a142-a10a2c5d6d3b@lwfinger.net> (raw)
In-Reply-To: <20170823132337.517466-3-arnd@arndb.de>

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 <arnd@arndb.de>

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.Finger@lwfinger.net>

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:
> 

      reply	other threads:[~2017-08-24 19:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170823132337.517466-1-arnd@arndb.de>
2017-08-23 13:22 ` [PATCH 2/3] staging: rtlwifi: add MAC80211 dependency Arnd Bergmann
2017-08-23 15:44   ` Randy Dunlap
2017-08-23 23:19     ` Greg Kroah-Hartman
2017-08-23 23:29       ` Greg Kroah-Hartman
2017-08-24 19:23   ` Larry Finger
2017-08-24 23:59     ` Greg Kroah-Hartman
2017-08-23 13:22 ` [PATCH 3/3] staging: rtlwifi: simplify logical operation Arnd Bergmann
2017-08-24 19:06   ` Larry Finger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=becca849-e24f-4bff-a142-a10a2c5d6d3b@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=arnd@arndb.de \
    --cc=birming@realtek.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pkshih@realtek.com \
    --cc=shaofu@realtek.com \
    --cc=steventing@realtek.com \
    --cc=yhchuang@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.