Skip to contentSkip to conversation

staging: r8188eu: clean up struct hal_data_r8188e

PATCH Superseded Michael Straube 2 participants 10 messages Dec 30, 2021 – Jan 1, 2022 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover staging: r8188eu: clean up struct hal_data_r8188e

This series removes unused and set but never used fields from the hal_data_r8188e structure.

Tested on x86_64 with Inter-Tech DMG-02.

Michael Straube (7):
staging: r8188eu: bRDGEnable is always false
staging: r8188eu: UsbRxHighSpeedMode is set but never used
staging: r8188eu: bTXPowerDataReadFromEEPORM is set but never used
staging: r8188eu: bAPKThermalMeterIgnore is set but never used
staging: r8188eu: remove unused fields from struct hal_data_8188e
staging: r8188eu: IntArray and C2hArray are set but never used
staging: r8188eu: FwRsvdPageStartOffset is set but never used

 drivers/staging/r8188eu/hal/rtl8188e_cmd.c    |  3 --
 .../staging/r8188eu/hal/rtl8188e_hal_init.c   |  8 +---
 drivers/staging/r8188eu/hal/usb_halinit.c     | 15 -------
 drivers/staging/r8188eu/hal/usb_ops_linux.c   | 10 -----
 .../staging/r8188eu/include/rtl8188e_hal.h    | 43 -------------------
 .../staging/r8188eu/include/rtl8188e_spec.h   |  7 ---
 6 files changed, 2 insertions(+), 84 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/7 staging: r8188eu: bRDGEnable is always false

The field bRDGEnable in struct hal_data_8188e is never set. It stays at its default value 0. Remove bRDGEnable and related dead code.

---
 drivers/staging/r8188eu/hal/usb_halinit.c      | 10 ----------
 drivers/staging/r8188eu/include/rtl8188e_hal.h |  3 ---
 2 files changed, 13 deletions(-)
drivers/staging/r8188eu/hal/usb_halinit.c +0 -10
index d5c7e8bf1f38..104705ef170e 100644
@@ -384,13 +384,6 @@ static void _InitEDCA(struct adapter *Adapter)
 	rtw_write32(Adapter, REG_EDCA_VO_PARAM, 0x002FA226);
 }
 
