mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] [linux-next] [staging] rtl8821ae: fixed defined-not-used warning
@ 2014-04-30 12:15 Jan Moskyto Matejka
  2014-04-30 12:39 ` Paul Bolle
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Moskyto Matejka @ 2014-04-30 12:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Mark Einon, devel, linux-kernel; +Cc: Jan Moskyto Matejka

The function  halbtc8192e2ant_iswifi_status_changed  is called only
at line 4158 which is #if'd in the same way as I'm now #if-ing the function.

Signed-off-by: Jan Moskyto Matejka <mq@suse.cz>
---
 drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c
index 81706f4..7af412d 100644
--- a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c
+++ b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c
@@ -503,6 +503,7 @@ static void halbtc8192e2ant_querybt_info(struct btc_coexist *btcoexist)
 	btcoexist->btc_fill_h2c(btcoexist, 0x61, 1, h2c_parameter);
 }
 
+#if (BT_AUTO_REPORT_ONLY_8192E_2ANT != 0)
 static bool halbtc8192e2ant_iswifi_status_changed(struct btc_coexist *btcoexist)
 {
 	static bool pre_wifi_busy;
@@ -534,6 +535,7 @@ static bool halbtc8192e2ant_iswifi_status_changed(struct btc_coexist *btcoexist)
 
 	return false;
 }
+#endif
 
 static void halbtc8192e2ant_update_btlink_info(struct btc_coexist *btcoexist)
 {
-- 
1.8.4.5


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [linux-next] [staging] rtl8821ae: fixed defined-not-used warning
  2014-04-30 12:15 [PATCH] [linux-next] [staging] rtl8821ae: fixed defined-not-used warning Jan Moskyto Matejka
@ 2014-04-30 12:39 ` Paul Bolle
  2014-04-30 12:51   ` Jan Moskyto Matejka
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Bolle @ 2014-04-30 12:39 UTC (permalink / raw)
  To: Jan Moskyto Matejka; +Cc: Greg Kroah-Hartman, Mark Einon, devel, linux-kernel

On Wed, 2014-04-30 at 14:15 +0200, Jan Moskyto Matejka wrote:
> --- a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c
> +++ b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c
> @@ -503,6 +503,7 @@ static void halbtc8192e2ant_querybt_info(struct btc_coexist *btcoexist)
>  	btcoexist->btc_fill_h2c(btcoexist, 0x61, 1, h2c_parameter);
>  }
>  
> +#if (BT_AUTO_REPORT_ONLY_8192E_2ANT != 0)
>  static bool halbtc8192e2ant_iswifi_status_changed(struct btc_coexist *btcoexist)
>  {
>  	static bool pre_wifi_busy;
> @@ -534,6 +535,7 @@ static bool halbtc8192e2ant_iswifi_status_changed(struct btc_coexist *btcoexist)
>  
>  	return false;
>  }
> +#endif
>  
>  static void halbtc8192e2ant_update_btlink_info(struct btc_coexist *btcoexist)
>  {

The output of 
    git grep BT_AUTO_REPORT_ONLY_8192E_2ANT next-20140430

is
    next-20140430:drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c:#if (BT_AUTO_REPORT_ONLY_8192E_2ANT == 1)
    next-20140430:drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c:#if (BT_AUTO_REPORT_ONLY_8192E_2ANT == 0)
    next-20140430:drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c:#if (BT_AUTO_REPORT_ONLY_8192E_2ANT == 0)
    next-20140430:drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.h:#define     BT_AUTO_REPORT_ONLY_8192E_2ANT                  0

So it seems that some trivial cleaning up is possible. Ie, drop the
#define and drop the three tests that are either always true or always
false. Is there a reason not to do that cleaning up?


Paul Bolle


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [linux-next] [staging] rtl8821ae: fixed defined-not-used warning
  2014-04-30 12:39 ` Paul Bolle
