Skip to contentSkip to conversation

staging: r8188eu: some coding style cleanups

PATCH In review Michael Straube 2 participants 8 messages Sep 11, 2022 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: r8188eu: some coding style cleanups

This series contains some coding style cleanups in the file odm_HWConfig.c.

Michael Straube (6):
staging: r8188eu: rename odm_SignalScaleMapping()
staging: r8188eu: clean up camel case in odm_signal_scale_mapping()
staging: r8188eu: remove unnecessary initialization
staging: r8188eu: rename odm_QueryRxPwrPercentage()
staging: r8188eu: clean up camel case in odm_query_rxpwrpercentage()
staging: r8188eu: replace tabs with space in
odm_query_rxpwrpercentage()

 drivers/staging/r8188eu/hal/odm_HWConfig.c | 60 +++++++++++-----------
 1 file changed, 30 insertions(+), 30 deletions(-)
Signature · 1 line
2.37.3
#1 lore raw

PATCH 1/6 staging: r8188eu: rename odm_SignalScaleMapping()

Rename odm_SignalScaleMapping() to avoid camel case.

odm_SignalScaleMapping -> odm_signal_scale_mapping

---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/r8188eu/hal/odm_HWConfig.c +3 -3
index 035d94b3458e..cd6af491d5a8 100644
@@ -13,7 +13,7 @@ static u8 odm_QueryRxPwrPercentage(s8 AntPower)
 		return 100 + AntPower;
 }
 
-static s32 odm_SignalScaleMapping(struct odm_dm_struct *dm_odm, s32 CurrSig)
+static s32 odm_signal_scale_mapping(struct odm_dm_struct *dm_odm, s32 CurrSig)
 {
 	s32 RetSig = 0;
 
@@ -200,10 +200,10 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm,
 	/* UI BSS List signal strength(in percentage), make it good looking, from 0~100. */
 	/* It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). */
 	if (isCCKrate) {
-		pPhyInfo->SignalStrength = (u8)(odm_SignalScaleMapping(dm_odm, PWDB_ALL));/* PWDB_ALL; */
+		pPhyInfo->SignalStrength = (u8)(odm_signal_scale_mapping(dm_odm, PWDB_ALL));/* PWDB_ALL; */
 	} else {
 		if (rf_rx_num != 0)
-			pPhyInfo->SignalStrength = (u8)(odm_SignalScaleMapping(dm_odm, total_rssi /= rf_rx_num));
+			pPhyInfo->SignalStrength = (u8)(odm_signal_scale_mapping(dm_odm, total_rssi /= rf_rx_num));
 	}
 
 	/* For 88E HW Antenna Diversity */
Signature · 1 line
2.37.3
#2 lore raw

PATCH 2/6 staging: r8188eu: clean up camel case in odm_signal_scale_mapping()

In reply to Michael Straube

Rename variables in odm_signal_scale_mapping() to avoid camel case.

CurrSig -> currsig
RetSig -> retsig

---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 38 +++++++++++-----------
 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/staging/r8188eu/hal/odm_HWConfig.c +19 -19
index cd6af491d5a8..5fd53c60f762 100644
@@ -13,28 +13,28 @@ static u8 odm_QueryRxPwrPercentage(s8 AntPower)
 		return 100 + AntPower;
 }
 
-static s32 odm_signal_scale_mapping(struct odm_dm_struct *dm_odm, s32 CurrSig)
+static s32 odm_signal_scale_mapping(struct odm_dm_struct *dm_odm, s32 currsig)
 {
-	s32 RetSig = 0;
-
-	if (CurrSig >= 51 && CurrSig <= 100)
-		RetSig = 100;
-	else if (CurrSig >= 41 && CurrSig <= 50)
-		RetSig = 80 + ((CurrSig - 40) * 2);
-	else if (CurrSig >= 31 && CurrSig <= 40)
-		RetSig = 66 + (CurrSig - 30);
-	else if (CurrSig >= 21 && CurrSig <= 30)
-		RetSig = 54 + (CurrSig - 20);
-	else if (CurrSig >= 10 && CurrSig <= 20)
-		RetSig = 42 + (((CurrSig - 10) * 2) / 3);
-	else if (CurrSig >= 5 && CurrSig <= 9)
-		RetSig = 22 + (((CurrSig - 5) * 3) / 2);
-	else if (CurrSig >= 1 && CurrSig <= 4)
-		RetSig = 6 + (((CurrSig - 1) * 3) / 2);
+	s32 retsig = 0;
+
+	if (currsig >= 51 && currsig <= 100)
+		retsig = 100;
+	else if (currsig >= 41 && currsig <= 50)
+		retsig = 80 + ((currsig - 40) * 2);
+	else if (currsig >= 31 && currsig <= 40)
+		retsig = 66 + (currsig - 30);
+	else if (currsig >= 21 && currsig <= 30)
+		retsig = 54 + (currsig - 20);
+	else if (currsig >= 10 && currsig <= 20)
+		retsig = 42 + (((currsig - 10) * 2) / 3);
+	else if (currsig >= 5 && currsig <= 9)
+		retsig = 22 + (((currsig - 5) * 3) / 2);
+	else if (currsig >= 1 && currsig <= 4)
+		retsig = 6 + (((currsig - 1) * 3) / 2);
 	else
-		RetSig = CurrSig;
+		retsig = currsig;
 
-	return RetSig;
+	return retsig;
 }
 
 static u8 odm_evm_db_to_percentage(s8 value)
Signature · 1 line
2.37.3
#3 lore raw

PATCH 3/6 staging: r8188eu: remove unnecessary initialization

