public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Whitmore <johnfwhitmore@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
	John Whitmore <johnfwhitmore@gmail.com>
Subject: [PATCH 05/14] staging:rtl8192u: Refactor union TSPEC_BODY - Style
Date: Tue, 31 Jul 2018 21:59:56 +0100	[thread overview]
Message-ID: <20180731210005.17452-6-johnfwhitmore@gmail.com> (raw)
In-Reply-To: <20180731210005.17452-1-johnfwhitmore@gmail.com>

The union TSPEC_BODY is never used as a union. The union comprises an
array of bytes and a bitfield structure, both of which are 55 bytes in
length, but the byte array is never used. As a result the union has
been truncated to the bitfield struct, which is actually used.

Additionally the typedef has been removed from the structure to clear
the checkpatch issue with defining new types. Additionally the name has
been changed to lowercase to comply with coding style.

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

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
---
 .../rtl8192u/ieee80211/rtl819x_BAProc.c       |  2 +-
 .../staging/rtl8192u/ieee80211/rtl819x_Qos.h  | 49 +++++++++----------
 .../staging/rtl8192u/ieee80211/rtl819x_TS.h   |  2 +-
 .../rtl8192u/ieee80211/rtl819x_TSProc.c       | 16 +++---
 4 files changed, 33 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