@ 2014-04-30 12:51   ` Jan Moskyto Matejka
  2014-04-30 13:22     ` [PATCH v2] " Jan Moskyto Matejka
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Moskyto Matejka @ 2014-04-30 12:51 UTC (permalink / raw)
  To: Paul Bolle; +Cc: Greg Kroah-Hartman, Mark Einon, devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1949 bytes --]

On Wed, Apr 30, 2014 at 02:39:50PM +0200, Paul Bolle wrote:
> On Wed, 2014-04-30 at 14:15 +0200, Jan Moskyto Matejka wrote:
> > --- a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c
> > +++ b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c
> > @@ -503,6 +503,7 @@ static void halbtc8192e2ant_querybt_info(struct btc_coexist *btcoexist)
> >  	btcoexist->btc_fill_h2c(btcoexist, 0x61, 1, h2c_parameter);
> >  }
> >  
> > +#if (BT_AUTO_REPORT_ONLY_8192E_2ANT != 0)
> >  static bool halbtc8192e2ant_iswifi_status_changed(struct btc_coexist *btcoexist)
> >  {
> >  	static bool pre_wifi_busy;
> > @@ -534,6 +535,7 @@ static bool halbtc8192e2ant_iswifi_status_changed(struct btc_coexist *btcoexist)
> >  
> >  	return false;
> >  }
> > +#endif
> >  
> >  static void halbtc8192e2ant_update_btlink_info(struct btc_coexist *btcoexist)
> >  {
> 
> The output of 
>     git grep BT_AUTO_REPORT_ONLY_8192E_2ANT next-20140430
> 
> is
>     next-20140430:drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c:#if (BT_AUTO_REPORT_ONLY_8192E_2ANT == 1)
>     next-20140430:drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c:#if (BT_AUTO_REPORT_ONLY_8192E_2ANT == 0)
>     next-20140430:drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c:#if (BT_AUTO_REPORT_ONLY_8192E_2ANT == 0)
>     next-20140430:drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.h:#define     BT_AUTO_REPORT_ONLY_8192E_2ANT                  0
> 
> So it seems that some trivial cleaning up is possible. Ie, drop the
> #define and drop the three tests that are either always true or always
> false. Is there a reason not to do that cleaning up?

I thought this part of code is here for somebody who wants to make a
custom build with this variable changed to compile in the other
behaviour. But after a while, it stopped to make sense for me. I may
clean it up. I'll send a cleanup-patch later.
-- 
Jan Matějka <mq@suse.cz>
SUSE Labs

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] [linux-next] [staging] rtl8821ae: fixed defined-not-used warning
  2014-04-30 12:51   ` Jan Moskyto Matejka
@ 2014-04-30 13:22     ` Jan Moskyto Matejka
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Moskyto Matejka @ 2014-04-30 13:22 UTC (permalink / raw)
  To: Paul Bolle, Greg Kroah-Hartman, Mark Einon, devel, linux-kernel
  Cc: Jan Moskyto Matejka

by cleaning up BT_AUTO_REPORT_ONLY_8192E_2ANT
(always set to 0, never used as constant)

halbtc8192e2ant_iswifi_status_changed was called only from the unused code

Signed-off-by: Jan Moskyto Matejka <mq@suse.cz>
---
 .../staging/rtl8821ae/btcoexist/halbtc8192e2ant.c  | 43 ----------------------
 .../staging/rtl8821ae/btcoexist/halbtc8192e2ant.h  |  2 -
 2 files changed, 45 deletions(-)

diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c
index 81706f4..d238179 100644
--- a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c
+++ b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.c
@@ -503,38 +503,6 @@ static void halbtc8192e2ant_querybt_info(struct btc_coexist *btcoexist)
 	btcoexist->btc_fill_h2c(btcoexist, 0x61, 1, h2c_parameter);
 }
 
-static bool halbtc8192e2ant_iswifi_status_changed(struct btc_coexist *btcoexist)
-{
-	static bool pre_wifi_busy;
-	static bool pre_under_4way, pre_bt_hson;
-	bool wifi_busy = false, under_4way = false, bt_hson = false;
-	bool wifi_connected = false;
-
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_CONNECTED,
-			   &wifi_connected);
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy);
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hson);
-	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS,
-			   &under_4way);
-
-	if (wifi_connected) {
-		if (wifi_busy != pre_wifi_busy) {
-			pre_wifi_busy = wifi_busy;
-			return true;
-		}
-		if (under_4way != pre_under_4way) {
-			pre_under_4way = under_4way;
-			return true;
-		}
-		if (bt_hson != pre_bt_hson) {
-			pre_bt_hson = bt_hson;
-			return true;
-		}
-	}
-
-	return false;
-}
-
 static void halbtc8192e2ant_update_btlink_info(struct btc_coexist *btcoexist)
 {
 	struct btc_bt_link_info *bt_link_info = &btcoexist->bt_link_info;
@@ -3833,9 +3801,6 @@ void ex_halbtc8192e2ant_display_coex_info(struct btc_coexist *btcoexist)
 		   "0x774(lp rx[31:16]/tx[15:0])",
 		   coex_sta->low_priority_rx, coex_sta->low_priority_tx);
 	CL_PRINTF(cli_buf);
-#if (BT_AUTO_REPORT_ONLY_8192E_2ANT == 1)
-	halbtc8192e2ant_monitor_bt_ctr(btcoexist);
-#endif
 	btcoexist->btc_disp_dbg_msg(btcoexist, BTC_DBG_DISP_COEX_STATISTICS);
 }
 
@@ -4011,14 +3976,12 @@ void ex_halbtc8192e2ant_bt_info_notify(struct btc_coexist *btcoexist,
 			 * do nothing here. */
 		}
 
-#if (BT_AUTO_REPORT_ONLY_8192E_2ANT == 0)
 		if ((coex_sta->bt_info_ext & BIT4)) {
 			/* BT auto report already enabled, do nothing */
 		} else {
 			halbtc8192e2ant_bt_autoreport(btcoexist, FORCE_EXEC,
 						      true);
 		}
-#endif
 	}
 
 	/* check BIT2 first ==> check if bt is under inquiry or page scan */
@@ -4148,14 +4111,8 @@ void ex_halbtc8192e2ant_periodical(struct btc_coexist *btcoexist)
 			  "************************************************\n");
 	}
 
-#if (BT_AUTO_REPORT_ONLY_8192E_2ANT == 0)
 	halbtc8192e2ant_querybt_info(btcoexist);
 	halbtc8192e2ant_monitor_bt_ctr(btcoexist);
 	halbtc8192e2ant_monitor_bt_enable_disable(btcoexist);
-#else
-	if (halbtc8192e2ant_iswifi_status_changed(btcoexist) ||
-	    coex_dm->auto_tdma_adjust)
-		halbtc8192e2ant_run_coexist_mechanism(btcoexist);
-#endif
 }
 
diff --git a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.h b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.h
index 6d109edb..416d3dda 100644
--- a/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.h
+++ b/drivers/staging/rtl8821ae/btcoexist/halbtc8192e2ant.h
@@ -1,8 +1,6 @@
 /*****************************************************************
  *   The following is for 8192E 2Ant BT Co-exist definition
  *****************************************************************/
-#define	BT_AUTO_REPORT_ONLY_8192E_2ANT			0
-
 #define	BT_INFO_8192E_2ANT_B_FTP			BIT7
 #define	BT_INFO_8192E_2ANT_B_A2DP			BIT6
 #define	BT_INFO_8192E_2ANT_B_HID			BIT5
-- 
1.8.4.5


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-30 13:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-30 12:15 [PATCH] [linux-next] [staging] rtl8821ae: fixed defined-not-used warning Jan Moskyto Matejka
2014-04-30 12:39 ` Paul Bolle
2014-04-30 12:51   ` Jan Moskyto Matejka
2014-04-30 13:22     ` [PATCH v2] " Jan Moskyto Matejka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®