Skip to contentSkip to conversation

staging: rtl8723bs: clean up if-else logic in odm_HWConfig.c

PATCH Superseded Diego Fernando Mancera Gómez 3 participants 3 messages May 22 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: rtl8723bs: clean up if-else logic in odm_HWConfig.c

Refactored redundant if-else blocks to a cleaner else-if structure in odm_HWConfig.c and fixed indentation to use tabs as required by the kernel coding style.

---
 drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/staging/rtl8723bs/hal/odm_HWConfig.c +4 -12
index c88d669cb086..2e47734a0ae9 100644
@@ -228,18 +228,11 @@ static void odm_rx_phy_status_parsing(struct dm_odm_t *dm_odm,
 		odm_parsing_cfo(dm_odm, pkt_info, phy_sta_rpt->path_cfotail);
 	}
 
-	/*
-	 * UI BSS List signal strength(in percentage), make it good
-	 * looking, from 0~100.
-	 * It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp().
-	 */
-	if (is_cck_rate) {
+	if (is_cck_rate)
 		phy_info->signal_strength = (u8)(odm_signal_scale_mapping(dm_odm, pwdb_all));
-	} else {
-		if (rf_rx_num != 0) {
-			phy_info->signal_strength = (u8)(odm_signal_scale_mapping(dm_odm, total_rssi /= rf_rx_num));
-		}
-	}
+	else if (rf_rx_num != 0)
+		phy_info->signal_strength = (u8)(odm_signal_scale_mapping(dm_odm, total_rssi /= rf_rx_num));
+
 }
 
 static void odm_Process_RSSIForDM(
@@ -437,4 +430,3 @@ enum hal_status ODM_ConfigBBWithHeaderFile(
 
 	return HAL_STATUS_SUCCESS;
 }
-
Signature · 1 line
2.43.0
#1 lore raw
Quoted 37 lines · Diego Fernando Mancera Gómez

Refactored redundant if-else blocks to a cleaner else-if structure in odm_HWConfig.c and fixed indentation to use tabs as required by the kernel coding style.

---
  drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 16 ++++------------
  1 file changed, 4 insertions(+), 12 deletions(-)
drivers/staging/rtl8723bs/hal/odm_HWConfig.c +4 -11
index c88d669cb086..2e47734a0ae9 100644
@@ -228,18 +228,11 @@ static void odm_rx_phy_status_parsing(struct dm_odm_t *dm_odm,
  		odm_parsing_cfo(dm_odm, pkt_info, phy_sta_rpt->path_cfotail);
  	}
 
-	/*
-	 * UI BSS List signal strength(in percentage), make it good
-	 * looking, from 0~100.
-	 * It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp().
-	 */
-	if (is_cck_rate) {
+	if (is_cck_rate)
  		phy_info->signal_strength = (u8)(odm_signal_scale_mapping(dm_odm, pwdb_all));
-	} else {
-		if (rf_rx_num != 0) {
-			phy_info->signal_strength = (u8)(odm_signal_scale_mapping(dm_odm, total_rssi /= rf_rx_num));
-		}
-	}
+	else if (rf_rx_num != 0)
+		phy_info->signal_strength = (u8)(odm_signal_scale_mapping(dm_odm, total_rssi /= rf_rx_num));
+
  }
 
  static void odm_Process_RSSIForDM(

drivers/staging/rtl8723bs/hal/odm_HWConfig.c enum hal_status ODM_ConfigBBWithHeaderFile( · line 440

Quoted 4 lines
drivers/staging/rtl8723bs/hal/odm_HWConfig.c +0 -1
@@ -437,4 +430,3 @@ enum hal_status ODM_ConfigBBWithHeaderFile(
 
  	return HAL_STATUS_SUCCESS;
  }
-

You need to add list of changes in your commit, as it's V2 right now.

drivers/staging/rtl8723bs/hal/odm_HWConfig.c static void odm_rx_phy_status_parsing(struct dm_odm_t *dm_odm, · line 236

Quoted 6 lines
drivers/staging/rtl8723bs/hal/odm_HWConfig.c +0 -6
-	/*
-	 * UI BSS List signal strength(in percentage), make it good
-	 * looking, from 0~100.
-	 * It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp().
-	 */
-	if (is_cck_rate) {

Why remove comments? Any reasoning?

drivers/staging/rtl8723bs/hal/odm_HWConfig.c enum hal_status ODM_ConfigBBWithHeaderFile( · line 432

Quoted 6 lines

static void odm_Process_RSSIForDM(

drivers/staging/rtl8723bs/hal/odm_HWConfig.c +0 -0
@@ -437,4 +430,3 @@ enum hal_status ODM_ConfigBBWithHeaderFile(
 
  	return HAL_STATUS_SUCCESS;
  }

You also removed a blank line, it's not related to your actual changes. It's usually advised to do one type of change in a single commit.

Regards,
Ahmet Sezgin Duran

#2 lore raw
In reply to Diego Fernando Mancera Gómez
Quoted 6 lines · Diego Fernando Mancera Gómez

Refactored redundant if-else blocks to a cleaner else-if structure in odm_HWConfig.c and fixed indentation to use tabs as required by the kernel coding style.

---

https://staticthinking.wordpress.com/2022/07/27/how-to-send-a-v2-patch/

Please wait a day between resends.

Quoted 17 lines
 drivers/staging/rtl8723bs/hal/odm_HWConfig.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/staging/rtl8723bs/hal/odm_HWConfig.c +0 -6
index c88d669cb086..2e47734a0ae9 100644
@@ -228,18 +228,11 @@ static void odm_rx_phy_status_parsing(struct dm_odm_t *dm_odm,
 		odm_parsing_cfo(dm_odm, pkt_info, phy_sta_rpt->path_cfotail);
 	}
 
-	/*
-	 * UI BSS List signal strength(in percentage), make it good
-	 * looking, from 0~100.
-	 * It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp().
-	 */
-	if (is_cck_rate) {

drivers/staging/rtl8723bs/hal/odm_HWConfig.c static void odm_rx_phy_status_parsing(struct dm_odm_t *dm_odm, · line 235

Quoted 10 lines
drivers/staging/rtl8723bs/hal/odm_HWConfig.c +4 -5
+	if (is_cck_rate)
 		phy_info->signal_strength = (u8)(odm_signal_scale_mapping(dm_odm, pwdb_all));
-	} else {
-		if (rf_rx_num != 0) {
-			phy_info->signal_strength = (u8)(odm_signal_scale_mapping(dm_odm, total_rssi /= rf_rx_num));
-		}
-	}
+	else if (rf_rx_num != 0)
+		phy_info->signal_strength = (u8)(odm_signal_scale_mapping(dm_odm, total_rssi /= rf_rx_num));
+

No need for this extra blank line.

drivers/staging/rtl8723bs/hal/odm_HWConfig.c static void odm_rx_phy_status_parsing(struct dm_odm_t *dm_odm, · line 236

Quoted 1 line
drivers/staging/rtl8723bs/hal/odm_HWConfig.c +0 -0
 }

regards,
dan carpenter

Quoted 10 lines
drivers/staging/rtl8723bs/hal/odm_HWConfig.c +0 -1
 static void odm_Process_RSSIForDM(
@@ -437,4 +430,3 @@ enum hal_status ODM_ConfigBBWithHeaderFile(
 
 	return HAL_STATUS_SUCCESS;
 }
-
Signature · 1 line
2.43.0