[PATCH] Staging: rtl8192u: Remove typedefs and rename structures
Cristina Opriceana
cristina.opriceana at gmail.com
Thu Mar 5 01:14:44 EET 2015
This patch removes typedefs from structures and unions and rewrites code
into an equivalent form. It also rewrites some comments in order to
remove the associated warnings.
Warnings found by checkpatch.pl.
Signed-off-by: Cristina Opriceana <cristina.opriceana at gmail.com>
---
drivers/staging/rtl8192u/ieee80211/ieee80211.h | 2 +-
drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h | 26 ++++----
.../staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 70 +++++++++++-----------
drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h | 6 +-
4 files changed, 54 insertions(+), 50 deletions(-)
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index b44aa17..0c75ebe 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -2563,7 +2563,7 @@ extern void TsInitDelBA(struct ieee80211_device *ieee,
extern void BaSetupTimeOut(unsigned long data);
extern void TxBaInactTimeout(unsigned long data);
extern void RxBaInactTimeout(unsigned long data);
-extern void ResetBaEntry(PBA_RECORD pBA);
+extern void ResetBaEntry(struct ba_record *pBA);
//function in TS.c
extern bool GetTs(
struct ieee80211_device *ieee,
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h
index 2c398ca..4f9cc9b 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BA.h
@@ -25,16 +25,20 @@ struct ieee80211_ADDBA_Req{
u8
} __attribute__ ((packed));
*/
-//Is this need?I put here just to make it easier to define structure BA_RECORD //WB
-typedef union _SEQUENCE_CONTROL{
+
+/*
+ * Is this need? I put here just to make it easier
+ * to define structure ba_record //WB
+ */
+union sequence_control {
u16 ShortData;
struct {
u16 FragNum:4;
u16 SeqNum:12;
}field;
-}SEQUENCE_CONTROL, *PSEQUENCE_CONTROL;
+};
-typedef union _BA_PARAM_SET {
+union ba_param_set {
u8 charData[2];
u16 shortData;
struct {
@@ -43,9 +47,9 @@ typedef union _BA_PARAM_SET {
u16 TID:4;
u16 BufferSize:10;
} field;
-} BA_PARAM_SET, *PBA_PARAM_SET;
+};
-typedef union _DELBA_PARAM_SET {
+union delba_param_set {
u8 charData[2];
u16 shortData;
struct {
@@ -53,15 +57,15 @@ typedef union _DELBA_PARAM_SET {
u16 Initiator:1;
u16 TID:4;
} field;
-} DELBA_PARAM_SET, *PDELBA_PARAM_SET;
+};
-typedef struct _BA_RECORD {
+struct ba_record {
struct timer_list Timer;
u8 bValid;
u8 DialogToken;
- BA_PARAM_SET BaParamSet;
+ union ba_param_set BaParamSet;
u16 BaTimeoutValue;
- SEQUENCE_CONTROL BaStartSeqCtrl;
-} BA_RECORD, *PBA_RECORD;
+ union sequence_control BaStartSeqCtrl;
+};
#endif //end _BATYPE_H_
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
index 1b4623c..a5f68c7 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
@@ -11,11 +11,11 @@
/********************************************************************************************************************
*function: Activate BA entry. And if Time is nozero, start timer.
- * input: PBA_RECORD pBA //BA entry to be enabled
+ * input: struct ba_record *pBA //BA entry to be enabled
* u16 Time //indicate time delay.
* output: none
********************************************************************************************************************/
-static void ActivateBAEntry(struct ieee80211_device *ieee, PBA_RECORD pBA, u16 Time)
+static void ActivateBAEntry(struct ieee80211_device *ieee, struct ba_record *pBA, u16 Time)
{
pBA->bValid = true;
if(Time != 0)
@@ -24,10 +24,10 @@ static void ActivateBAEntry(struct ieee80211_device *ieee, PBA_RECORD pBA, u16 T
/********************************************************************************************************************
*function: deactivate BA entry, including its timer.
- * input: PBA_RECORD pBA //BA entry to be disabled
+ * input: struct ba_record *pBA //BA entry to be disabled
* output: none
********************************************************************************************************************/
-static void DeActivateBAEntry(struct ieee80211_device *ieee, PBA_RECORD pBA)
+static void DeActivateBAEntry(struct ieee80211_device *ieee, struct ba_record *pBA)
{
pBA->bValid = false;
del_timer_sync(&pBA->Timer);
@@ -41,8 +41,8 @@ static void DeActivateBAEntry(struct ieee80211_device *ieee, PBA_RECORD pBA)
********************************************************************************************************************/
static u8 TxTsDeleteBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTs)
{
- PBA_RECORD pAdmittedBa = &pTxTs->TxAdmittedBARecord; //These two BA entries must exist in TS structure
- PBA_RECORD pPendingBa = &pTxTs->TxPendingBARecord;
+ struct ba_record *pAdmittedBa = &pTxTs->TxAdmittedBARecord; /* These two BA entries must exist in TS structure */
+ struct ba_record *pPendingBa = &pTxTs->TxPendingBARecord;
u8 bSendDELBA = false;
// Delete pending BA
@@ -71,7 +71,7 @@ static u8 TxTsDeleteBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTs)
********************************************************************************************************************/
static u8 RxTsDeleteBA(struct ieee80211_device *ieee, PRX_TS_RECORD pRxTs)
{
- PBA_RECORD pBa = &pRxTs->RxAdmittedBARecord;
+ struct ba_record *pBa = &pRxTs->RxAdmittedBARecord;
u8 bSendDELBA = false;
if(pBa->bValid)
@@ -86,10 +86,10 @@ static u8 RxTsDeleteBA(struct ieee80211_device *ieee, PRX_TS_RECORD pRxTs)
/********************************************************************************************************************
*function: reset BA entry
* input:
- * PBA_RECORD pBA //entry to be reset
+ * struct ba_record *pBA //entry to be reset
* output: none
********************************************************************************************************************/
-void ResetBaEntry(PBA_RECORD pBA)
+void ResetBaEntry(struct ba_record *pBA)
{
pBA->bValid = false;
pBA->BaParamSet.shortData = 0;
@@ -101,13 +101,13 @@ void ResetBaEntry(PBA_RECORD pBA)
/*******************************************************************************************************************************
*function: construct ADDBAREQ and ADDBARSP frame here together.
* input: u8* Dst //ADDBA frame's destination
- * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA.
+ * struct ba_record *pBA //struct ba_record entry which stores the necessary information for BA.
* u16 StatusCode //status code in RSP and I will use it to indicate whether it's RSP or REQ(will I?)
* u8 type //indicate whether it's RSP(ACT_ADDBARSP) ow REQ(ACT_ADDBAREQ)
* output: none
* return: sk_buff* skb //return constructed skb to xmit
*******************************************************************************************************************************/
-static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, PBA_RECORD pBA, u16 StatusCode, u8 type)
+static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, struct ba_record *pBA, u16 StatusCode, u8 type)
{
struct sk_buff *skb = NULL;
struct ieee80211_hdr_3addr *BAReq = NULL;
@@ -179,7 +179,7 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P
/********************************************************************************************************************
*function: construct DELBA frame
* input: u8* dst //DELBA frame's destination
- * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA
+ * struct ba_record *pBA //struct ba_record entry which stores the necessary information for BA
* TR_SELECT TxRxSelect //TX RX direction
* u16 ReasonCode //status code.
* output: none
@@ -187,13 +187,13 @@ static struct sk_buff *ieee80211_ADDBA(struct ieee80211_device *ieee, u8 *Dst, P
********************************************************************************************************************/
static struct sk_buff *ieee80211_DELBA(
struct ieee80211_device *ieee,
- u8 *dst,
- PBA_RECORD pBA,
+ u8 *dst,
+ struct ba_record *pBA,
TR_SELECT TxRxSelect,
u16 ReasonCode
)
{
- DELBA_PARAM_SET DelbaParamSet;
+ union delba_param_set DelbaParamSet;
struct sk_buff *skb = NULL;
struct ieee80211_hdr_3addr *Delba = NULL;
u8 *tag = NULL;
@@ -247,12 +247,12 @@ static struct sk_buff *ieee80211_DELBA(
/********************************************************************************************************************
*function: send ADDBAReq frame out
* input: u8* dst //ADDBAReq frame's destination
- * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA
+ * struct ba_record *pBA //struct ba_record entry which stores the necessary information for BA
* output: none
* notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does
********************************************************************************************************************/
static void ieee80211_send_ADDBAReq(struct ieee80211_device *ieee,
- u8 *dst, PBA_RECORD pBA)
+ u8 *dst, struct ba_record *pBA)
{
struct sk_buff *skb = NULL;
skb = ieee80211_ADDBA(ieee, dst, pBA, 0, ACT_ADDBAREQ); //construct ACT_ADDBAREQ frames so set statuscode zero.
@@ -274,13 +274,13 @@ static void ieee80211_send_ADDBAReq(struct ieee80211_device *ieee,
/********************************************************************************************************************
*function: send ADDBARSP frame out
* input: u8* dst //DELBA frame's destination
- * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA
+ * struct ba_record *pBA //struct ba_record entry which stores the necessary information for BA
* u16 StatusCode //RSP StatusCode
* output: none
* notice: If any possible, please hide pBA in ieee. And temporarily use Manage Queue as softmac_mgmt_xmit() usually does
********************************************************************************************************************/
static void ieee80211_send_ADDBARsp(struct ieee80211_device *ieee, u8 *dst,
- PBA_RECORD pBA, u16 StatusCode)
+ struct ba_record *pBA, u16 StatusCode)
{
struct sk_buff *skb = NULL;
skb = ieee80211_ADDBA(ieee, dst, pBA, StatusCode, ACT_ADDBARSP); //construct ACT_ADDBARSP frames
@@ -300,7 +300,7 @@ static void ieee80211_send_ADDBARsp(struct ieee80211_device *ieee, u8 *dst,
/********************************************************************************************************************
*function: send ADDBARSP frame out
* input: u8* dst //DELBA frame's destination
- * PBA_RECORD pBA //BA_RECORD entry which stores the necessary information for BA
+ * struct ba_record *pBA //struct ba_record entry which stores the necessary information for BA
* TR_SELECT TxRxSelect //TX or RX
* u16 ReasonCode //DEL ReasonCode
* output: none
@@ -308,7 +308,7 @@ static void ieee80211_send_ADDBARsp(struct ieee80211_device *ieee, u8 *dst,
********************************************************************************************************************/
static void ieee80211_send_DELBA(struct ieee80211_device *ieee, u8 *dst,
- PBA_RECORD pBA, TR_SELECT TxRxSelect,
+ struct ba_record *pBA, TR_SELECT TxRxSelect,
u16 ReasonCode)
{
struct sk_buff *skb = NULL;
@@ -336,10 +336,10 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb)
struct ieee80211_hdr_3addr *req = NULL;
u16 rc = 0;
u8 *dst = NULL, *pDialogToken = NULL, *tag = NULL;
- PBA_RECORD pBA = NULL;
- PBA_PARAM_SET pBaParamSet = NULL;
+ struct ba_record *pBA = NULL;
+ union ba_param_set *pBaParamSet = NULL;
u16 *pBaTimeoutVal = NULL;
- PSEQUENCE_CONTROL pBaStartSeqCtrl = NULL;
+ union sequence_control *pBaStartSeqCtrl = NULL;
PRX_TS_RECORD pTS = NULL;
if (skb->len < sizeof(struct ieee80211_hdr_3addr) + 9) {
@@ -356,10 +356,10 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb)
tag = (u8 *)req;
dst = (u8 *)(&req->addr2[0]);
tag += sizeof(struct ieee80211_hdr_3addr);
- pDialogToken = tag + 2; //category+action
- pBaParamSet = (PBA_PARAM_SET)(tag + 3); //+DialogToken
+ pDialogToken = tag + 2; /* category+action */
+ pBaParamSet = (union ba_param_set *)(tag + 3); /* +DialogToken */
pBaTimeoutVal = (u16 *)(tag + 5);
- pBaStartSeqCtrl = (PSEQUENCE_CONTROL)(req + 7);
+ pBaStartSeqCtrl = (union sequence_control *)(req + 7);
printk("====================>rx ADDBAREQ from :%pM\n", dst);
//some other capability is not ready now.
@@ -416,7 +416,7 @@ int ieee80211_rx_ADDBAReq(struct ieee80211_device *ieee, struct sk_buff *skb)
OnADDBAReq_Fail:
{
- BA_RECORD BA;
+ struct ba_record BA;
BA.BaParamSet = *pBaParamSet;
BA.BaTimeoutValue = *pBaTimeoutVal;
BA.DialogToken = *pDialogToken;
@@ -436,11 +436,11 @@ OnADDBAReq_Fail:
int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb)
{
struct ieee80211_hdr_3addr *rsp = NULL;
- PBA_RECORD pPendingBA, pAdmittedBA;
+ struct ba_record *pPendingBA, *pAdmittedBA;
PTX_TS_RECORD pTS = NULL;
u8 *dst = NULL, *pDialogToken = NULL, *tag = NULL;
u16 *pStatusCode = NULL, *pBaTimeoutVal = NULL;
- PBA_PARAM_SET pBaParamSet = NULL;
+ union ba_param_set *pBaParamSet = NULL;
u16 ReasonCode;
if (skb->len < sizeof(struct ieee80211_hdr_3addr) + 9) {
@@ -456,7 +456,7 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb)
tag += sizeof(struct ieee80211_hdr_3addr);
pDialogToken = tag + 2;
pStatusCode = (u16 *)(tag + 3);
- pBaParamSet = (PBA_PARAM_SET)(tag + 5);
+ pBaParamSet = (union ba_param_set *)(tag + 5);
pBaTimeoutVal = (u16 *)(tag + 7);
// Check the capability
@@ -553,7 +553,7 @@ int ieee80211_rx_ADDBARsp(struct ieee80211_device *ieee, struct sk_buff *skb)
OnADDBARsp_Reject:
{
- BA_RECORD BA;
+ struct ba_record BA;
BA.BaParamSet = *pBaParamSet;
ieee80211_send_DELBA(ieee, dst, &BA, TX_DIR, ReasonCode);
return 0;
@@ -570,7 +570,7 @@ OnADDBARsp_Reject:
int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb)
{
struct ieee80211_hdr_3addr *delba = NULL;
- PDELBA_PARAM_SET pDelBaParamSet = NULL;
+ union delba_param_set *pDelBaParamSet = NULL;
u16 *pReasonCode = NULL;
u8 *dst = NULL;
@@ -593,7 +593,7 @@ int ieee80211_rx_DELBA(struct ieee80211_device *ieee, struct sk_buff *skb)
delba = (struct ieee80211_hdr_3addr *)skb->data;
dst = (u8 *)(&delba->addr2[0]);
delba += sizeof(struct ieee80211_hdr_3addr);
- pDelBaParamSet = (PDELBA_PARAM_SET)(delba+2);
+ pDelBaParamSet = (union delba_param_set *)(delba+2);
pReasonCode = (u16 *)(delba+4);
if(pDelBaParamSet->field.Initiator == 1)
@@ -651,7 +651,7 @@ TsInitAddBA(
u8 bOverwritePending
)
{
- PBA_RECORD pBA = &pTS->TxPendingBARecord;
+ struct ba_record *pBA = &pTS->TxPendingBARecord;
if(pBA->bValid==true && bOverwritePending==false)
return;
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h
index 873969c..01a0e85 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h
@@ -28,8 +28,8 @@ typedef struct _TS_COMMON_INFO{
typedef struct _TX_TS_RECORD{
TS_COMMON_INFO TsCommonInfo;
u16 TxCurSeq;
- BA_RECORD TxPendingBARecord; /* For BA Originator */
- BA_RECORD TxAdmittedBARecord; /* For BA Originator */
+ struct ba_record TxPendingBARecord; /* For BA Originator */
+ struct ba_record TxAdmittedBARecord; /* For BA Originator */
/* QOS_DL_RECORD DLRecord; */
u8 bAddBaReqInProgress;
u8 bAddBaReqDelayed;
@@ -44,7 +44,7 @@ typedef struct _RX_TS_RECORD {
u16 RxTimeoutIndicateSeq;
struct list_head RxPendingPktList;
struct timer_list RxPktPendingTimer;
- BA_RECORD RxAdmittedBARecord; /* For BA Recipient */
+ struct ba_record RxAdmittedBARecord; /* For BA Recipient */
u16 RxLastSeqNum;
u8 RxLastFragNum;
u8 num;
--
1.9.1
More information about the firefly
mailing list