[PATCH 06/11] staging: rtl8192e: Replace union tspec_body including embedded struct

From: Philipp Hortmann
Date: Mon Oct 23 2023 - 02:40:32 EST


Replace union tspec_body including embedded struct with embedded union as
it has only one element. This will increase readability of the code.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@xxxxxxxxx>
---
drivers/staging/rtl8192e/rtl819x_BAProc.c | 2 +-
drivers/staging/rtl8192e/rtl819x_Qos.h | 6 ------
drivers/staging/rtl8192e/rtl819x_TS.h | 2 +-
drivers/staging/rtl8192e/rtl819x_TSProc.c | 14 +++++++-------
4 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c
index 93b566482149..f01fb7131c7e 100644
--- a/drivers/staging/rtl8192e/rtl819x_BAProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c
@@ -474,7 +474,7 @@ void rtllib_ts_init_add_ba(struct rtllib_device *ieee, struct tx_ts_record *ts,
ba->dialog_token++;
ba->ba_param_set.field.amsdu_support = 0;
ba->ba_param_set.field.ba_policy = policy;
- ba->ba_param_set.field.tid = ts->TsCommonInfo.TSpec.f.ts_info.field.ucTSID;
+ ba->ba_param_set.field.tid = ts->TsCommonInfo.TSpec.field.ucTSID;
ba->ba_param_set.field.buffer_size = 32;
ba->ba_timeout_value = 0;
ba->ba_start_seq_ctrl.field.seq_num = (ts->TxCurSeq + 3) % 4096;
diff --git a/drivers/staging/rtl8192e/rtl819x_Qos.h b/drivers/staging/rtl8192e/rtl819x_Qos.h
index ac321952f7b3..73fdf6aaed67 100644
--- a/drivers/staging/rtl8192e/rtl819x_Qos.h
+++ b/drivers/staging/rtl8192e/rtl819x_Qos.h
@@ -14,12 +14,6 @@ union qos_tsinfo {
} field;
};

-union tspec_body {
- struct {
- union qos_tsinfo ts_info;
- } f;
-};
-
struct octet_string {
u8 *Octet;
u16 Length;
diff --git a/drivers/staging/rtl8192e/rtl819x_TS.h b/drivers/staging/rtl8192e/rtl819x_TS.h
index a9770592a8c9..ed77763bb1fc 100644
--- a/drivers/staging/rtl8192e/rtl819x_TS.h
+++ b/drivers/staging/rtl8192e/rtl819x_TS.h
@@ -20,7 +20,7 @@ enum tr_select {
struct ts_common_info {
struct list_head List;
u8 addr[ETH_ALEN];
- union tspec_body TSpec;
+ union qos_tsinfo TSpec;
union qos_tclas TClass[TCLAS_NUM];
u8 TClasProc;
u8 TClasNum;
diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c
index 879e169539c8..969418031f5f 100644
--- a/drivers/staging/rtl8192e/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c
@@ -94,7 +94,7 @@ static void TsAddBaProcess(struct timer_list *t)
static void ResetTsCommonInfo(struct ts_common_info *pTsCommonInfo)
{
eth_zero_addr(pTsCommonInfo->addr);
- memset(&pTsCommonInfo->TSpec, 0, sizeof(union tspec_body));
+ memset(&pTsCommonInfo->TSpec, 0, sizeof(union qos_tsinfo));
memset(&pTsCommonInfo->TClass, 0, sizeof(union qos_tclas) * TCLAS_NUM);
pTsCommonInfo->TClasProc = 0;
pTsCommonInfo->TClasNum = 0;
@@ -201,8 +201,8 @@ static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee,
continue;
list_for_each_entry(pRet, psearch_list, List) {
if (memcmp(pRet->addr, addr, 6) == 0 &&
- pRet->TSpec.f.ts_info.field.ucTSID == TID &&
- pRet->TSpec.f.ts_info.field.ucDirection == dir)
+ pRet->TSpec.field.ucTSID == TID &&
+ pRet->TSpec.field.ucDirection == dir)
break;
}
if (&pRet->List != psearch_list)
@@ -215,7 +215,7 @@ static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee,
}

static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *addr,
- union tspec_body *pTSPEC, union qos_tclas *pTCLAS,
+ union qos_tsinfo *pTSPEC, union qos_tclas *pTCLAS,
u8 TCLAS_Num, u8 TCLAS_Proc)
{
u8 count;
@@ -227,7 +227,7 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *addr,

if (pTSPEC)
memcpy((u8 *)(&(pTsCommonInfo->TSpec)), (u8 *)pTSPEC,
- sizeof(union tspec_body));
+ sizeof(union qos_tsinfo));

for (count = 0; count < TCLAS_Num; count++)
memcpy((u8 *)(&(pTsCommonInfo->TClass[count])),
@@ -241,8 +241,8 @@ bool rtllib_get_ts(struct rtllib_device *ieee, struct ts_common_info **ppTS,
u8 *addr, u8 TID, enum tr_select TxRxSelect, bool bAddNewTs)
{
u8 UP = 0;
- union tspec_body TSpec;
- union qos_tsinfo *ts_info = &TSpec.f.ts_info;
+ union qos_tsinfo TSpec;
+ union qos_tsinfo *ts_info = &TSpec;
struct list_head *pUnusedList;
struct list_head *pAddmitList;
enum direction_value Dir;
--
2.42.0