LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] rtlwifi: remove duplicate code
@ 2018-05-24 18:54 Gustavo A. R. Silva
2018-05-24 19:24 ` Joe Perches
2018-05-29 7:28 ` Kalle Valo
0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-05-24 18:54 UTC (permalink / raw)
To: Ping-Ke Shih, Kalle Valo, David S. Miller
Cc: linux-wireless, netdev, linux-kernel, Gustavo A. R. Silva
Remove and refactor some code in order to avoid having identical code
for different branches.
Notice that the logic has been there since 2014.
Addresses-Coverity-ID: 1426199 ("Identical code for different branches")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
.../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c | 23 ++++------------------
1 file changed, 4 insertions(+), 19 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
index 279fe01..df3facc 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
@@ -2876,25 +2876,10 @@ static void btc8723b2ant_action_hid(struct btc_coexist *btcoexist)
btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 13);
/* sw mechanism */
- if (BTC_WIFI_BW_HT40 == wifi_bw) {
- if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- btc8723b2ant_sw_mechanism(btcoexist, true, true,
- false, false);
- } else {
- btc8723b2ant_sw_mechanism(btcoexist, true, true,
- false, false);
- }
- } else {
- if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
- (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
- btc8723b2ant_sw_mechanism(btcoexist, false, true,
- false, false);
- } else {
- btc8723b2ant_sw_mechanism(btcoexist, false, true,
- false, false);
- }
- }
+ if (wifi_bw == BTC_WIFI_BW_HT40)
+ btc8723b2ant_sw_mechanism(btcoexist, true, true, false, false);
+ else
+ btc8723b2ant_sw_mechanism(btcoexist, false, true, false, false);
}
/* A2DP only / PAN(EDR) only/ A2DP+PAN(HS) */
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rtlwifi: remove duplicate code
2018-05-24 18:54 [PATCH] rtlwifi: remove duplicate code Gustavo A. R. Silva
@ 2018-05-24 19:24 ` Joe Perches
2018-05-24 19:47 ` Gustavo A. R. Silva
2018-05-29 7:28 ` Kalle Valo
1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2018-05-24 19:24 UTC (permalink / raw)
To: Gustavo A. R. Silva, Ping-Ke Shih, Kalle Valo, David S. Miller
Cc: linux-wireless, netdev, linux-kernel
On Thu, 2018-05-24 at 13:54 -0500, Gustavo A. R. Silva wrote:
> Remove and refactor some code in order to avoid having identical code
> for different branches.
True and nice tool and patch submittal thanks.
> Notice that the logic has been there since 2014.
But perhaps the original logic is a defective copy/paste
and it should be corrected instead.
Can anyone from realtek verify this?
> Addresses-Coverity-ID: 1426199 ("Identical code for different branches")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c | 23 ++++------------------
> 1 file changed, 4 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
> index 279fe01..df3facc 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
> @@ -2876,25 +2876,10 @@ static void btc8723b2ant_action_hid(struct btc_coexist *btcoexist)
> btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 13);
>
> /* sw mechanism */
> - if (BTC_WIFI_BW_HT40 == wifi_bw) {
> - if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
> - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
> - btc8723b2ant_sw_mechanism(btcoexist, true, true,
> - false, false);
> - } else {
> - btc8723b2ant_sw_mechanism(btcoexist, true, true,
> - false, false);
> - }
> - } else {
> - if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
> - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
> - btc8723b2ant_sw_mechanism(btcoexist, false, true,
> - false, false);
> - } else {
> - btc8723b2ant_sw_mechanism(btcoexist, false, true,
> - false, false);
> - }
> - }
> + if (wifi_bw == BTC_WIFI_BW_HT40)
> + btc8723b2ant_sw_mechanism(btcoexist, true, true, false, false);
> + else
> + btc8723b2ant_sw_mechanism(btcoexist, false, true, false, false);
> }
>
> /* A2DP only / PAN(EDR) only/ A2DP+PAN(HS) */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rtlwifi: remove duplicate code
2018-05-24 19:24 ` Joe Perches
@ 2018-05-24 19:47 ` Gustavo A. R. Silva
0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-05-24 19:47 UTC (permalink / raw)
To: Joe Perches, Ping-Ke Shih, Kalle Valo, David S. Miller
Cc: linux-wireless, netdev, linux-kernel
Hi Joe,
On 05/24/2018 02:24 PM, Joe Perches wrote:
> On Thu, 2018-05-24 at 13:54 -0500, Gustavo A. R. Silva wrote:
>> Remove and refactor some code in order to avoid having identical code
>> for different branches.
>
> True and nice tool and patch submittal thanks.
>
>> Notice that the logic has been there since 2014.
>
> But perhaps the original logic is a defective copy/paste
> and it should be corrected instead.
>
> Can anyone from realtek verify this?
>
I actually used gitk to track down the last changes made to this code
and, it doesn't look like a copy/paste issue:
commit: c6821613e653aae4f54c75689e229e3f063b7f69
commit: 27a31a60a4de4c1b45e371152bb6e701e1a8cc40
Thanks
--
Gustavo
>> Addresses-Coverity-ID: 1426199 ("Identical code for different branches")
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> ---
>> .../realtek/rtlwifi/btcoexist/halbtc8723b2ant.c | 23 ++++------------------
>> 1 file changed, 4 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
>> index 279fe01..df3facc 100644
>> --- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
>> +++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8723b2ant.c
>> @@ -2876,25 +2876,10 @@ static void btc8723b2ant_action_hid(struct btc_coexist *btcoexist)
>> btc8723b2ant_ps_tdma(btcoexist, NORMAL_EXEC, true, 13);
>>
>> /* sw mechanism */
>> - if (BTC_WIFI_BW_HT40 == wifi_bw) {
>> - if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
>> - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
>> - btc8723b2ant_sw_mechanism(btcoexist, true, true,
>> - false, false);
>> - } else {
>> - btc8723b2ant_sw_mechanism(btcoexist, true, true,
>> - false, false);
>> - }
>> - } else {
>> - if ((wifi_rssi_state == BTC_RSSI_STATE_HIGH) ||
>> - (wifi_rssi_state == BTC_RSSI_STATE_STAY_HIGH)) {
>> - btc8723b2ant_sw_mechanism(btcoexist, false, true,
>> - false, false);
>> - } else {
>> - btc8723b2ant_sw_mechanism(btcoexist, false, true,
>> - false, false);
>> - }
>> - }
>> + if (wifi_bw == BTC_WIFI_BW_HT40)
>> + btc8723b2ant_sw_mechanism(btcoexist, true, true, false, false);
>> + else
>> + btc8723b2ant_sw_mechanism(btcoexist, false, true, false, false);
>> }
>>
>> /* A2DP only / PAN(EDR) only/ A2DP+PAN(HS) */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: rtlwifi: remove duplicate code
2018-05-24 18:54 [PATCH] rtlwifi: remove duplicate code Gustavo A. R. Silva
2018-05-24 19:24 ` Joe Perches
@ 2018-05-29 7:28 ` Kalle Valo
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2018-05-29 7:28 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Ping-Ke Shih, David S. Miller, linux-wireless, netdev,
linux-kernel, Gustavo A. R. Silva
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
> Remove and refactor some code in order to avoid having identical code
> for different branches.
>
> Notice that the logic has been there since 2014.
>
> Addresses-Coverity-ID: 1426199 ("Identical code for different branches")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Patch applied to wireless-drivers-next.git, thanks.
06895b1627fe rtlwifi: remove duplicate code
--
https://patchwork.kernel.org/patch/10425379/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-29 7:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-24 18:54 [PATCH] rtlwifi: remove duplicate code Gustavo A. R. Silva
2018-05-24 19:24 ` Joe Perches
2018-05-24 19:47 ` Gustavo A. R. Silva
2018-05-29 7:28 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).