linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] staging: r8188eu: some coding style cleanups
@ 2022-09-11 16:19 Michael Straube
  2022-09-11 16:19 ` [PATCH 1/6] staging: r8188eu: rename odm_SignalScaleMapping() Michael Straube
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Michael Straube @ 2022-09-11 16:19 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, 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()

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

-- 
2.37.3


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

* [PATCH 1/6] staging: r8188eu: rename odm_SignalScaleMapping()
  2022-09-11 16:19 [PATCH 0/6] staging: r8188eu: some coding style cleanups Michael Straube
@ 2022-09-11 16:19 ` Michael Straube
  2022-09-11 16:19 ` [PATCH 2/6] staging: r8188eu: clean up camel case in odm_signal_scale_mapping() Michael Straube
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2022-09-11 16:19 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, Michael Straube

Rename odm_SignalScaleMapping() to avoid camel case.

odm_SignalScaleMapping -> odm_signal_scale_mapping

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index 035d94b3458e..cd6af491d5a8 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -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 */
-- 
2.37.3


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

* [PATCH 2/6] staging: r8188eu: clean up camel case in odm_signal_scale_mapping()
  2022-09-11 16:19 [PATCH 0/6] staging: r8188eu: some coding style cleanups Michael Straube
  2022-09-11 16:19 ` [PATCH 1/6] staging: r8188eu: rename odm_SignalScaleMapping() Michael Straube
@ 2022-09-11 16:19 ` Michael Straube
  2022-09-11 16:19 ` [PATCH 3/6] staging: r8188eu: remove unnecessary initialization Michael Straube
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2022-09-11 16:19 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, Michael Straube

Rename variables in odm_signal_scale_mapping() to avoid camel case.

CurrSig -> currsig
RetSig -> retsig

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 38 +++++++++++-----------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index cd6af491d5a8..5fd53c60f762 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -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)
-- 
2.37.3


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

* [PATCH 3/6] staging: r8188eu: remove unnecessary initialization
  2022-09-11 16:19 [PATCH 0/6] staging: r8188eu: some coding style cleanups Michael Straube
  2022-09-11 16:19 ` [PATCH 1/6] staging: r8188eu: rename odm_SignalScaleMapping() Michael Straube
  2022-09-11 16:19 ` [PATCH 2/6] staging: r8188eu: clean up camel case in odm_signal_scale_mapping() Michael Straube
@ 2022-09-11 16:19 ` Michael Straube
  2022-09-11 16:19 ` [PATCH 4/6] staging: r8188eu: rename odm_QueryRxPwrPercentage() Michael Straube
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2022-09-11 16:19 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, 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.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index 5fd53c60f762..a557c5d1542e 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -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;
-- 
2.37.3


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

* [PATCH 4/6] staging: r8188eu: rename odm_QueryRxPwrPercentage()
  2022-09-11 16:19 [PATCH 0/6] staging: r8188eu: some coding style cleanups Michael Straube
                   ` (2 preceding siblings ...)
  2022-09-11 16:19 ` [PATCH 3/6] staging: r8188eu: remove unnecessary initialization Michael Straube
@ 2022-09-11 16:19 ` Michael Straube
  2022-09-11 16:19 ` [PATCH 5/6] staging: r8188eu: clean up camel case in odm_query_rxpwrpercentage() Michael Straube
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2022-09-11 16:19 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, Michael Straube

Rename odm_QueryRxPwrPercentage() to avoid camel case.

odm_QueryRxPwrPercentage -> odm_query_rxpwrpercentage

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index a557c5d1542e..8b292644b38c 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -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;
-- 
2.37.3


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

* [PATCH 5/6] staging: r8188eu: clean up camel case in odm_query_rxpwrpercentage()
  2022-09-11 16:19 [PATCH 0/6] staging: r8188eu: some coding style cleanups Michael Straube
                   ` (3 preceding siblings ...)
  2022-09-11 16:19 ` [PATCH 4/6] staging: r8188eu: rename odm_QueryRxPwrPercentage() Michael Straube
@ 2022-09-11 16:19 ` Michael Straube
  2022-09-11 16:19 ` [PATCH 6/6] staging: r8188eu: replace tabs with space " Michael Straube
  2022-09-11 17:08 ` [PATCH 0/6] staging: r8188eu: some coding style cleanups Philipp Hortmann
  6 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2022-09-11 16:19 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, Michael Straube

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

AntPower -> antpower

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index 8b292644b38c..a870973395f6 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -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)
-- 
2.37.3


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

* [PATCH 6/6] staging: r8188eu: replace tabs with space in odm_query_rxpwrpercentage()
  2022-09-11 16:19 [PATCH 0/6] staging: r8188eu: some coding style cleanups Michael Straube
                   ` (4 preceding siblings ...)
  2022-09-11 16:19 ` [PATCH 5/6] staging: r8188eu: clean up camel case in odm_query_rxpwrpercentage() Michael Straube
@ 2022-09-11 16:19 ` Michael Straube
  2022-09-11 17:08 ` [PATCH 0/6] staging: r8188eu: some coding style cleanups Philipp Hortmann
  6 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2022-09-11 16:19 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, Michael Straube

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

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/r8188eu/hal/odm_HWConfig.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index a870973395f6..38f357e8aeda 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -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;
 }
-- 
2.37.3


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

* Re: [PATCH 0/6] staging: r8188eu: some coding style cleanups
  2022-09-11 16:19 [PATCH 0/6] staging: r8188eu: some coding style cleanups Michael Straube
                   ` (5 preceding siblings ...)
  2022-09-11 16:19 ` [PATCH 6/6] staging: r8188eu: replace tabs with space " Michael Straube
@ 2022-09-11 17:08 ` Philipp Hortmann
  6 siblings, 0 replies; 8+ messages in thread
From: Philipp Hortmann @ 2022-09-11 17:08 UTC (permalink / raw)
  To: Michael Straube, gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel

On 9/11/22 18:19, Michael Straube wrote:
> 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(-)
> 

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150


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

end of thread, other threads:[~2022-09-11 17:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-11 16:19 [PATCH 0/6] staging: r8188eu: some coding style cleanups Michael Straube
2022-09-11 16:19 ` [PATCH 1/6] staging: r8188eu: rename odm_SignalScaleMapping() Michael Straube
2022-09-11 16:19 ` [PATCH 2/6] staging: r8188eu: clean up camel case in odm_signal_scale_mapping() Michael Straube
2022-09-11 16:19 ` [PATCH 3/6] staging: r8188eu: remove unnecessary initialization Michael Straube
2022-09-11 16:19 ` [PATCH 4/6] staging: r8188eu: rename odm_QueryRxPwrPercentage() Michael Straube
2022-09-11 16:19 ` [PATCH 5/6] staging: r8188eu: clean up camel case in odm_query_rxpwrpercentage() Michael Straube
2022-09-11 16:19 ` [PATCH 6/6] staging: r8188eu: replace tabs with space " Michael Straube
2022-09-11 17:08 ` [PATCH 0/6] staging: r8188eu: some coding style cleanups Philipp Hortmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).