Skip to contentSkip to conversation

staging: rtl8192e: coding style cleanups

PATCH In review Michael Straube 2 participants 5 messages Feb 22, 2024 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: rtl8192e: coding style cleanups

Another small series with coding style cleanups.
Compile-tested only.

Michael Straube (3):
staging: rtl8192e: rename rateIndex to rate_index
staging: rtl8192e: remove empty cases from switch statements
staging: rtl8192e: rename enum members to upper case

 .../staging/rtl8192e/rtl8192e/r8192E_dev.c    | 64 +++++++++----------
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c    | 29 ++++-----
 drivers/staging/rtl8192e/rtllib.h             |  6 +-
 3 files changed, 48 insertions(+), 51 deletions(-)
Signature · 1 line
2.43.1
#1 lore raw

PATCH 1/3 staging: rtl8192e: rename rateIndex to rate_index

Rename the variable rateIndex in the function _rtl92e_update_received_rate_histogram_stats() to avoid camel case.

rateIndex -> rate_index

---
 .../staging/rtl8192e/rtl8192e/r8192E_dev.c    | 64 +++++++++----------
 1 file changed, 32 insertions(+), 32 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +32 -32
index b54dbc97d4ba..0a3c81e14951 100644
@@ -1527,7 +1527,7 @@ static void _rtl92e_update_received_rate_histogram_stats(
 {
 	struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
 	u32 rcvType = 1;
-	u32 rateIndex;
+	u32 rate_index;
 
 	if (pstats->bCRC)
 		rcvType = 2;
@@ -1536,95 +1536,95 @@ static void _rtl92e_update_received_rate_histogram_stats(
 
 	switch (pstats->rate) {
 	case MGN_1M:
-		rateIndex = 0;
+		rate_index = 0;
 		break;
 	case MGN_2M:
-		rateIndex = 1;
+		rate_index = 1;
 		break;
 	case MGN_5_5M:
-		rateIndex = 2;
+		rate_index = 2;
 		break;
 	case MGN_11M:
-		rateIndex = 3;
+		rate_index = 3;
 		break;
 	case MGN_6M:
-		rateIndex = 4;
+		rate_index = 4;
 		break;
 	case MGN_9M:
-		rateIndex = 5;
+		rate_index = 5;
 		break;
 	case MGN_12M:
-		rateIndex = 6;
+		rate_index = 6;
 		break;
 	case MGN_18M:
-		rateIndex = 7;
+		rate_index = 7;
 		break;
 	case MGN_24M:
-		rateIndex = 8;
+		rate_index = 8;
 		break;
 	case MGN_36M:
-		rateIndex = 9;
+		rate_index = 9;
 		break;
 	case MGN_48M:
-		rateIndex = 10;
+		rate_index = 10;
 		break;
 	case MGN_54M:
-		rateIndex = 11;
+		rate_index = 11;
 		break;
 	case MGN_MCS0:
-		rateIndex = 12;
+		rate_index = 12;
 		break;
 	case MGN_MCS1:
-		rateIndex = 13;
+		rate_index = 13;
 		break;
 	case MGN_MCS2:
-		rateIndex = 14;
+		rate_index = 14;
 		break;
 	case MGN_MCS3:
-		rateIndex = 15;
+		rate_index = 15;
 		break;
 	case MGN_MCS4:
-		rateIndex = 16;
+		rate_index = 16;
 		break;
 	case MGN_MCS5:
-		rateIndex = 17;
+		rate_index = 17;
 		break;
 	case MGN_MCS6:
-		rateIndex = 18;
+		rate_index = 18;
 		break;
 	case MGN_MCS7:
-		rateIndex = 19;
+		rate_index = 19;
 		break;
 	case MGN_MCS8:
-		rateIndex = 20;
+		rate_index = 20;
 		break;
 	case MGN_MCS9:
-		rateIndex = 21;
+		rate_index = 21;
 		break;
 	case MGN_MCS10:
-		rateIndex = 22;
+		rate_index = 22;
 		break;
 	case MGN_MCS11:
-		rateIndex = 23;
+		rate_index = 23;
 		break;
 	case MGN_MCS12:
-		rateIndex = 24;
+		rate_index = 24;
 		break;
 	case MGN_MCS13:
-		rateIndex = 25;
+		rate_index = 25;
 		break;
 	case MGN_MCS14:
-		rateIndex = 26;
+		rate_index = 26;
 		break;
 	case MGN_MCS15:
-		rateIndex = 27;
+		rate_index = 27;
 		break;
 	default:
-		rateIndex = 28;
+		rate_index = 28;
 		break;
 	}
-	priv->stats.received_rate_histogram[0][rateIndex]++;
-	priv->stats.received_rate_histogram[rcvType][rateIndex]++;
+	priv->stats.received_rate_histogram[0][rate_index]++;
+	priv->stats.received_rate_histogram[rcvType][rate_index]++;
 }
 
 bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats,
Signature · 1 line
2.43.1
#2 lore raw

PATCH 2/3 staging: rtl8192e: remove empty cases from switch statements

In reply to Michael Straube

Rmove empty cases from switch statements to improve readability. All of these empty cases are covered by a default case already.

---
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +0 -3
index 57e1a361a7c9..4b622ad4c534 100644
@@ -1725,7 +1725,6 @@ static void _rtl92e_dm_check_fsync(struct net_device *dev)
 				_rtl92e_dm_start_hw_fsync(dev);
 				priv->rtllib->fsync_state = HW_Fsync;
 				break;
-			case HW_Fsync:
 			default:
 				break;
 			}
@@ -1740,7 +1739,6 @@ static void _rtl92e_dm_check_fsync(struct net_device *dev)
 				_rtl92e_dm_start_sw_fsync(dev);
 				priv->rtllib->fsync_state = SW_Fsync;
 				break;
-			case SW_Fsync:
 			default:
 				break;
 			}
