staging:rtl8192u: Coding style - r819xU_cmdpkt.h
cover staging:rtl8192u: Coding style - r819xU_cmdpkt.h
This series of patches contain purely simple coding style changes.
I considered renaming the struct cmpk_set_cfg_t as it is never actually used. Following its definition however it is used in a #define:
#define cmpk_query_cfg_t cmpk_set_cfg_t
So whilst the struct cmpk_set_cfg_t is never used, cmpk_query_cfg_t is. I left it because the comments described this.
I was also tempted to remove comments at the end of lines pushing the lines over 80 character length. The comments are at the end of sizeof operators which explicitly state the size. I'm not sure much is gained by the comment, but I left them in:
#define ... sizeof(struct cmpk_txfb_t) /* 20 */
#define ... sizeof(struct cmpk_set_cfg_t) /* 16 */
*** BLURB HERE ***
John Whitmore (10):
staging:rtl8192u: Remove typedef of struct cmpk_txfb_t - Style staging:rtl8192u: Remove unused CMPK_TX_SET_CONFIG_SIZE - Style staging:rtl8192u: Rename bit definition ISR_TxBcnOk - Style staging:rtl8192u: Removed unused CMPK_RX_DBG_MSG_SIZE - Style staging:rtl8192u: Rename ISR_TxBcnErr bit definition - Style staging:rtl8192u: Rename ISR_BcnTimerIntr - Style staging:rtl8192u: Remove multiple blank lines - Style staging:rtl8192u: Correct spelling in comments - style staging:rtl8192u: Remove typedef of struct cmpk_intr_sta_t - Style staging:rtl8192u: Remove typedef from struct cmpk_set_cfg_t - Style
drivers/staging/rtl8192u/r819xU_cmdpkt.c | 22 ++++++++--------- drivers/staging/rtl8192u/r819xU_cmdpkt.h | 31 ++++++++++-------------- 2 files changed, 24 insertions(+), 29 deletions(-)
Signature · 1 line
2.18.0
PATCH 1/10 staging:rtl8192u: Remove typedef of struct cmpk_txfb_t - Style
Remove the typedef of the structure cmpk_txfb_t. This clears the checkpatch issue with defining new types. This change is purely a coding style change which should not impact 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
@@ -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 CMPK_TXFB_T *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 cmpk_txfb_t *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 cmpk_txfb_t 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 cmpk_txfb_t ));/* 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
@@ -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 cmpk_txfb_t)/* 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)
@@ -20,7 +20,7 @@/*------------------------------Define structure----------------------------*/ /* Define different command packet structure. */ /* 1. RX side: TX feedback packet. */ -typedef struct tag_cmd_pkt_tx_feedback { +struct cmpk_txfb_t {/* DWORD 0 */ u8 element_id;/* Command packet type. */ u8 length;/* Command packet length. */
@@ -53,7 +53,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
Greg KH
maintainerRe: [PATCH 01/10] staging:rtl8192u: Remove typedef of struct cmpk_txfb_t - Style
drivers/staging/rtl8192u/r819xU_cmdpkt.h typedef struct tag_cmd_pkt_tx_feedback { · line 56
Quoted 11 lines · John Whitmore
drivers/staging/rtl8192u/r819xU_cmdpkt.h +2
-2-typedef struct tag_cmd_pkt_tx_feedback { +struct cmpk_txfb_t {/* DWORD 0 */ u8 element_id;/* Command packet type. */ u8 length;/* Command packet length. */ @@ -53,7 +53,7 @@ typedef struct tag_cmd_pkt_tx_feedback {/* DWORD 5 */ u16 reserve3;u16 duration; -} cmpk_txfb_t; +};
People use the "_t" to try to denote a "typedef". When converting to just a structure, there is no need to keep the _t anymore at all, so this should just be "struct cmpk_txfb".
Or just drop the typedef and use the name for the struct they had here already, "struct tag_cmd_pkt_tx_feedback", that also would work.
Same for all of the other patches in this series.
thanks,
greg k-h
Re: [PATCH 01/10] staging:rtl8192u: Remove typedef of struct cmpk_txfb_t - Style
Quoted 17 lines · Greg KH
drivers/staging/rtl8192u/r819xU_cmdpkt.h typedef struct tag_cmd_pkt_tx_feedback { · line 56
Quoted 11 lines · John Whitmore
drivers/staging/rtl8192u/r819xU_cmdpkt.h +2
-2-typedef struct tag_cmd_pkt_tx_feedback { +struct cmpk_txfb_t {/* DWORD 0 */ u8 element_id;/* Command packet type. */ u8 length;/* Command packet length. */ @@ -53,7 +53,7 @@ typedef struct tag_cmd_pkt_tx_feedback {/* DWORD 5 */ u16 reserve3;u16 duration; -} cmpk_txfb_t; +};People use the "_t" to try to denote a "typedef". When converting to just a structure, there is no need to keep the _t anymore at all, so this should just be "struct
cmpk_txfb".
Quoted 8 lines
Or just drop the typedef and use the name for the struct they had here already, "struct
tag_cmd_pkt_tx_feedback", that also would work.Same for all of the other patches in this series.
thanks,
greg k-h
Oops again. Sorry, that should have occured to me. I'll fix up the affected and resend.
thank you
jwhitmore
PATCH 2/10 staging:rtl8192u: Remove unused CMPK_TX_SET_CONFIG_SIZE - Style
In reply to John WhitmoreRemove 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
@@ -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 cmpk_txfb_t)/* 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
PATCH 3/10 staging:rtl8192u: Rename bit definition ISR_TxBcnOk - Style
In reply to John WhitmoreRename the bit definition ISR_TxBcnOk to ISR_TX_BCN_OK. This change clears the checkpatch issue with CamelCase naming. The change is a coding style change which should not impact runtime code execution.
--- drivers/staging/rtl8192u/r819xU_cmdpkt.c | 2 +- drivers/staging/rtl8192u/r819xU_cmdpkt.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/r819xU_cmdpkt.c +1 -1
@@ -249,7 +249,7 @@ static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg)DMESG ("interrupt status = 0x%x\n" , rx_intr_status.interrupt_status); -if (rx_intr_status.interrupt_status & ISR_TxBcnOk) { +if (rx_intr_status.interrupt_status &ISR_TX_BCN_OK ) { priv->ieee80211->bibsscoordinator = true; priv->stats.txbeaconokint++; }else if (rx_intr_status.interrupt_status & ISR_TxBcnErr) {
drivers/staging/rtl8192u/r819xU_cmdpkt.h +1 -1
@@ -9,7 +9,7 @@#define CMPK_TX_RAHIS_SIZE sizeof(cmpk_tx_rahis_t)/* 2008/05/08 amy For USB constant. */ -#define ISR_TxBcnOk BIT(27)/* Transmit Beacon OK */ +#define ISR_TX_BCN_OK BIT(27)/* Transmit Beacon OK */ #define ISR_TxBcnErr BIT(26)/* Transmit Beacon Error */ #define ISR_BcnTimerIntr BIT(13)/* Beacon Timer Interrupt */
Signature · 1 line
2.18.0
PATCH 4/10 staging:rtl8192u: Removed unused CMPK_RX_DBG_MSG_SIZE - Style
In reply to John WhitmoreRemove 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
@@ -5,7 +5,6 @@#define CMPK_RX_TX_FB_SIZE sizeof(struct cmpk_txfb_t)/* 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
PATCH 5/10 staging:rtl8192u: Rename ISR_TxBcnErr bit definition - Style
In reply to John WhitmoreRename the bit definition ISR_TxBcnErr to ISR_TX_BCN_ERR. This change clears the checkpatch issue with CamelCase naming. The change is purely a coding style change which should not impact runtime code execution.
--- drivers/staging/rtl8192u/r819xU_cmdpkt.c | 2 +- drivers/staging/rtl8192u/r819xU_cmdpkt.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/r819xU_cmdpkt.c +1 -1
@@ -252,7 +252,7 @@ static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg)if (rx_intr_status.interrupt_status &ISR_TX_BCN_OK ) { priv->ieee80211->bibsscoordinator = true; priv->stats.txbeaconokint++; - }else if (rx_intr_status.interrupt_status & ISR_TxBcnErr) { + }else if (rx_intr_status.interrupt_status &ISR_TX_BCN_ERR ) { priv->ieee80211->bibsscoordinator = false; priv->stats.txbeaconerr++; }
drivers/staging/rtl8192u/r819xU_cmdpkt.h +1 -1
@@ -9,7 +9,7 @@/* 2008/05/08 amy For USB constant. */ #define ISR_TX_BCN_OK BIT(27)/* Transmit Beacon OK */ -#define ISR_TxBcnErr BIT(26)/* Transmit Beacon Error */ +#define ISR_TX_BCN_ERR BIT(26)/* Transmit Beacon Error */ #define ISR_BcnTimerIntr BIT(13)/* Beacon Timer Interrupt */
Signature · 1 line
2.18.0
PATCH 6/10 staging:rtl8192u: Rename ISR_BcnTimerIntr - Style
In reply to John WhitmoreRename the bit definition ISR_BcnTimerIntr to ISR_BCN_TIMER_INTR. This change clears the checkpatch issue with CamelCase naming. The change is purely a style change and should not impact runtime code execution.
--- drivers/staging/rtl8192u/r819xU_cmdpkt.c | 2 +- drivers/staging/rtl8192u/r819xU_cmdpkt.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/r819xU_cmdpkt.c +1 -1
@@ -257,7 +257,7 @@ static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg) priv->stats.txbeaconerr++; } -if (rx_intr_status.interrupt_status & ISR_BcnTimerIntr) +if (rx_intr_status.interrupt_status &ISR_BCN_TIMER_INTR )cmdpkt_beacontimerinterrupt_819xusb (dev); }
drivers/staging/rtl8192u/r819xU_cmdpkt.h +1 -1
@@ -10,7 +10,7 @@/* 2008/05/08 amy For USB constant. */ #define ISR_TX_BCN_OK BIT(27)/* Transmit Beacon OK */ #define ISR_TX_BCN_ERR BIT(26)/* Transmit Beacon Error */ -#define ISR_BcnTimerIntr BIT(13)/* Beacon Timer Interrupt */ +#define ISR_BCN_TIMER_INTR BIT(13)/* Beacon Timer Interrupt */ /* Define element ID of command packet. */
Signature · 1 line
2.18.0
PATCH 7/10 staging:rtl8192u: Remove multiple blank lines - Style
In reply to John WhitmoreRemove multiple blank lines, raise a checkpatch issue. This is purely a coding style change which should not impact runtime code execution.
--- drivers/staging/rtl8192u/r819xU_cmdpkt.h | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/rtl8192u/r819xU_cmdpkt.h +0 -3
@@ -12,7 +12,6 @@#define ISR_TX_BCN_ERR BIT(26)/* Transmit Beacon Error */ #define ISR_BCN_TIMER_INTR BIT(13)/* Beacon Timer Interrupt */ -/* Define element ID of command packet. */ /*------------------------------Define structure----------------------------*/
@@ -63,7 +62,6 @@ typedef struct tag_cmd_pkt_interrupt_status {u32 interrupt_status;/* Interrupt Status. */ } cmpk_intr_sta_t; -/* 3. TX side: Set configuration packet. */ typedef struct tag_cmd_pkt_set_configuration { u8 element_id; /* Command packet type. */
@@ -189,5 +187,4 @@ u32 cmpk_message_handle_rx(struct net_device *dev,rt_status SendTxCommandPacket (struct net_device *dev,void *pData,u32 DataLen); -#endif
Signature · 1 line
2.18.0
PATCH 8/10 staging:rtl8192u: Correct spelling in comments - style
In reply to John WhitmoreCorrect the spelling of a number of comments, which caused 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
@@ -53,7 +53,7 @@ struct cmpk_txfb_t { };/* 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
PATCH 9/10 staging:rtl8192u: Remove typedef of struct cmpk_intr_sta_t - Style
In reply to John WhitmoreRemove the typedef of struct cmpk_intr_sta_t. This clears the checkpatch issue with creating new types in code. The change is purely a coding style change and should have no impact on runtime code execution.
--- drivers/staging/rtl8192u/r819xU_cmdpkt.c | 6 +++--- drivers/staging/rtl8192u/r819xU_cmdpkt.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8192u/r819xU_cmdpkt.c +3 -3
@@ -225,7 +225,7 @@ static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev)*/ static void cmpk_handle_interrupt_status (struct net_device *dev,u8 *pmsg) { -cmpk_intr_sta_t rx_intr_status;/* */ +struct cmpk_intr_sta_t rx_intr_status;/* */ struct r8192_priv *priv =ieee80211_priv (dev);DMESG ("---> cmpk_Handle_Interrupt_Status()\n" );
@@ -236,7 +236,7 @@ static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg)* endian type before copy the message copy. */ rx_intr_status.length = pmsg[1 ]; -if (rx_intr_status.length != (sizeof (cmpk_intr_sta_t) -2 )) { +if (rx_intr_status.length != (sizeof (struct cmpk_intr_sta_t ) -2 )) {DMESG ("cmpk_Handle_Interrupt_Status: wrong length!\n" );return ; }
@@ -528,7 +528,7 @@ u32 cmpk_message_handle_rx(struct net_device *dev,case RX_INTERRUPT_STATUS :cmpk_handle_interrupt_status (dev, pcmd_buff); - cmd_length =sizeof (cmpk_intr_sta_t); + cmd_length =sizeof (struct cmpk_intr_sta_t );break ;case BOTH_QUERY_CONFIG :
drivers/staging/rtl8192u/r819xU_cmdpkt.h +2 -2
@@ -55,12 +55,12 @@ struct cmpk_txfb_t {/* 2. RX side: Interrupt status packet. It includes Beacon State, * Beacon Timer Interrupt and other useful information in MAC ISR Reg. */ -typedef struct tag_cmd_pkt_interrupt_status { +struct cmpk_intr_sta_t {u8 element_id;/* Command packet type. */ u8 length;/* Command packet length. */ u16 reserve;u32 interrupt_status;/* Interrupt Status. */ -}cmpk_intr_sta_t ; +};/* 3. TX side: Set configuration packet. */ typedef struct tag_cmd_pkt_set_configuration {
Signature · 1 line
2.18.0
PATCH 10/10 staging:rtl8192u: Remove typedef from struct cmpk_set_cfg_t - Style
In reply to John WhitmoreRemove the typedef from struct cmpk_set_cfg_t. This change clears the checkpatch issue with defining new types. The change is purely a coding style change which should have no impact on runtime code execution.
--- drivers/staging/rtl8192u/r819xU_cmdpkt.c | 2 +- drivers/staging/rtl8192u/r819xU_cmdpkt.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8192u/r819xU_cmdpkt.c +1 -1
@@ -288,7 +288,7 @@ static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg)*/ static void cmpk_handle_query_config_rx (struct net_device *dev,u8 *pmsg) { -cmpk_query_cfg_t rx_query_cfg; +struct cmpk_query_cfg_t rx_query_cfg;/* 1. Extract TX feedback info from RFD to temp structure buffer. */ /* It seems that FW use big endian(MIPS) and DRV use little endian in
drivers/staging/rtl8192u/r819xU_cmdpkt.h +3 -3
@@ -3,7 +3,7 @@#define R819XUSB_CMDPKT_H /* Different command packet have dedicated message length and definition. */ #define CMPK_RX_TX_FB_SIZE sizeof(struct cmpk_txfb_t)/* 20 */ -#define CMPK_BOTH_QUERY_CONFIG_SIZE sizeof(cmpk_set_cfg_t)/* 16 */ +#define CMPK_BOTH_QUERY_CONFIG_SIZE sizeof(struct cmpk_set_cfg_t)/* 16 */ #define CMPK_RX_TX_STS_SIZE sizeof(cmpk_tx_status_t)#define CMPK_TX_RAHIS_SIZE sizeof(cmpk_tx_rahis_t)
@@ -63,7 +63,7 @@ struct cmpk_intr_sta_t { };/* 3. TX side: Set configuration packet. */ -typedef struct tag_cmd_pkt_set_configuration { +struct cmpk_set_cfg_t {u8 element_id;/* Command packet type. */ u8 length;/* Command packet length. */ u16 reserve1;
@@ -78,7 +78,7 @@ typedef struct tag_cmd_pkt_set_configuration {u8 cfg_offset;u32 value;u32 mask; -} cmpk_set_cfg_t; +};/* 4. Both side : TX/RX query configuration packet. The query structure is the * same as set configuration.
Signature · 1 line
2.18.0