Skip to contentSkip to conversation

staging:rtl8192u: Coding style changes

PATCH Superseded John Whitmore 2 participants 11 messages Jul 29, 2018 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover staging:rtl8192u: Coding style changes

Second attempt correcting my initial attempt where I left '_t' and '_e' trailing the structures defined. These have now been corrected.

John Whitmore (15):
staging:rtl8192u: Remove typedef of struct cmpk_txfb_t - Style staging:rtl8192u: Remove unused CMPK_TX_SET_CONFIG_SIZE - Style staging:rtl8192u: Removed unused CMPK_RX_DBG_MSG_SIZE - Style staging:rtl8192u: Correct spelling in comments - style staging:rtl8192u: Remove typedef of cmpk_intr_sta_t - Style staging:rtl8192u: Remove typedef of cmpk_set_cfg_t - Style staging:rtl8192u: Refactor use of enum dm_dig_sta_e - Style staging:rtl8192u: Refactor enum dm_ratr_sta_e usage - Style staging:rtl8192u: Remove enum dm_dig_op_e - Style staging:rtl8192u: Refactor enum dm_dig_alg_e - Style staging:rtl8192u: Remove unused enum dm_dig_dbg_e - Style staging:rtl8192u: Refactor dm_dig_connect_e - Style staging:rtl8192u: Refactor enum dm_dig_pd_th_e - Style staging:rtl8192u: Refactor enum dm_dig_cs_ratio_e - Style staging:rtl8192u: Refactor enum DM_CCK_Rx_Path_Method - Style

 drivers/staging/rtl8192u/r8192U.h        |  10 +-
 drivers/staging/rtl8192u/r8192U_dm.c     |  91 -----------------
 drivers/staging/rtl8192u/r8192U_dm.h     | 122 ++++++++---------------
 drivers/staging/rtl8192u/r819xU_cmdpkt.c |  16 +--
 drivers/staging/rtl8192u/r819xU_cmdpkt.h |  24 ++---
 5 files changed, 70 insertions(+), 193 deletions(-)
Signature · 1 line
2.18.0
#1 lore raw

PATCH v2 1/8 staging:rtl8192u: Add spaces around operators - Style

Add the required spaces around '+' and '*' operators. This is a coding style change to clear the checkpatch issue. There should be no impact on runtime code execution.

---
 drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h +1 -1
index 8ee9370520f3..92afa9dc9663 100644
@@ -7,7 +7,7 @@
 #define AC_PARAM_SIZE	4
 #define WMM_PARAM_ELE_BODY_LEN	18
 
-#define WMM_PARAM_ELEMENT_SIZE	(8+(4*AC_PARAM_SIZE))
+#define WMM_PARAM_ELEMENT_SIZE	(8 + (4 * AC_PARAM_SIZE))
 
 //
 // ACI/AIFSN Field.
Signature · 1 line
2.18.0
#2 lore raw

PATCH v2 1/15 staging:rtl8192u: Remove typedef of struct cmpk_txfb_t - Style

In reply to John Whitmore

Remove the typedef of the structure cmpk_txfb_t. This clears the checkpatch issue with defining new types.

Additionally the type is renamed from cmpk_txfb_t to cmd_pkt_tx_feedback removing the '_t' as the typedef has been removed.

These changes are purely coding style in nature and should have no impact on runtime code execution.

---
 drivers/staging/rtl8192u/r819xU_cmdpkt.c | 8 ++++----
 drivers/staging/rtl8192u/r819xU_cmdpkt.h | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/rtl8192u/r819xU_cmdpkt.c +4 -4
index 3140b3413f91..630cf612f265 100644
@@ -66,7 +66,7 @@ rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen)
  * Overview:
  *
  * Input:       PADAPTER	pAdapter
- *              CMPK_TXFB_T	*psTx_FB
+ *              STRUCT CMD_PKT_TX_FEEDBACK	*psTx_FB
  *
  * Output:      NONE
  *
@@ -78,7 +78,7 @@ rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen)
  *
  *---------------------------------------------------------------------------
  */
-static void cmpk_count_txstatistic(struct net_device *dev, cmpk_txfb_t *pstx_fb)
+static void cmpk_count_txstatistic(struct net_device *dev, struct cmd_pkt_tx_feedback *pstx_fb)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
 #ifdef ENABLE_PS
@@ -163,7 +163,7 @@ static void cmpk_count_txstatistic(struct net_device *dev, cmpk_txfb_t *pstx_fb)
 static void cmpk_handle_tx_feedback(struct net_device *dev, u8 *pmsg)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	cmpk_txfb_t		rx_tx_fb;
+	struct cmd_pkt_tx_feedback rx_tx_fb;
 
 	priv->stats.txfeedback++;
 
@@ -173,7 +173,7 @@ static void cmpk_handle_tx_feedback(struct net_device *dev, u8 *pmsg)
 	 * endian type before copy the message copy.
 	 */
 	/* Use pointer to transfer structure memory. */
-	memcpy((u8 *)&rx_tx_fb, pmsg, sizeof(cmpk_txfb_t));
+	memcpy((u8 *)&rx_tx_fb, pmsg, sizeof(struct cmd_pkt_tx_feedback));
 	/* 2. Use tx feedback info to count TX statistics. */
 	cmpk_count_txstatistic(dev, &rx_tx_fb);
 	/* Comment previous method for TX statistic function. */
drivers/staging/rtl8192u/r819xU_cmdpkt.h +3 -3
index 0eb6b2321c9c..756e08bd341a 100644
@@ -2,7 +2,7 @@
 #ifndef R819XUSB_CMDPKT_H
 #define R819XUSB_CMDPKT_H
 /* Different command packet have dedicated message length and definition. */
-#define		CMPK_RX_TX_FB_SIZE		sizeof(cmpk_txfb_t)	/* 20 */
+#define		CMPK_RX_TX_FB_SIZE		sizeof(struct cmd_pkt_tx_feedback)	/* 20 */
 #define		CMPK_TX_SET_CONFIG_SIZE		sizeof(cmpk_set_cfg_t)	/* 16 */
 #define		CMPK_BOTH_QUERY_CONFIG_SIZE	sizeof(cmpk_set_cfg_t)	/* 16 */
 #define		CMPK_RX_TX_STS_SIZE		sizeof(cmpk_tx_status_t)
@@ -19,7 +19,7 @@
 /*------------------------------Define structure----------------------------*/
 /* Define different command packet structure. */
 /* 1. RX side: TX feedback packet. */