index 96fab43c1cfe..d35f10c695e4 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
@@ -626,7 +626,7 @@ TsInitAddBA(
 	pBA->DialogToken++;						// DialogToken: Only keep the latest dialog token
 	pBA->BaParamSet.field.AMSDU_Support = 0;	// Do not support A-MSDU with A-MPDU now!!
 	pBA->BaParamSet.field.BAPolicy = Policy;	// Policy: Delayed or Immediate
-	pBA->BaParamSet.field.TID = pTS->ts_common_info.t_spec.f.TSInfo.uc_tsid;	// TID
+	pBA->BaParamSet.field.TID = pTS->ts_common_info.t_spec.TSInfo.uc_tsid;	// TID
 	// BufferSize: This need to be set according to A-MPDU vector
 	pBA->BaParamSet.field.BufferSize = 32;		// BufferSize: This need to be set according to A-MPDU vector
 	pBA->BaTimeoutValue = 0;					// Timeout value: Set 0 to disable Timer
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h
index d36a14197b4c..a4cecf4cc756 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h
@@ -46,32 +46,29 @@ struct qos_tsinfo {
 	u8:7;
 };
 
-//
-// WMM TSPEC Body.
-// Ref: WMM spec 2.2.11: WME TSPEC Element, p.16.
-//
-typedef union _TSPEC_BODY {
-	u8		charData[55];
-
-	struct {
-		struct qos_tsinfo	TSInfo;	//u8	TSInfo[3];
-		u16	NominalMSDUsize;
-		u16	MaxMSDUsize;
-		u32	MinServiceItv;
-		u32	MaxServiceItv;
-		u32	InactivityItv;
-		u32	SuspenItv;
-		u32	ServiceStartTime;
-		u32	MinDataRate;
-		u32	MeanDataRate;
-		u32	PeakDataRate;
-		u32	MaxBurstSize;
-		u32	DelayBound;
-		u32	MinPhyRate;
-		u16	SurplusBandwidthAllowance;
-		u16	MediumTime;
-	} f;	// Field
-} TSPEC_BODY, *PTSPEC_BODY;
+/*
+ * WMM TSPEC Body.
+ * Ref: WMM spec 2.2.11: WME TSPEC Element, p.16.
+ * Note: sizeof 55 bytes
+ */
+struct tspec_body {
+	struct qos_tsinfo	TSInfo;	//u8	TSInfo[3];
+	u16	NominalMSDUsize;
+	u16	MaxMSDUsize;
+	u32	MinServiceItv;
+	u32	MaxServiceItv;
+	u32	InactivityItv;
+	u32	SuspenItv;
+	u32	ServiceStartTime;
+	u32	MinDataRate;
+	u32	MeanDataRate;
+	u32	PeakDataRate;
+	u32	MaxBurstSize;
+	u32	DelayBound;
+	u32	MinPhyRate;
+	u16	SurplusBandwidthAllowance;
+	u16	MediumTime;
+};
 
 //typedef struct _TCLASS{
 // TODO
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h
index f5e79853fe9c..a9f865f810ce 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h
@@ -19,7 +19,7 @@ struct ts_common_info {
 	struct timer_list		setup_timer;
 	struct timer_list		inact_timer;
 	u8				addr[6];
-	TSPEC_BODY			t_spec;
+	struct tspec_body		t_spec;
 	QOS_TCLAS			t_class[TCLAS_NUM];
 	u8				t_clas_proc;
 	u8				t_clas_num;
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
index 076278dae321..bd2b4e5dfa60 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
@@ -104,7 +104,7 @@ static void TsAddBaProcess(struct timer_list *t)
 static void ResetTsCommonInfo(struct ts_common_info *pTsCommonInfo)
 {
 	eth_zero_addr(pTsCommonInfo->addr);
-	memset(&pTsCommonInfo->t_spec, 0, sizeof(TSPEC_BODY));
+	memset(&pTsCommonInfo->t_spec, 0, sizeof(struct tspec_body));
 	memset(&pTsCommonInfo->t_class, 0, sizeof(QOS_TCLAS)*TCLAS_NUM);
 	pTsCommonInfo->t_clas_proc = 0;
 	pTsCommonInfo->t_clas_num = 0;
@@ -246,10 +246,10 @@ static struct ts_common_info *SearchAdmitTRStream(struct ieee80211_device *ieee,
 		if (!search_dir[dir])
 			continue;
 		list_for_each_entry(pRet, psearch_list, list){
-	//		IEEE80211_DEBUG(IEEE80211_DL_TS, "ADD:%pM, TID:%d, dir:%d\n", pRet->Addr, pRet->TSpec.f.TSInfo.ucTSID, pRet->TSpec.f.TSInfo.ucDirection);
+	//		IEEE80211_DEBUG(IEEE80211_DL_TS, "ADD:%pM, TID:%d, dir:%d\n", pRet->Addr, pRet->TSpec.TSInfo.ucTSID, pRet->TSpec.TSInfo.ucDirection);
 			if (memcmp(pRet->addr, Addr, 6) == 0)
-				if (pRet->t_spec.f.TSInfo.uc_tsid == TID)
-					if(pRet->t_spec.f.TSInfo.uc_direction == dir) {
+				if (pRet->t_spec.TSInfo.uc_tsid == TID)
+					if(pRet->t_spec.TSInfo.uc_direction == dir) {
 	//					printk("Bingo! got it\n");
 						break;
 					}
@@ -265,7 +265,7 @@ static struct ts_common_info *SearchAdmitTRStream(struct ieee80211_device *ieee,
 }
 
 static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr,
-			PTSPEC_BODY pTSPEC, PQOS_TCLAS pTCLAS, u8 TCLAS_Num,
+			struct tspec_body *pTSPEC, PQOS_TCLAS pTCLAS, u8 TCLAS_Num,
 			u8 TCLAS_Proc)
 {
 	u8	count;
@@ -276,7 +276,7 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr,
 	memcpy(pTsCommonInfo->addr, Addr, 6);
 
 	if(pTSPEC != NULL)
-		memcpy((u8 *)(&(pTsCommonInfo->t_spec)), (u8 *)pTSPEC, sizeof(TSPEC_BODY));
+		memcpy((u8 *)(&(pTsCommonInfo->t_spec)), (u8 *)pTSPEC, sizeof(struct tspec_body));
 
 	for(count = 0; count < TCLAS_Num; count++)
 		memcpy((u8 *)(&(pTsCommonInfo->t_class[count])), (u8 *)pTCLAS, sizeof(QOS_TCLAS));
@@ -354,8 +354,8 @@ bool GetTs(
 			// This is for EDCA and WMM to add a new TS.
 			// For HCCA or WMMSA, TS cannot be addmit without negotiation.
 			//
-			TSPEC_BODY	TSpec;
-			struct qos_tsinfo	*pTSInfo = &TSpec.f.TSInfo;
+			struct tspec_body	TSpec;
+			struct qos_tsinfo	*pTSInfo = &TSpec.TSInfo;
 			struct list_head	*pUnusedList =
 								(TxRxSelect == TX_DIR)?
 								(&ieee->Tx_TS_Unused_List):
-- 
2.18.0


  parent reply	other threads:[~2018-07-31 21:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-31 20:59 [PATCH 00/14] staging:rtl8192u: rtl819x_Qos.h style changes John Whitmore
2018-07-31 20:59 ` [PATCH 01/14] staging:rtl8192u: Clean cmpk_counttxstatistic() comments - Style John Whitmore
2018-07-31 20:59 ` [PATCH 02/14] staging:rtl8192u: Remove union from aci_aifsn " John Whitmore
2018-07-31 20:59 ` [PATCH 03/14] staging:rtl8192u: Remove union from qos_tsinfo " John Whitmore
2018-07-31 20:59 ` [PATCH 04/14] staging:rtl8192u: Rename members of struct " John Whitmore
2018-07-31 20:59 ` John Whitmore [this message]
2018-07-31 20:59 ` [PATCH 06/14] staging:rtl8192u: Rename TSInfo " John Whitmore
2018-07-31 20:59 ` [PATCH 07/14] staging:rtl8192u: Rename tspec_body members " John Whitmore
2018-07-31 20:59 ` [PATCH 08/14] staging:rtl8192u: Remove commented out code " John Whitmore
2018-07-31 21:00 ` [PATCH 09/14] staging:rtl8192u: Move QOS_TCLAS to rtl819x_TS.h " John Whitmore
2018-07-31 21:00 ` [PATCH 10/14] staging:rtl8192u: rename OCTET_STRING " John Whitmore
2018-07-31 21:00 ` [PATCH 11/14] staging:rtl8192u: Rename octet_string members " John Whitmore
2018-07-31 21:00 ` [PATCH 12/14] staging:rtl8192u: Remove unused UP2AC " John Whitmore
2018-07-31 21:00 ` [PATCH 13/14] staging:rtl8192u: Rename IsACValid and add parenthesis " John Whitmore
2018-07-31 21:00 ` [PATCH 14/14] staging:rtl8192u: Change clock comment " John Whitmore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180731210005.17452-6-johnfwhitmore@gmail.com \
    --to=johnfwhitmore@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox