Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1718348 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2017-08-23 15:30 +0200 |
| Last post | 2017-08-24 21:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 3/3] staging: rtlwifi: simplify logical operation Arnd Bergmann <arnd@arndb.de> - 2017-08-23 15:30 +0200
Re: [PATCH 3/3] staging: rtlwifi: simplify logical operation Larry Finger <Larry.Finger@lwfinger.net> - 2017-08-24 21:10 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2017-08-23 15:30 +0200 |
| Subject | [PATCH 3/3] staging: rtlwifi: simplify logical operation |
| Message-ID | <uhDTk-14P-21@gated-at.bofh.it> |
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>
---
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:
--
2.9.0
[toc] | [next] | [standalone]
| From | Larry Finger <Larry.Finger@lwfinger.net> |
|---|---|
| Date | 2017-08-24 21:10 +0200 |
| Message-ID | <ui5FT-25C-3@gated-at.bofh.it> |
| In reply to | #1718348 |
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:
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web