-static void _InitRDGSetting(struct adapter *Adapter)
-{
-	rtw_write8(Adapter, REG_RD_CTRL, 0xFF);
-	rtw_write16(Adapter, REG_RD_NAV_NXT, 0x200);
-	rtw_write8(Adapter, REG_RD_RESP_PKT_TH, 0x05);
-}
-
 static void _InitRetryFunction(struct adapter *Adapter)
 {
 	u8 value8;
@@ -712,9 +705,6 @@ u32 rtl8188eu_hal_init(struct adapter *Adapter)
 	value16 |= (MACTXEN | MACRXEN);
 	rtw_write8(Adapter, REG_CR, value16);
 
-	if (haldata->bRDGEnable)
-		_InitRDGSetting(Adapter);
-
 	/* Enable TX Report */
 	/* Enable Tx Report Timer */
 	value8 = rtw_read8(Adapter, REG_TX_RPT_CTRL);
drivers/staging/r8188eu/include/rtl8188e_hal.h +0 -3
index b42af86555cd..e8cb093abb62 100644
@@ -236,9 +236,6 @@ struct hal_data_8188e {
 
 	u32	RfRegChnlVal[2];
 
-	/* RDG enable */
-	bool	 bRDGEnable;
-
 	/* for host message to fw */
 	u8	LastHMEBoxNum;
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/7 staging: r8188eu: UsbRxHighSpeedMode is set but never used

In reply to Michael Straube

The field UsbRxHighSpeedMode of struct hal_data_8188e is set but never used. Remove it.

---
 drivers/staging/r8188eu/hal/usb_halinit.c      | 5 -----
 drivers/staging/r8188eu/include/rtl8188e_hal.h | 3 ---
 2 files changed, 8 deletions(-)
drivers/staging/r8188eu/hal/usb_halinit.c +0 -5
index 104705ef170e..96db9a8e7667 100644
@@ -502,16 +502,11 @@ usb_AggSettingRxUpdate(
 
 static void InitUsbAggregationSetting(struct adapter *Adapter)
 {
-	struct hal_data_8188e *haldata = &Adapter->haldata;
-
 	/*  Tx aggregation setting */
 	usb_AggSettingTxUpdate(Adapter);
 
 	/*  Rx aggregation setting */
 	usb_AggSettingRxUpdate(Adapter);
-
-	/*  201/12/10 MH Add for USB agg mode dynamic switch. */
-	haldata->UsbRxHighSpeedMode = false;
 }
 
 static void _InitOperationMode(struct adapter *Adapter)
drivers/staging/r8188eu/include/rtl8188e_hal.h +0 -3
index e8cb093abb62..8b54f52f49e2 100644
@@ -262,9 +262,6 @@ struct hal_data_8188e {
 	u8	OutEpQueueSel;
 	u8	OutEpNumber;
 
-	/*  Add for USB aggreation mode dynamic shceme. */
-	bool		UsbRxHighSpeedMode;
-
 	/*  2010/11/22 MH Add for slim combo debug mode selective. */
 	/*  This is used for fix the drawback of CU TSMC-A/UMC-A cut.
 	 * HW auto suspend ability. Close BT clock. */
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/7 staging: r8188eu: bTXPowerDataReadFromEEPORM is set but never used

In reply to Michael Straube

The field bTXPowerDataReadFromEEPORM of struct hal_data_8188e is set but never used. Remove it.

---
 drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 3 ---
 drivers/staging/r8188eu/include/rtl8188e_hal.h  | 1 -
 2 files changed, 4 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +0 -3
index d8d6547465a7..065c2701077d 100644
@@ -1127,9 +1127,6 @@ void Hal_ReadTxPowerInfo88E(struct adapter *padapter, u8 *PROMContent, bool Auto
 
 	Hal_ReadPowerValueFromPROM_8188E(&pwrInfo24G, PROMContent, AutoLoadFail);
 
-	if (!AutoLoadFail)
-		pHalData->bTXPowerDataReadFromEEPORM = true;
-
 	for (ch = 0; ch < CHANNEL_MAX_NUMBER; ch++) {
 		hal_get_chnl_group_88e(ch, &group);
 
drivers/staging/r8188eu/include/rtl8188e_hal.h +0 -1
index 8b54f52f49e2..de58c85b8bdc 100644
@@ -180,7 +180,6 @@ struct hal_data_8188e {
 	u16	EEPROMSDID;
 	u8	EEPROMRegulatory;
 
-	u8	bTXPowerDataReadFromEEPORM;
 	u8	EEPROMThermalMeter;
 	u8	bAPKThermalMeterIgnore;
 
Signature · 1 line
2.34.1
#4 lore raw

PATCH 4/7 staging: r8188eu: bAPKThermalMeterIgnore is set but never used

In reply to Michael Straube

The field bAPKThermalMeterIgnore of struct hal_data_8188e is set but never used. Remove it.

---
 drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 5 ++---
 drivers/staging/r8188eu/include/rtl8188e_hal.h  | 1 -
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +2 -3
index 065c2701077d..cce291ca44b1 100644
@@ -1230,9 +1230,8 @@ void Hal_ReadThermalMeter_88E(struct adapter *Adapter, u8 *PROMContent, bool Aut
 	else
 		pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E;
 
-	if (pHalData->EEPROMThermalMeter == 0xff || AutoloadFail) {
-		pHalData->bAPKThermalMeterIgnore = true;
+	if (pHalData->EEPROMThermalMeter == 0xff || AutoloadFail)
 		pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_88E;
-	}
+
 	DBG_88E("ThermalMeter = 0x%x\n", pHalData->EEPROMThermalMeter);
 }
drivers/staging/r8188eu/include/rtl8188e_hal.h +0 -1
index de58c85b8bdc..40b3db34b8f2 100644
@@ -181,7 +181,6 @@ struct hal_data_8188e {
 	u8	EEPROMRegulatory;
 
 	u8	EEPROMThermalMeter;
-	u8	bAPKThermalMeterIgnore;
 
 	bool	EepromOrEfuse;
 
Signature · 1 line
2.34.1
#5 lore raw

PATCH 5/7 staging: r8188eu: remove unused fields from struct hal_data_8188e

In reply to Michael Straube

Remove unused fields from struct hal_data_8188e.

---
 .../staging/r8188eu/include/rtl8188e_hal.h    | 30 -------------------
 1 file changed, 30 deletions(-)
drivers/staging/r8188eu/include/rtl8188e_hal.h +0 -30
index 40b3db34b8f2..2ce42d647a34 100644
@@ -175,15 +175,9 @@ struct hal_data_8188e {
 
 	u16	BasicRateSet;
 
-	/*  EEPROM setting. */
-	u16	EEPROMSVID;
-	u16	EEPROMSDID;
 	u8	EEPROMRegulatory;
-
 	u8	EEPROMThermalMeter;
 
-	bool	EepromOrEfuse;
-
 	u8	Index24G_CCK_Base[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
 	u8	Index24G_BW40_Base[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
 	/* If only one tx, only BW20 and OFDM are used. */
@@ -192,11 +186,6 @@ struct hal_data_8188e {
 	s8	BW20_24G_Diff[RF_PATH_MAX][MAX_TX_COUNT];
 	s8	BW40_24G_Diff[RF_PATH_MAX][MAX_TX_COUNT];
 
-	u8	TxPwrLevelCck[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
-	/*  For HT 40MHZ pwr */
-	u8	TxPwrLevelHT40_1S[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
-	/*  For HT 40MHZ pwr */
-	u8	TxPwrLevelHT40_2S[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
 	/*  HT 20<->40 Pwr diff */
 	u8	TxPwrHt20Diff[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
 	/*  For HT<->legacy pwr diff */
@@ -205,7 +194,6 @@ struct hal_data_8188e {
 	u8	PwrGroupHT20[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
 	u8	PwrGroupHT40[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
 
-	u8	LegacyHTTxPowerDiff;/*  Legacy to HT rate power diff */
 	/*  The current Tx Power Level */
 	u8	CurrentCckTxPwrIdx;
 	u8	CurrentOfdm24GTxPwrIdx;
@@ -213,21 +201,12 @@ struct hal_data_8188e {
 	u8	CurrentBW4024GTxPwrIdx;
 
 	/*  Read/write are allow for following hardware information variables */
-	u8	framesync;
-	u32	framesyncC34;
-	u8	framesyncMonitor;
-	u8	DefaultInitialGain[4];
 	u8	pwrGroupCnt;
 	u32	MCSTxPowerLevelOriginalOffset[MAX_PG_GROUP][16];
-	u32	CCKTxPowerLevelOriginalOffset;
 
 	u8	CrystalCap;
-	u32	AntennaTxPath;			/*  Antenna path Tx */
-	u32	AntennaRxPath;			/*  Antenna path Rx */
 	u8	ExternalPA;
 
-	u8	b1x1RecvCombine;	/*  for 1T1R receive combining */
-
 	u32	AcParam_BE; /* Original parameter for BE, use for EDCA turbo. */
 
 	struct bb_reg_def PHYRegDef[2];	/* Radio A/B */
@@ -254,17 +233,9 @@ struct hal_data_8188e {
 	u8	FwRsvdPageStartOffset; /* Reserve page start offset except
 					*  beacon in TxQ. */
 
-	/*  2010/08/09 MH Add CU power down mode. */
-	bool		pwrdown;
-
 	u8	OutEpQueueSel;
 	u8	OutEpNumber;
 
-	/*  2010/11/22 MH Add for slim combo debug mode selective. */
-	/*  This is used for fix the drawback of CU TSMC-A/UMC-A cut.
-	 * HW auto suspend ability. Close BT clock. */
-	bool		SlimComboDbg;
-
 	u16	EfuseUsedBytes;
 
 	struct P2P_PS_Offload_t	p2p_ps_offload;
@@ -280,7 +251,6 @@ struct hal_data_8188e {
 	u8	C2hArray[16];
 	u8	UsbTxAggMode;
 	u8	UsbTxAggDescNum;
-	u32	MaxUsbRxAggBlock;
 
 	enum usb_rx_agg_mode UsbRxAggMode;
 	u8	UsbRxAggBlockCount;	/*  USB Block count. Block size is
Signature · 1 line
2.34.1
#6 lore raw

PATCH 6/7 staging: r8188eu: IntArray and C2hArray are set but never used

In reply to Michael Straube

The fields IntArray and C2hArray of struct hal_data_8188e are set but never used. Remove them.

While at it, remove the unsed defines USB_INTR_CONTENT_CPWM1_OFFSET and USB_INTR_CONTENT_CPWM2_OFFSET as well.

---
 drivers/staging/r8188eu/hal/usb_ops_linux.c     | 10 ----------
 drivers/staging/r8188eu/include/rtl8188e_hal.h  |  3 ---
 drivers/staging/r8188eu/include/rtl8188e_spec.h |  7 -------
 3 files changed, 20 deletions(-)
drivers/staging/r8188eu/hal/usb_ops_linux.c +0 -10
index 9ec55a77dccd..85bcde5ee79a 100644
@@ -185,20 +185,10 @@ int rtw_writeN(struct adapter *adapter, u32 addr, u32 length, u8 *data)
 
 static void interrupt_handler_8188eu(struct adapter *adapt, u16 pkt_len, u8 *pbuf)
 {
-	struct hal_data_8188e *haldata = &adapt->haldata;
-
 	if (pkt_len != INTERRUPT_MSG_FORMAT_LEN) {
 		DBG_88E("%s Invalid interrupt content length (%d)!\n", __func__, pkt_len);
 		return;
 	}
-
-	/*  HISR */
-	memcpy(&haldata->IntArray[0], &pbuf[USB_INTR_CONTENT_HISR_OFFSET], 4);
-	memcpy(&haldata->IntArray[1], &pbuf[USB_INTR_CONTENT_HISRE_OFFSET], 4);
-
-	/*  C2H Event */
-	if (pbuf[0] != 0)
-		memcpy(&haldata->C2hArray[0], &pbuf[USB_INTR_CONTENT_C2H_OFFSET], 16);
 }
 
 static int recvbuf2recvframe(struct adapter *adapt, struct sk_buff *pskb)
drivers/staging/r8188eu/include/rtl8188e_hal.h +0 -3
index 2ce42d647a34..239d0db55639 100644
@@ -246,9 +246,6 @@ struct hal_data_8188e {
 
 	u32	UsbBulkOutSize;
 
-	/*  Interrupt relatd register information. */
-	u32	IntArray[3];/* HISR0,HISR1,HSISR */
-	u8	C2hArray[16];
 	u8	UsbTxAggMode;
 	u8	UsbTxAggDescNum;
 
drivers/staging/r8188eu/include/rtl8188e_spec.h +0 -7
index e59fd2fe82c5..009222b4a95d 100644
@@ -475,13 +475,6 @@ Default: 00b.
 #define	MSR_INFRA			0x02
 #define	MSR_AP				0x03
 
-/*   88EU (MSR) Media Status Register	(Offset 0x4C, 8 bits) */
-#define	USB_INTR_CONTENT_C2H_OFFSET	0
-#define	USB_INTR_CONTENT_CPWM1_OFFSET	16
-#define	USB_INTR_CONTENT_CPWM2_OFFSET	20
-#define	USB_INTR_CONTENT_HISR_OFFSET	48
-#define	USB_INTR_CONTENT_HISRE_OFFSET	52
-
 /*  88E Driver Initialization Offload REG_FDHM0(Offset 0x88, 8 bits) */
 /* IOL config for REG_FDHM0(Reg0x88) */
 #define CMD_INIT_LLT			BIT(0)
Signature · 1 line
2.34.1
#9 lore raw

PATCH 7/7 staging: r8188eu: FwRsvdPageStartOffset is set but never used

In reply to Michael Straube

The field FwRsvdPageStartOffset of struct hal_data_8188e is set but never used. Remove it.

---
 drivers/staging/r8188eu/hal/rtl8188e_cmd.c     | 3 ---
 drivers/staging/r8188eu/include/rtl8188e_hal.h | 2 --
 2 files changed, 5 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_cmd.c +0 -3
index ca24e17c369d..a491c37777df 100644
@@ -440,7 +440,6 @@ void CheckFwRsvdPageContent(struct adapter *Adapter)
 /*  2009.10.15 by tynli. */
 static void SetFwRsvdPagePkt(struct adapter *adapt, bool bDLFinished)
 {
-	struct hal_data_8188e *haldata;
 	struct xmit_frame	*pmgntframe;
 	struct pkt_attrib	*pattrib;
 	struct xmit_priv *pxmitpriv;
@@ -461,7 +460,6 @@ static void SetFwRsvdPagePkt(struct adapter *adapt, bool bDLFinished)
 		return;
 	}
 
-	haldata = &adapt->haldata;
 	pxmitpriv = &adapt->xmitpriv;
 	pmlmeext = &adapt->mlmeextpriv;
 	pmlmeinfo = &pmlmeext->mlmext_info;
@@ -480,7 +478,6 @@ static void SetFwRsvdPagePkt(struct adapter *adapt, bool bDLFinished)
 	if (PageNeed == 1)
 		PageNeed += 1;
 	PageNum += PageNeed;
-	haldata->FwRsvdPageStartOffset = PageNum;
 
 	BufIndex += PageNeed * 128;
 
drivers/staging/r8188eu/include/rtl8188e_hal.h +0 -2
index 239d0db55639..25f3c04e81b7 100644
@@ -230,8 +230,6 @@ struct hal_data_8188e {
 
 	u8	bDumpRxPkt;/* for debug */
 	u8	bDumpTxPkt;/* for debug */
-	u8	FwRsvdPageStartOffset; /* Reserve page start offset except
-					*  beacon in TxQ. */
 
 	u8	OutEpQueueSel;
 	u8	OutEpNumber;
Signature · 1 line
2.34.1
#7 lore raw

Re: [PATCH 6/7] staging: r8188eu: IntArray and C2hArray are set but never used

In reply to Michael Straube
Quoted 8 lines · Michael Straube

The fields IntArray and C2hArray of struct hal_data_8188e are set but never used. Remove them.

While at it, remove the unsed defines USB_INTR_CONTENT_CPWM1_OFFSET and USB_INTR_CONTENT_CPWM2_OFFSET as well.

---

Hi Michael,

thanks for your clean ups!

Quoted 19 lines
  drivers/staging/r8188eu/hal/usb_ops_linux.c     | 10 ----------
  drivers/staging/r8188eu/include/rtl8188e_hal.h  |  3 ---
  drivers/staging/r8188eu/include/rtl8188e_spec.h |  7 -------
  3 files changed, 20 deletions(-)
drivers/staging/r8188eu/hal/usb_ops_linux.c +0 -2
index 9ec55a77dccd..85bcde5ee79a 100644
@@ -185,20 +185,10 @@ int rtw_writeN(struct adapter *adapter, u32 addr, u32 length, u8 *data)
 
  static void interrupt_handler_8188eu(struct adapter *adapt, u16 pkt_len, u8 *pbuf)
  {
-	struct hal_data_8188e *haldata = &adapt->haldata;
-
  	if (pkt_len != INTERRUPT_MSG_FORMAT_LEN) {
  		DBG_88E("%s Invalid interrupt content length (%d)!\n", __func__, pkt_len);
  		return;
  	}

drivers/staging/r8188eu/hal/usb_ops_linux.c int rtw_writeN(struct adapter *adapter, u32 addr, u32 length, u8 *data) · line 193

Quoted 10 lines
drivers/staging/r8188eu/hal/usb_ops_linux.c +0 -8
-
-	/*  HISR */
-	memcpy(&haldata->IntArray[0], &pbuf[USB_INTR_CONTENT_HISR_OFFSET], 4);
-	memcpy(&haldata->IntArray[1], &pbuf[USB_INTR_CONTENT_HISRE_OFFSET], 4);
-
-	/*  C2H Event */
-	if (pbuf[0] != 0)
-		memcpy(&haldata->C2hArray[0], &pbuf[USB_INTR_CONTENT_C2H_OFFSET], 16);
  }
 

This function can be removed totally then, since it does nothing. Not sure if function removal fits this patch, but why not :)

With regards,
Pavel Skripkin

#8 lore raw

Re: [PATCH 6/7] staging: r8188eu: IntArray and C2hArray are set but never used

Quoted 39 lines · Pavel Skripkin
Quoted 8 lines · Michael Straube

The fields IntArray and C2hArray of struct hal_data_8188e are set but never used. Remove them.

While at it, remove the unsed defines USB_INTR_CONTENT_CPWM1_OFFSET and USB_INTR_CONTENT_CPWM2_OFFSET as well.

---

Hi Michael,

thanks for your clean ups!

Quoted 25 lines

  drivers/staging/r8188eu/hal/usb_ops_linux.c     | 10 ---------- drivers/staging/r8188eu/include/rtl8188e_hal.h  |  3 --- drivers/staging/r8188eu/include/rtl8188e_spec.h |  7 -------

  3 files changed, 20 deletions(-)
drivers/staging/r8188eu/hal/usb_ops_linux.c +0 -6
index 9ec55a77dccd..85bcde5ee79a 100644
@@ -185,20 +185,10 @@ int rtw_writeN(struct adapter *adapter, u32 
 addr, u32 length, u8 *data)
   static void interrupt_handler_8188eu(struct adapter *adapt, u16 pkt_len, u8 *pbuf)
   {
-    struct hal_data_8188e *haldata = &adapt->haldata;
-
       if (pkt_len != INTERRUPT_MSG_FORMAT_LEN) {
           DBG_88E("%s Invalid interrupt content length (%d)!\n", __func__, pkt_len);
           return;
       }
-
-    /*  HISR */
-    memcpy(&haldata->IntArray[0], 
 &pbuf[USB_INTR_CONTENT_HISR_OFFSET], 4);
-    memcpy(&haldata->IntArray[1], 
 &pbuf[USB_INTR_CONTENT_HISRE_OFFSET], 4);
Quoted 9 lines
Quoted 6 lines
drivers/staging/r8188eu/hal/usb_ops_linux.c +0 -4
-
-    /*  C2H Event */
-    if (pbuf[0] != 0)
-        memcpy(&haldata->C2hArray[0], 
 &pbuf[USB_INTR_CONTENT_C2H_OFFSET], 16);

  }

This function can be removed totally then, since it does nothing. Not sure if function removal fits this patch, but why not :)

Hi Pavel,

I've sent v2 that removes the function.

Happy new year! :)
Michael