Skip to contentSkip to conversation

staging: rtlwifi: Remove unnecessary functions

PATCH New Maya Nakamura 1 participant 4 messages Oct 27, 2018 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover staging: rtlwifi: Remove unnecessary functions

This patchset removes functions that only return zero or the second argument. It also removes the functions that are not used at all.

For version two, changes are applied based on Julia's feedback and checkpatch results. Other modifications include braces and spacing.

Maya Nakamura (3):
staging: rtlwifi: Remove function that only returns the second
argument
staging: rtlwifi: Remove function that only returns zero
staging: rtlwifi: Remove unused functions

 .../staging/rtlwifi/phydm/phydm_hwconfig.c    | 107 ++++--------------
 .../staging/rtlwifi/phydm/phydm_hwconfig.h    |  12 --
 2 files changed, 20 insertions(+), 99 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/3 staging: rtlwifi: Remove function that only returns the second argument

Because the odm_signal_scale_mapping function is only called to return the second argument, remove the unnecessary function and change the statements that call it, including removing unneeded braces and adding a blank line.

Note that removing casts (u8 to s32 and back to u8) will not lose information because the value converted should be between 0 and 100.

---
Changes since v1:
- Remove casts to u8 and a note to the commit message.
- Remove unneeded braces from if-else statements.
- Add a blank line after an if-else statement.

 .../staging/rtlwifi/phydm/phydm_hwconfig.c    | 55 ++++++-------------
 .../staging/rtlwifi/phydm/phydm_hwconfig.h    |  2 -
 2 files changed, 17 insertions(+), 40 deletions(-)
drivers/staging/rtlwifi/phydm/phydm_hwconfig.c +17 -38
index 4bf86e5a451f..c71ac1276ebe 100644
@@ -477,18 +477,6 @@ static u8 odm_query_rx_pwr_percentage(s8 ant_power)
 		return 100 + ant_power;
 }
 
-/*
- * 2012/01/12 MH MOve some signal strength smooth method to MP HAL layer.
- * IF other SW team do not support the feature, remove this section.??
- */
-
-s32 odm_signal_scale_mapping(struct phy_dm_struct *dm, s32 curr_sig)
-{
-	{
-		return curr_sig;
-	}
-}
-
 static u8 odm_sq_process_patch_rt_cid_819x_lenovo(struct phy_dm_struct *dm,
 						  u8 is_cck_rate, u8 pwdb_all,
 						  u8 path, u8 RSSI)
@@ -748,16 +736,10 @@ static void odm_rx_phy_status92c_series_parsing(
 	 * from 0~100.
 	 */
 	/* It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). */
-	if (is_cck_rate) {
-		phy_info->signal_strength = (u8)(
-			odm_signal_scale_mapping(dm, pwdb_all)); /*pwdb_all;*/
-	} else {
-		if (rf_rx_num != 0) {
-			phy_info->signal_strength =
-				(u8)(odm_signal_scale_mapping(dm, total_rssi /=
-								  rf_rx_num));
-		}
-	}
+	if (is_cck_rate)
+		phy_info->signal_strength = pwdb_all;
+	else if (rf_rx_num != 0)
+		phy_info->signal_strength = (total_rssi /= rf_rx_num);
 
 	/* For 92C/92D HW (Hybrid) Antenna Diversity */
 }