@@ -1760,7 +1758,6 @@ static void _rtl92e_dm_check_fsync(struct net_device *dev)
 			_rtl92e_dm_end_sw_fsync(dev);
 			priv->rtllib->fsync_state = Default_Fsync;
 			break;
-		case Default_Fsync:
 		default:
 			break;
 		}
Signature · 1 line
2.43.1
#3 lore raw

PATCH 3/3 staging: rtl8192e: rename enum members to upper case

In reply to Michael Straube

Enum members are usually named all upper case. Rename the members of the enum fsync_state to improve readability and follow the common kernel coding style.

Default_Fsync -> DEFAULT_FSYNC
HW_Fsync -> HW_FSYNC
SW_Fsync -> SW_FSYNC

---
 drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 26 +++++++++++-----------
 drivers/staging/rtl8192e/rtllib.h          |  6 ++---
 2 files changed, 16 insertions(+), 16 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +13 -13
index 4b622ad4c534..bf695b61ca8b 100644
@@ -1523,7 +1523,7 @@ static void _rtl92e_dm_init_fsync(struct net_device *dev)
 	priv->rtllib->fsync_multiple_timeinterval = 3;
 	priv->rtllib->fsync_firstdiff_ratethreshold = 100;
 	priv->rtllib->fsync_seconddiff_ratethreshold = 200;
-	priv->rtllib->fsync_state = Default_Fsync;
+	priv->rtllib->fsync_state = DEFAULT_FSYNC;
 
 	timer_setup(&priv->fsync_timer, _rtl92e_dm_fsync_timer_callback, 0);
 }
@@ -1716,28 +1716,28 @@ static void _rtl92e_dm_check_fsync(struct net_device *dev)
 	    priv->rtllib->ht_info->iot_peer == HT_IOT_PEER_BROADCOM) {
 		if (priv->rtllib->bfsync_enable == 0) {
 			switch (priv->rtllib->fsync_state) {
-			case Default_Fsync:
+			case DEFAULT_FSYNC:
 				_rtl92e_dm_start_hw_fsync(dev);
-				priv->rtllib->fsync_state = HW_Fsync;
+				priv->rtllib->fsync_state = HW_FSYNC;
 				break;
-			case SW_Fsync:
+			case SW_FSYNC:
 				_rtl92e_dm_end_sw_fsync(dev);
 				_rtl92e_dm_start_hw_fsync(dev);
-				priv->rtllib->fsync_state = HW_Fsync;
+				priv->rtllib->fsync_state = HW_FSYNC;
 				break;
 			default:
 				break;
 			}
 		} else {
 			switch (priv->rtllib->fsync_state) {
-			case Default_Fsync:
+			case DEFAULT_FSYNC:
 				_rtl92e_dm_start_sw_fsync(dev);
-				priv->rtllib->fsync_state = SW_Fsync;
+				priv->rtllib->fsync_state = SW_FSYNC;
 				break;
-			case HW_Fsync:
+			case HW_FSYNC:
 				_rtl92e_dm_end_hw_fsync(dev);
 				_rtl92e_dm_start_sw_fsync(dev);
-				priv->rtllib->fsync_state = SW_Fsync;
+				priv->rtllib->fsync_state = SW_FSYNC;
 				break;
 			default:
 				break;
@@ -1750,13 +1750,13 @@ static void _rtl92e_dm_check_fsync(struct net_device *dev)
 		}
 	} else {
 		switch (priv->rtllib->fsync_state) {
-		case HW_Fsync:
+		case HW_FSYNC:
 			_rtl92e_dm_end_hw_fsync(dev);
-			priv->rtllib->fsync_state = Default_Fsync;
+			priv->rtllib->fsync_state = DEFAULT_FSYNC;
 			break;
-		case SW_Fsync:
+		case SW_FSYNC:
 			_rtl92e_dm_end_sw_fsync(dev);
-			priv->rtllib->fsync_state = Default_Fsync;
+			priv->rtllib->fsync_state = DEFAULT_FSYNC;
 			break;
 		default:
 			break;
drivers/staging/rtl8192e/rtllib.h +3 -3
index c18169725452..ac6c52b58894 100644
@@ -1031,9 +1031,9 @@ struct rx_reorder_entry {
 };
 
 enum fsync_state {
-	Default_Fsync,
-	HW_Fsync,
-	SW_Fsync
+	DEFAULT_FSYNC,
+	HW_FSYNC,
+	SW_FSYNC
 };
 
 enum ips_callback_function {
Signature · 1 line
2.43.1
Tested-by on the v1 series
#4 lore raw
In reply to Michael Straube
Quoted 8 lines · Michael Straube

Another small series with coding style cleanups.
Compile-tested only.

Michael Straube (3):
staging: rtl8192e: rename rateIndex to rate_index
staging: rtl8192e: remove empty cases from switch statements
staging: rtl8192e: rename enum members to upper case

Quoted 5 lines
  .../staging/rtl8192e/rtl8192e/r8192E_dev.c    | 64 +++++++++----------
  drivers/staging/rtl8192e/rtl8192e/rtl_dm.c    | 29 ++++-----
  drivers/staging/rtl8192e/rtllib.h             |  6 +-
  3 files changed, 48 insertions(+), 51 deletions(-)