-typedef struct tag_cmd_pkt_tx_feedback {
+struct cmd_pkt_tx_feedback {
 	/* DWORD 0 */
 	u8	element_id;			/* Command packet type. */
 	u8	length;				/* Command packet length. */
@@ -52,7 +52,7 @@ typedef struct tag_cmd_pkt_tx_feedback {
 	/* DWORD 5 */
 	u16	reserve3;
 	u16	duration;
-} cmpk_txfb_t;
+};
 
 /* 2. RX side: Interrupt status packet. It includes Beacon State,
  * Beacon Timer Interrupt and other useful informations in MAC ISR Reg.
Signature · 1 line
2.18.0
#3 lore raw

PATCH v2 2/15 staging:rtl8192u: Remove unused CMPK_TX_SET_CONFIG_SIZE - Style

In reply to John Whitmore

Remove the unused macro CMPK_TX_SET_CONFIG_SIZE. This is a coding style change which should not impact runtime code execution.

---
 drivers/staging/rtl8192u/r819xU_cmdpkt.h | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/rtl8192u/r819xU_cmdpkt.h +0 -1
index 756e08bd341a..fab982668b44 100644
@@ -3,7 +3,6 @@
 #define R819XUSB_CMDPKT_H
 /* Different command packet have dedicated message length and definition. */
 #define		CMPK_RX_TX_FB_SIZE		sizeof(struct cmd_pkt_tx_feedback)	/* 20 */
-#define		CMPK_TX_SET_CONFIG_SIZE		sizeof(cmpk_set_cfg_t)	/* 16 */
 #define		CMPK_BOTH_QUERY_CONFIG_SIZE	sizeof(cmpk_set_cfg_t)	/* 16 */
 #define		CMPK_RX_TX_STS_SIZE		sizeof(cmpk_tx_status_t)
 #define		CMPK_RX_DBG_MSG_SIZE		sizeof(cmpk_rx_dbginfo_t)
Signature · 1 line
2.18.0
#4 lore raw

PATCH v2 2/8 staging:rtl8192u: Rename ACI_AIFSN - Style

In reply to John Whitmore

Rename the union ACI_AIFSN to aci_aifsn and remove the typedef directive.

The removal of the typedef clears the checkpatch issue with defining new types. The renaming is to adhere to the coding style where types are name in lower case.

These changes are coding style changes which should have no impact on runtime execution.

---
 drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h | 6 +++---
 drivers/staging/rtl8192u/r8192U_dm.c             | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h +3 -3
index 92afa9dc9663..5856bf87c5dc 100644
@@ -13,7 +13,7 @@
 // ACI/AIFSN Field.
 // Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
 //
-typedef	union _ACI_AIFSN {
+union aci_aifsn {
 	u8	charData;
 
 	struct {
@@ -22,7 +22,7 @@ typedef	union _ACI_AIFSN {
 		u8	ACI:2;
 		u8	Reserved:1;
 	} f;	// Field
-} ACI_AIFSN, *PACI_AIFSN;
+};
 
 //
 // ECWmin/ECWmax field.
@@ -45,7 +45,7 @@ typedef	union _AC_PARAM {
 	u8	charData[4];
 
 	struct {
-		ACI_AIFSN	AciAifsn;
+		union aci_aifsn	AciAifsn;
 		ECW		Ecw;
 		u16		TXOPLimit;
 	} f;	// Field
drivers/staging/rtl8192u/r8192U_dm.c +1 -1
index c4e4e3ba394b..04c08ca8a0bb 100644
@@ -2333,7 +2333,7 @@ static void dm_check_edca_turbo(
 			{
 				/*  TODO:  Modified this part and try to set acm control in only 1 IO processing!! */
 
-				PACI_AIFSN	pAciAifsn = (PACI_AIFSN)&(qos_parameters->aifs[0]);
+				union aci_aifsn *pAciAifsn = (union aci_aifsn *)&(qos_parameters->aifs[0]);
 				u8		AcmCtrl;
 
 				read_nic_byte(dev, AcmHwCtrl, &AcmCtrl);
Signature · 1 line
2.18.0
#5 lore raw

Re: [PATCH v2 02/08] staging:rtl8192u: Rename ACI_AIFSN - Style

Quoted 6 lines · John Whitmore

Rename the union ACI_AIFSN to aci_aifsn and remove the typedef directive.

The removal of the typedef clears the checkpatch issue with defining new types. The renaming is to adhere to the coding style where types are name in lower case.

Quoted 9 lines

These changes are coding style changes which should have no impact on runtime execution.

---
 drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h | 6 +++---
 drivers/staging/rtl8192u/r8192U_dm.c             | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

Again :(

Ignore - Sorry sent by mistake, forgot to clean out previous patches.

#6 lore raw

PATCH v2 3/15 staging:rtl8192u: Removed unused CMPK_RX_DBG_MSG_SIZE - Style

In reply to John Whitmore

Remove the unused macro definition CMPK_RX_DBG_MSG_SIZE. This is a coding style change which should have no impact on runtime code execution.

---
 drivers/staging/rtl8192u/r819xU_cmdpkt.h | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/rtl8192u/r819xU_cmdpkt.h +0 -1
index fab982668b44..50218d9a406b 100644
@@ -5,7 +5,6 @@
 #define		CMPK_RX_TX_FB_SIZE		sizeof(struct cmd_pkt_tx_feedback)	/* 20 */
 #define		CMPK_BOTH_QUERY_CONFIG_SIZE	sizeof(cmpk_set_cfg_t)	/* 16 */
 #define		CMPK_RX_TX_STS_SIZE		sizeof(cmpk_tx_status_t)
-#define		CMPK_RX_DBG_MSG_SIZE		sizeof(cmpk_rx_dbginfo_t)
 #define		CMPK_TX_RAHIS_SIZE		sizeof(cmpk_tx_rahis_t)
 
 /* 2008/05/08 amy For USB constant. */
Signature · 1 line
2.18.0
#7 lore raw

PATCH v2 3/8 staging:rtl8192u: Rename member variables - Style

In reply to John Whitmore

Rename the member variables of union aci_aifsn, which should be named in lowercase. The only member variable, of this union, which is actually used is 'acm'.

This are coding style changes which should have no impact on runtime code execution.

---
 drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h | 10 +++++-----
 drivers/staging/rtl8192u/r8192U_dm.c             |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h +5 -5
index 5856bf87c5dc..901b85139d3b 100644
@@ -14,13 +14,13 @@
 // Ref: WMM spec 2.2.2: WME Parameter Element, p.12.
 //
 union aci_aifsn {
-	u8	charData;
+	u8	char_data;
 
 	struct {
-		u8	AIFSN:4;
-		u8	ACM:1;
-		u8	ACI:2;
-		u8	Reserved:1;
+		u8	aifsn:4;
+		u8	acm:1;
+		u8	aci:2;
+		u8	reserved:1;
 	} f;	// Field
 };
 
drivers/staging/rtl8192u/r8192U_dm.c +1 -1
index 04c08ca8a0bb..7dc912dd53af 100644
@@ -2338,7 +2338,7 @@ static void dm_check_edca_turbo(
 
 				read_nic_byte(dev, AcmHwCtrl, &AcmCtrl);
 
-				if (pAciAifsn->f.ACM) { /*  ACM bit is 1. */
+				if (pAciAifsn->f.acm) { /*  acm bit is 1. */
 					AcmCtrl |= AcmHw_BeqEn;
 				} else {	/* ACM bit is 0. */
 					AcmCtrl &= (~AcmHw_BeqEn);
Signature · 1 line
2.18.0
#8 lore raw

Re: [PATCH v2 03/08] staging:rtl8192u: Rename member variables - Style

Quoted 10 lines · John Whitmore

Rename the member variables of union aci_aifsn, which should be named in lowercase. The only member variable, of this union, which is actually used is 'acm'.

This are coding style changes which should have no impact on runtime code execution.

---
 drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h | 10 +++++-----

Ignore - Sorry sent by mistake, forgot to clean out previous patches.

#9 lore raw

PATCH v2 4/15 staging:rtl8192u: Correct spelling in comments - style

In reply to John Whitmore

Correct the spelling of a number of comments, which cause a checkpatch issue. This is purely a coding style change which should have no impact on runtime code execution.

---
 drivers/staging/rtl8192u/r819xU_cmdpkt.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/r819xU_cmdpkt.h +2 -2
index 50218d9a406b..d2e07b0ff30b 100644
@@ -53,7 +53,7 @@ struct cmd_pkt_tx_feedback {
 };
 
 /* 2. RX side: Interrupt status packet. It includes Beacon State,
- * Beacon Timer Interrupt and other useful informations in MAC ISR Reg.
+ * Beacon Timer Interrupt and other useful information in MAC ISR Reg.
  */
 typedef struct tag_cmd_pkt_interrupt_status {
 	u8	element_id;			/* Command packet type. */
@@ -80,7 +80,7 @@ typedef struct tag_cmd_pkt_set_configuration {
 	u32	mask;
 } cmpk_set_cfg_t;
 
-/* 4. Both side : TX/RX query configuraton packet. The query structure is the
+/* 4. Both side : TX/RX query configuration packet. The query structure is the
  *    same as set configuration.
  */
 #define		cmpk_query_cfg_t	cmpk_set_cfg_t
Signature · 1 line
2.18.0
#10 lore raw
In reply to John Whitmore
Quoted 21 lines · John Whitmore

Second attempt correcting my initial attempt where I left '_t' and '_e' trailing the structures defined. These have now been corrected.

John Whitmore (15):
staging:rtl8192u: Remove typedef of struct cmpk_txfb_t - Style staging:rtl8192u: Remove unused CMPK_TX_SET_CONFIG_SIZE - Style staging:rtl8192u: Removed unused CMPK_RX_DBG_MSG_SIZE - Style staging:rtl8192u: Correct spelling in comments - style staging:rtl8192u: Remove typedef of cmpk_intr_sta_t - Style staging:rtl8192u: Remove typedef of cmpk_set_cfg_t - Style staging:rtl8192u: Refactor use of enum dm_dig_sta_e - Style staging:rtl8192u: Refactor enum dm_ratr_sta_e usage - Style staging:rtl8192u: Remove enum dm_dig_op_e - Style staging:rtl8192u: Refactor enum dm_dig_alg_e - Style staging:rtl8192u: Remove unused enum dm_dig_dbg_e - Style staging:rtl8192u: Refactor dm_dig_connect_e - Style staging:rtl8192u: Refactor enum dm_dig_pd_th_e - Style staging:rtl8192u: Refactor enum dm_dig_cs_ratio_e - Style staging:rtl8192u: Refactor enum DM_CCK_Rx_Path_Method - Style

Quoted 10 lines
 drivers/staging/rtl8192u/r8192U.h        |  10 +-
 drivers/staging/rtl8192u/r8192U_dm.c     |  91 -----------------
 drivers/staging/rtl8192u/r8192U_dm.h     | 122 ++++++++---------------
 drivers/staging/rtl8192u/r819xU_cmdpkt.c |  16 +--
 drivers/staging/rtl8192u/r819xU_cmdpkt.h |  24 ++---
 5 files changed, 70 insertions(+), 193 deletions(-)
Signature · 1 line
2.18.0

I made a mistake and sent patches when I had old patches still left from a previous :( That meant a few patch xx/08 were sent.

I then resent the proper patch set xx/15 but in hindsight I should have bumped the version to 3?

Scissors :(