diff mbox

[06/10] rtlwifi: btcoex: 21a 2ant: run mechanism if status changes or auto adjust is set

Message ID 20170416190428.23857-7-Larry.Finger@lwfinger.net (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Larry Finger April 16, 2017, 7:04 p.m. UTC
From: Yan-Hsuan Chuang <yhchuang@realtek.com>

The driver will periodically ask the coex, and the coex only runs the
mechanism when the status was changed or the auto adjust is set.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Pkshih <pkshih@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
---
 .../net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c  | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Kalle Valo April 20, 2017, 10:54 a.m. UTC | #1
Larry Finger <Larry.Finger@lwfinger.net> writes:

> From: Yan-Hsuan Chuang <yhchuang@realtek.com>
>
> The driver will periodically ask the coex, and the coex only runs the
> mechanism when the status was changed or the auto adjust is set.
>
> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Pkshih <pkshih@realtek.com>
> Cc: Birming Chiu <birming@realtek.com>
> Cc: Shaofu <shaofu@realtek.com>
> Cc: Steven Ting <steventing@realtek.com>

[...]

> @@ -4200,7 +4200,14 @@ void ex_btc8821a2ant_periodical(struct btc_coexist *btcoexist)
>  			 "[BTCoex], ****************************************************************\n");
>  	}
>  
> +#ifdef BT_AUTO_REPORT_ONLY_8821A_2ANT
>  	btc8821a2ant_query_bt_info(btcoexist);
> +#else
>  	btc8821a2ant_monitor_bt_ctr(btcoexist);
>  	btc8821a2ant_monitor_wifi_ctr(btcoexist);
> +
> +	if (btc8821a2ant_is_wifi_status_changed(btcoexist) ||
> +	    coex_dm->auto_tdma_adjust)
> +		btc8821a2ant_run_coexist_mechanism(btcoexist);
> +#endif

This ifdef looks fishy. Why is it needed?

In general I would expect to see ifdefs only for Kconfig options or
defines which value comes from core kernel.
Tony Chuang April 20, 2017, 1:30 p.m. UTC | #2
Dear SY,

Linux kernel upstream 上面對於這種 ifdef 的方式是不認同的
能否用其他的方式來代替呢?
或是利用變數來控制。

另外如果default是跑哪邊,某一路只是for special case的話
可以先把其中一邊拿掉。
先上upstream 之後再來refine


Best Regards,
Tony

-----Original Message-----
From: Kalle Valo [mailto:kvalo@codeaurora.org] 

Sent: Thursday, April 20, 2017 6:54 PM
To: Larry Finger
Cc: linux-wireless@vger.kernel.org; 莊彥宣; Pkshih; Birming Chiu; Shaofu; Steven Ting
Subject: Re: [PATCH 06/10] rtlwifi: btcoex: 21a 2ant: run mechanism if status changes or auto adjust is set

Larry Finger <Larry.Finger@lwfinger.net> writes:

> From: Yan-Hsuan Chuang <yhchuang@realtek.com>

>

> The driver will periodically ask the coex, and the coex only runs the 

> mechanism when the status was changed or the auto adjust is set.

>

> Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>

> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>

> Cc: Pkshih <pkshih@realtek.com>

> Cc: Birming Chiu <birming@realtek.com>

> Cc: Shaofu <shaofu@realtek.com>

> Cc: Steven Ting <steventing@realtek.com>


[...]

> @@ -4200,7 +4200,14 @@ void ex_btc8821a2ant_periodical(struct btc_coexist *btcoexist)

>  			 "[BTCoex], ****************************************************************\n");

>  	}

>  

> +#ifdef BT_AUTO_REPORT_ONLY_8821A_2ANT

>  	btc8821a2ant_query_bt_info(btcoexist);

> +#else

>  	btc8821a2ant_monitor_bt_ctr(btcoexist);

>  	btc8821a2ant_monitor_wifi_ctr(btcoexist);

> +

> +	if (btc8821a2ant_is_wifi_status_changed(btcoexist) ||

> +	    coex_dm->auto_tdma_adjust)

> +		btc8821a2ant_run_coexist_mechanism(btcoexist);

> +#endif


This ifdef looks fishy. Why is it needed?

In general I would expect to see ifdefs only for Kconfig options or defines which value comes from core kernel.

--
Kalle Valo

------Please consider the environment before printing this e-mail.
diff mbox

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
index ca7649dca352..56972d36fe84 100644
--- a/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
+++ b/drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8821a2ant.c
@@ -3485,14 +3485,14 @@  static void btc8821a2ant_run_coexist_mechanism(struct btc_coexist *btcoexist)
 	if (btc8821a2ant_is_common_action(btcoexist)) {
 		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
 			 "[BTCoex], Action 2-Ant common\n");
-		coex_dm->reset_tdma_adjust = true;
+		coex_dm->auto_tdma_adjust = true;
 	} else {
 		if (coex_dm->cur_algorithm != coex_dm->pre_algorithm) {
 			RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
 				 "[BTCoex], pre_algorithm = %d, cur_algorithm = %d\n",
 				    coex_dm->pre_algorithm,
 				    coex_dm->cur_algorithm);
-			coex_dm->reset_tdma_adjust = true;
+			coex_dm->auto_tdma_adjust = false;
 		}
 		switch (coex_dm->cur_algorithm) {
 		case BT_8821A_2ANT_COEX_ALGO_SCO:
@@ -4200,7 +4200,14 @@  void ex_btc8821a2ant_periodical(struct btc_coexist *btcoexist)
 			 "[BTCoex], ****************************************************************\n");
 	}
 
+#ifdef BT_AUTO_REPORT_ONLY_8821A_2ANT
 	btc8821a2ant_query_bt_info(btcoexist);
+#else
 	btc8821a2ant_monitor_bt_ctr(btcoexist);
 	btc8821a2ant_monitor_wifi_ctr(btcoexist);
+
+	if (btc8821a2ant_is_wifi_status_changed(btcoexist) ||
+	    coex_dm->auto_tdma_adjust)
+		btc8821a2ant_run_coexist_mechanism(btcoexist);
+#endif
 }