In reply to Michael Straube

The variable 'retsig' in odm_signal_scale_mapping() is set in the function before it returns, so it is not needed to initialize it.

---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/hal/odm_HWConfig.c +1 -1
index 5fd53c60f762..a557c5d1542e 100644
@@ -15,7 +15,7 @@ static u8 odm_QueryRxPwrPercentage(s8 AntPower)
 
 static s32 odm_signal_scale_mapping(struct odm_dm_struct *dm_odm, s32 currsig)
 {
-	s32 retsig = 0;
+	s32 retsig;
 
 	if (currsig >= 51 && currsig <= 100)
 		retsig = 100;
Signature · 1 line
2.37.3
#4 lore raw

PATCH 4/6 staging: r8188eu: rename odm_QueryRxPwrPercentage()

In reply to Michael Straube

Rename odm_QueryRxPwrPercentage() to avoid camel case.

odm_QueryRxPwrPercentage -> odm_query_rxpwrpercentage

---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/r8188eu/hal/odm_HWConfig.c +4 -4
index a557c5d1542e..8b292644b38c 100644
@@ -3,7 +3,7 @@
 
 #include "../include/drv_types.h"
 
-static u8 odm_QueryRxPwrPercentage(s8 AntPower)
+static u8 odm_query_rxpwrpercentage(s8 AntPower)
 {
 	if ((AntPower <= -100) || (AntPower >= 20))
 		return	0;
@@ -117,7 +117,7 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm,
 			break;
 		}
 		rx_pwr_all += 6;
-		PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
+		PWDB_ALL = odm_query_rxpwrpercentage(rx_pwr_all);
 		if (!cck_highpwr) {
 			if (PWDB_ALL >= 80)
 				PWDB_ALL = ((PWDB_ALL - 80) << 1) + ((PWDB_ALL - 80) >> 1) + 80;
@@ -162,7 +162,7 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm,
 			pPhyInfo->RxPwr[i] = rx_pwr[i];
 
 			/* Translate DBM to percentage. */
-			RSSI = odm_QueryRxPwrPercentage(rx_pwr[i]);
+			RSSI = odm_query_rxpwrpercentage(rx_pwr[i]);
 			total_rssi += RSSI;
 
 			pPhyInfo->RxMIMOSignalStrength[i] = (u8)RSSI;
@@ -173,7 +173,7 @@ static void odm_RxPhyStatus92CSeries_Parsing(struct odm_dm_struct *dm_odm,
 		/*  (2)PWDB, Average PWDB calculated by hardware (for rate adaptive) */
 		rx_pwr_all = (((pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all) >> 1) & 0x7f) - 110;
 
-		PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all);
+		PWDB_ALL = odm_query_rxpwrpercentage(rx_pwr_all);
 
 		pPhyInfo->RxPWDBAll = PWDB_ALL;
 		pPhyInfo->RxPower = rx_pwr_all;
Signature · 1 line
2.37.3
#5 lore raw

PATCH 5/6 staging: r8188eu: clean up camel case in odm_query_rxpwrpercentage()

In reply to Michael Straube

Rename the variable 'AntPower' in odm_query_rxpwrpercentage() to avoid camel case.

AntPower -> antpower

---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/r8188eu/hal/odm_HWConfig.c +4 -4
index 8b292644b38c..a870973395f6 100644
@@ -3,14 +3,14 @@
 
 #include "../include/drv_types.h"
 
-static u8 odm_query_rxpwrpercentage(s8 AntPower)
+static u8 odm_query_rxpwrpercentage(s8 antpower)
 {
-	if ((AntPower <= -100) || (AntPower >= 20))
+	if ((antpower <= -100) || (antpower >= 20))
 		return	0;
-	else if (AntPower >= 0)
+	else if (antpower >= 0)
 		return	100;
 	else
-		return 100 + AntPower;
+		return 100 + antpower;
 }
 
 static s32 odm_signal_scale_mapping(struct odm_dm_struct *dm_odm, s32 currsig)
Signature · 1 line
2.37.3
#6 lore raw

PATCH 6/6 staging: r8188eu: replace tabs with space in odm_query_rxpwrpercentage()

In reply to Michael Straube

In statements spaces should be used not tabs. Replace tabs withs spaces in two return statements in odm_query_rxpwrpercentage().

---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/hal/odm_HWConfig.c +2 -2
index a870973395f6..38f357e8aeda 100644
@@ -6,9 +6,9 @@
 static u8 odm_query_rxpwrpercentage(s8 antpower)
 {
 	if ((antpower <= -100) || (antpower >= 20))
-		return	0;
+		return 0;
 	else if (antpower >= 0)
-		return	100;
+		return 100;
 	else
 		return 100 + antpower;
 }
Signature · 1 line
2.37.3
Tested-by on the v1 series
#7 lore raw
In reply to Michael Straube
Quoted 12 lines · Michael Straube

This series contains some coding style cleanups in the file odm_HWConfig.c.

Michael Straube (6):
staging: r8188eu: rename odm_SignalScaleMapping()
staging: r8188eu: clean up camel case in odm_signal_scale_mapping()
staging: r8188eu: remove unnecessary initialization
staging: r8188eu: rename odm_QueryRxPwrPercentage()
staging: r8188eu: clean up camel case in odm_query_rxpwrpercentage()
staging: r8188eu: replace tabs with space in
odm_query_rxpwrpercentage()

Quoted 3 lines
  drivers/staging/r8188eu/hal/odm_HWConfig.c | 60 +++++++++++-----------
  1 file changed, 30 insertions(+), 30 deletions(-)