@@ -1051,21 +1033,19 @@ static void odm_rx_phy_status_jaguar_series_parsing(
 	 */
 	/*It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp().*/
 	if (is_cck_rate) {
-		phy_info->signal_strength = (u8)(
-			odm_signal_scale_mapping(dm, pwdb_all)); /*pwdb_all;*/
-	} else {
-		if (rf_rx_num != 0) {
-			/* 2015/01 Sean, use the best two RSSI only,
-			 * suggested by Ynlin and ChenYu.
-			 */
-			if (rf_rx_num == 1)
-				avg_rssi = best_rssi;
-			else
-				avg_rssi = (best_rssi + second_rssi) / 2;
-			phy_info->signal_strength =
-				(u8)(odm_signal_scale_mapping(dm, avg_rssi));
-		}
+		phy_info->signal_strength = pwdb_all;
+	} else if (rf_rx_num != 0) {
+		/* 2015/01 Sean, use the best two RSSI only,
+		 * suggested by Ynlin and ChenYu.
+		 */
+		if (rf_rx_num == 1)
+			avg_rssi = best_rssi;
+		else
+			avg_rssi = (best_rssi + second_rssi) / 2;
+
+		phy_info->signal_strength = avg_rssi;
 	}
+
 	dm->rx_pwdb_ave = dm->rx_pwdb_ave + phy_info->rx_pwdb_all;
 
 	dm->dm_fat_table.antsel_rx_keep_0 = phy_sta_rpt->antidx_anta;
@@ -1874,8 +1854,7 @@ void phydm_rx_phy_status_new_type(struct phy_dm_struct *phydm, u8 *phy_status,
 	/* Update signal strength to UI, and phy_info->rx_pwdb_all is the
 	 * maximum RSSI of all path
 	 */
-	phy_info->signal_strength =
-		(u8)(odm_signal_scale_mapping(phydm, phy_info->rx_pwdb_all));
+	phy_info->signal_strength = phy_info->rx_pwdb_all;
 
 	/* Calculate average RSSI and smoothed RSSI */
 	phydm_process_rssi_for_dm_new_type(phydm, phy_info, pktinfo);
drivers/staging/rtlwifi/phydm/phydm_hwconfig.h +0 -2
index 6ad5e0292a97..c9833889688c 100644
@@ -216,8 +216,6 @@ odm_config_fw_with_header_file(struct phy_dm_struct *dm,
 
 u32 odm_get_hw_img_version(struct phy_dm_struct *dm);
 
-s32 odm_signal_scale_mapping(struct phy_dm_struct *dm, s32 curr_sig);
-
 /*For 8822B only!! need to move to FW finally */
 /*==============================================*/
 void phydm_rx_phy_status_new_type(struct phy_dm_struct *phydm, u8 *phy_status,
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/3 staging: rtlwifi: Remove function that only returns zero

In reply to Maya Nakamura

Because the odm_sq_process_patch_rt_cid_819x_lenovo function is only called to return zero, remove the unnecessary function and change the section that calls it. Issues found by Coccinelle's semantic patch results for returnvar.cocci and checkpatch.pl.

---
Changes since v1:
- Set the sq variable to zero.
- Negate the if condition and drop the else branch.
- Remove unnecessary parentheses in the if condition as pointed out by checkpatch.

 drivers/staging/rtlwifi/phydm/phydm_hwconfig.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/staging/rtlwifi/phydm/phydm_hwconfig.c +3 -14
index c71ac1276ebe..1b05db36e279 100644
@@ -477,14 +477,6 @@ static u8 odm_query_rx_pwr_percentage(s8 ant_power)
 		return 100 + ant_power;
 }
 
-static u8 odm_sq_process_patch_rt_cid_819x_lenovo(struct phy_dm_struct *dm,
-						  u8 is_cck_rate, u8 pwdb_all,
-						  u8 path, u8 RSSI)
-{
-	u8 sq = 0;
-	return sq;
-}
-
 static u8 odm_evm_db_to_percentage(s8 value)
 {
 	/* -33dB~0dB to 0%~99% */
@@ -883,13 +875,10 @@ static void odm_rx_phy_status_jaguar_series_parsing(
 		phy_info->recv_signal_power = rx_pwr_all;
 		/*(3) Get Signal Quality (EVM)*/
 		{
-			u8 sq;
+			u8 sq = 0;
 
-			if ((dm->support_platform == ODM_WIN) &&
-			    (dm->patch_id == RT_CID_819X_LENOVO))
-				sq = odm_sq_process_patch_rt_cid_819x_lenovo(
-					dm, is_cck_rate, pwdb_all, 0, 0);
-			else
+			if (!(dm->support_platform == ODM_WIN &&
+			      dm->patch_id == RT_CID_819X_LENOVO))
 				sq = phydm_get_signal_quality_8812(phy_info, dm,
 								   phy_sta_rpt);
 
Signature · 1 line
2.17.1
#3 lore raw

PATCH v2 3/3 staging: rtlwifi: Remove unused functions

In reply to Maya Nakamura

Remove the five functions that are not used from the source and header files. Issue found by Coccinelle's semantic patch results for returnvar.cocci.

---
Changes since v1:
- None

 .../staging/rtlwifi/phydm/phydm_hwconfig.c    | 35 -------------------
 .../staging/rtlwifi/phydm/phydm_hwconfig.h    | 10 ------
 2 files changed, 45 deletions(-)
drivers/staging/rtlwifi/phydm/phydm_hwconfig.c +0 -35
index 1b05db36e279..e1544e38944b 100644
@@ -1848,38 +1848,3 @@ void phydm_rx_phy_status_new_type(struct phy_dm_struct *phydm, u8 *phy_status,
 	/* Calculate average RSSI and smoothed RSSI */
 	phydm_process_rssi_for_dm_new_type(phydm, phy_info, pktinfo);
 }
-
-u32 query_phydm_trx_capability(struct phy_dm_struct *dm)
-{
-	u32 value32 = 0xFFFFFFFF;
-
-	return value32;
-}
-
-u32 query_phydm_stbc_capability(struct phy_dm_struct *dm)
-{
-	u32 value32 = 0xFFFFFFFF;
-
-	return value32;
-}
-
-u32 query_phydm_ldpc_capability(struct phy_dm_struct *dm)
-{
-	u32 value32 = 0xFFFFFFFF;
-
-	return value32;
-}
-
-u32 query_phydm_txbf_parameters(struct phy_dm_struct *dm)
-{
-	u32 value32 = 0xFFFFFFFF;
-
-	return value32;
-}
-
-u32 query_phydm_txbf_capability(struct phy_dm_struct *dm)
-{
-	u32 value32 = 0xFFFFFFFF;
-
-	return value32;
-}
drivers/staging/rtlwifi/phydm/phydm_hwconfig.h +0 -10
index c9833889688c..ee4b9f0af2a1 100644
@@ -484,14 +484,4 @@ struct phy_status_rpt_jaguar2_type2 {
 #endif
 };
 
-u32 query_phydm_trx_capability(struct phy_dm_struct *dm);
-
-u32 query_phydm_stbc_capability(struct phy_dm_struct *dm);
-
-u32 query_phydm_ldpc_capability(struct phy_dm_struct *dm);
-
-u32 query_phydm_txbf_parameters(struct phy_dm_struct *dm);
-
-u32 query_phydm_txbf_capability(struct phy_dm_struct *dm);
-
 #endif /*#ifndef	__HALHWOUTSRC_H__*/
Signature · 1 line
2.17.1