2021-10-17 04:18:06

by Michael Straube

[permalink] [raw]
Subject: [PATCH 0/7] staging: r8188eu: odm cleanups

This series removes:
- empty / unused functions from odm.c
- two never set / unused fields from odm_dm_struct
- the function ODM_CmnInfoPtrArrayHook()

Tested on x86_64 with Inter-Tech DMG-02.

Michael Straube (7):
staging: r8188eu: remove empty functions from odm.c
staging: r8188eu: remove ODM_SingleDualAntennaDefaultSetting()
staging: r8188eu: remove GetPSDData()
staging: r8188eu: remove ODM_AntselStatistics_88C()
staging: r8188eu: pBandType is never set
staging: r8188eu: pMacPhyMode is not used
staging: r8188eu: remove ODM_CmnInfoPtrArrayHook()

drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 +-
drivers/staging/r8188eu/hal/odm.c | 144 ------------------
drivers/staging/r8188eu/hal/odm_HWConfig.c | 7 +-
drivers/staging/r8188eu/hal/odm_interface.c | 5 -
drivers/staging/r8188eu/hal/rtl8188e_dm.c | 2 +-
.../staging/r8188eu/hal/rtl8188e_hal_init.c | 5 +-
drivers/staging/r8188eu/include/odm.h | 38 -----
.../staging/r8188eu/include/odm_interface.h | 2 -
drivers/staging/r8188eu/include/odm_precomp.h | 2 -
9 files changed, 6 insertions(+), 201 deletions(-)

--
2.33.0


2021-10-17 04:37:19

by Michael Straube

[permalink] [raw]
Subject: [PATCH 2/7] staging: r8188eu: remove ODM_SingleDualAntennaDefaultSetting()

Function ODM_SingleDualAntennaDefaultSetting() is not used,
remove it.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/hal/odm.c | 11 -----------
drivers/staging/r8188eu/include/odm.h | 2 --
2 files changed, 13 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
index 627213392795..030bc7bd9905 100644
--- a/drivers/staging/r8188eu/hal/odm.c
+++ b/drivers/staging/r8188eu/hal/odm.c
@@ -1190,14 +1190,3 @@ u32 ConvertTo_dB(u32 Value)

return dB;
}
-
-/* Description: */
-/* Set Single/Dual Antenna default setting for products that do not do detection in advance. */
-/* Added by Joseph, 2012.03.22 */
-void ODM_SingleDualAntennaDefaultSetting(struct odm_dm_struct *pDM_Odm)
-{
- struct sw_ant_switch *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
-
- pDM_SWAT_Table->ANTA_ON = true;
- pDM_SWAT_Table->ANTB_ON = true;
-}
diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
index 435626f05fd2..21e08a9f8bf8 100644
--- a/drivers/staging/r8188eu/include/odm.h
+++ b/drivers/staging/r8188eu/include/odm.h
@@ -907,6 +907,4 @@ void ODM_CmnInfoUpdate(struct odm_dm_struct *pDM_Odm, u32 CmnInfo, u64 Value);
void ODM_AntselStatistics_88C(struct odm_dm_struct *pDM_Odm, u8 MacId,
u32 PWDBAll, bool isCCKrate);

-void ODM_SingleDualAntennaDefaultSetting(struct odm_dm_struct *pDM_Odm);
-
#endif
--
2.33.0

2021-10-17 04:37:19

by Michael Straube

[permalink] [raw]
Subject: [PATCH 1/7] staging: r8188eu: remove empty functions from odm.c

Remove empty functions from odm.c.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/hal/odm.c | 32 -------------------
drivers/staging/r8188eu/hal/odm_HWConfig.c | 7 +---
drivers/staging/r8188eu/include/odm.h | 7 ----
drivers/staging/r8188eu/include/odm_precomp.h | 2 --
4 files changed, 1 insertion(+), 47 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
index 2178ffe41bb3..627213392795 100644
--- a/drivers/staging/r8188eu/hal/odm.c
+++ b/drivers/staging/r8188eu/hal/odm.c
@@ -196,13 +196,9 @@ void ODM_DMWatchdog(struct odm_dm_struct *pDM_Odm)
(pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) ||
(pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV))
odm_HwAntDiv(pDM_Odm);
- else if (pDM_Odm->AntDivType == CGCS_RX_SW_ANTDIV)
- odm_SwAntDivChkAntSwitch(pDM_Odm, SWAW_STEP_PEAK);

ODM_TXPowerTrackingCheck(pDM_Odm);
odm_EdcaTurboCheck(pDM_Odm);
-
- odm_dtc(pDM_Odm);
}

/* Init /.. Fixed HW value. Only init time. */
@@ -1023,29 +1019,6 @@ void ODM_TXPowerTrackingCheck(struct odm_dm_struct *pDM_Odm)
/* We select left antenna as default antenna in initial process, modify it as needed */
/* */

-/* 3============================================================ */
-/* 3 SW Antenna Diversity */
-/* 3============================================================ */
-void ODM_SwAntDivChkPerPktRssi(struct odm_dm_struct *pDM_Odm, u8 StationID, struct odm_phy_status_info *pPhyInfo)
-{
-}
-
-void odm_SwAntDivChkAntSwitch(struct odm_dm_struct *pDM_Odm, u8 Step)
-{
-}
-
-void ODM_SwAntDivRestAfterLink(struct odm_dm_struct *pDM_Odm)
-{
-}
-
-void odm_SwAntDivChkAntSwitchCallback(struct timer_list *t)
-{
-}
-
-/* 3============================================================ */
-/* 3 SW Antenna Diversity */
-/* 3============================================================ */
-
void odm_InitHybridAntDiv(struct odm_dm_struct *pDM_Odm)
{
if (!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))
@@ -1228,8 +1201,3 @@ void ODM_SingleDualAntennaDefaultSetting(struct odm_dm_struct *pDM_Odm)
pDM_SWAT_Table->ANTA_ON = true;
pDM_SWAT_Table->ANTB_ON = true;
}
-
-/* Justin: According to the current RRSI to adjust Response Frame TX power, 2012/11/05 */
-void odm_dtc(struct odm_dm_struct *pDM_Odm)
-{
-}
diff --git a/drivers/staging/r8188eu/hal/odm_HWConfig.c b/drivers/staging/r8188eu/hal/odm_HWConfig.c
index b76aa93573dc..3d639b2720b2 100644
--- a/drivers/staging/r8188eu/hal/odm_HWConfig.c
+++ b/drivers/staging/r8188eu/hal/odm_HWConfig.c
@@ -376,13 +376,8 @@ static void ODM_PhyStatusQuery_92CSeries(struct odm_dm_struct *dm_odm,
{
odm_RxPhyStatus92CSeries_Parsing(dm_odm, pPhyInfo, pPhyStatus,
pPktinfo, adapt);
- if (dm_odm->RSSI_test) {
- /* Select the packets to do RSSI checking for antenna switching. */
- if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon)
- ODM_SwAntDivChkPerPktRssi(dm_odm, pPktinfo->StationID, pPhyInfo);
- } else {
+ if (!dm_odm->RSSI_test)
odm_Process_RSSIForDM(dm_odm, pPhyInfo, pPktinfo);
- }
}

void ODM_PhyStatusQuery(struct odm_dm_struct *dm_odm,
diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
index 187f872d09b5..435626f05fd2 100644
--- a/drivers/staging/r8188eu/include/odm.h
+++ b/drivers/staging/r8188eu/include/odm.h
@@ -875,16 +875,11 @@ void ODM_SetAntenna(struct odm_dm_struct *pDM_Odm, u8 Antenna);

void ODM_RF_Saving(struct odm_dm_struct *pDM_Odm, u8 bForceInNormal);

-void ODM_SwAntDivRestAfterLink(struct odm_dm_struct *pDM_Odm);
-
void ODM_TXPowerTrackingCheck(struct odm_dm_struct *pDM_Odm);

bool ODM_RAStateCheck(struct odm_dm_struct *pDM_Odm, s32 RSSI,
bool bForceUpdate, u8 *pRATRState);

-void ODM_SwAntDivChkPerPktRssi(struct odm_dm_struct *pDM_Odm, u8 StationID,
- struct odm_phy_status_info *pPhyInfo);
-
u32 ConvertTo_dB(u32 Value);

u32 GetPSDData(struct odm_dm_struct *pDM_Odm, unsigned int point,
@@ -914,6 +909,4 @@ void ODM_AntselStatistics_88C(struct odm_dm_struct *pDM_Odm, u8 MacId,

void ODM_SingleDualAntennaDefaultSetting(struct odm_dm_struct *pDM_Odm);

-void odm_dtc(struct odm_dm_struct *pDM_Odm);
-
#endif
diff --git a/drivers/staging/r8188eu/include/odm_precomp.h b/drivers/staging/r8188eu/include/odm_precomp.h
index 892a2501f05a..22299f167af8 100644
--- a/drivers/staging/r8188eu/include/odm_precomp.h
+++ b/drivers/staging/r8188eu/include/odm_precomp.h
@@ -43,13 +43,11 @@ void odm_CommonInfoSelfUpdate(struct odm_dm_struct *pDM_Odm);
void odm_FalseAlarmCounterStatistics(struct odm_dm_struct *pDM_Odm);
void odm_DIG(struct odm_dm_struct *pDM_Odm);
void odm_CCKPacketDetectionThresh(struct odm_dm_struct *pDM_Odm);
-void odm_SwAntDivChkAntSwitch(struct odm_dm_struct *pDM_Odm, u8 Step);
void odm_EdcaTurboCheck(struct odm_dm_struct *pDM_Odm);
void odm_CommonInfoSelfInit(struct odm_dm_struct *pDM_Odm);
void odm_RSSIMonitorCheck(struct odm_dm_struct *pDM_Odm);
void odm_RefreshRateAdaptiveMask(struct odm_dm_struct *pDM_Odm);
void odm_TXPowerTrackingThermalMeterInit(struct odm_dm_struct *pDM_Odm);
-void odm_SwAntDivChkAntSwitchCallback(struct timer_list *t);
void odm_InitHybridAntDiv(struct odm_dm_struct *pDM_Odm);
void odm_HwAntDiv(struct odm_dm_struct *pDM_Odm);

--
2.33.0

2021-10-17 04:37:19

by Michael Straube

[permalink] [raw]
Subject: [PATCH 3/7] staging: r8188eu: remove GetPSDData()

Function GetPSDData() is not used, remove it. It is the only user of
ConvertTo_dB() and ODM_StallExecution(), remove these two functions
and the now unused dB_Invert_Table as well.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/hal/odm.c | 59 -------------------
drivers/staging/r8188eu/hal/odm_interface.c | 5 --
drivers/staging/r8188eu/include/odm.h | 5 --
.../staging/r8188eu/include/odm_interface.h | 2 -
4 files changed, 71 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
index 030bc7bd9905..28bd6f36cddd 100644
--- a/drivers/staging/r8188eu/hal/odm.c
+++ b/drivers/staging/r8188eu/hal/odm.c
@@ -5,17 +5,6 @@

#include "../include/odm_precomp.h"

-static const u16 dB_Invert_Table[8][12] = {
- {1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4},
- {4, 5, 6, 6, 7, 8, 9, 10, 11, 13, 14, 16},
- {18, 20, 22, 25, 28, 32, 35, 40, 45, 50, 56, 63},
- {71, 79, 89, 100, 112, 126, 141, 158, 178, 200, 224, 251},
- {282, 316, 355, 398, 447, 501, 562, 631, 708, 794, 891, 1000},
- {1122, 1259, 1413, 1585, 1778, 1995, 2239, 2512, 2818, 3162, 3548, 3981},
- {4467, 5012, 5623, 6310, 7079, 7943, 8913, 10000, 11220, 12589, 14125, 15849},
- {17783, 19953, 22387, 25119, 28184, 31623, 35481, 39811, 44668, 50119, 56234, 65535}
-};
-
/* avoid to warn in FreeBSD ==> To DO modify */
static u32 EDCAParam[HT_IOT_PEER_MAX][3] = {
/* UL DL */
@@ -1142,51 +1131,3 @@ void odm_EdcaTurboCheck(struct odm_dm_struct *pDM_Odm)
pxmitpriv->last_tx_bytes = pxmitpriv->tx_bytes;
precvpriv->last_rx_bytes = precvpriv->rx_bytes;
}
-
-/* need to ODM CE Platform */
-/* move to here for ANT detection mechanism using */
-
-u32 GetPSDData(struct odm_dm_struct *pDM_Odm, unsigned int point, u8 initial_gain_psd)
-{
- u32 psd_report;
-
- /* Set DCO frequency index, offset=(40MHz/SamplePts)*point */
- ODM_SetBBReg(pDM_Odm, 0x808, 0x3FF, point);
-
- /* Start PSD calculation, Reg808[22]=0->1 */
- ODM_SetBBReg(pDM_Odm, 0x808, BIT(22), 1);
- /* Need to wait for HW PSD report */
- ODM_StallExecution(30);
- ODM_SetBBReg(pDM_Odm, 0x808, BIT(22), 0);
- /* Read PSD report, Reg8B4[15:0] */
- psd_report = ODM_GetBBReg(pDM_Odm, 0x8B4, bMaskDWord) & 0x0000FFFF;
-
- psd_report = (u32)(ConvertTo_dB(psd_report)) + (u32)(initial_gain_psd - 0x1c);
-
- return psd_report;
-}
-
-u32 ConvertTo_dB(u32 Value)
-{
- u8 i;
- u8 j;
- u32 dB;
-
- Value = Value & 0xFFFF;
- for (i = 0; i < 8; i++) {
- if (Value <= dB_Invert_Table[i][11])
- break;
- }
-
- if (i >= 8)
- return 96; /* maximum 96 dB */
-
- for (j = 0; j < 12; j++) {
- if (Value <= dB_Invert_Table[i][j])
- break;
- }
-
- dB = i * 12 + j + 1;
-
- return dB;
-}
diff --git a/drivers/staging/r8188eu/hal/odm_interface.c b/drivers/staging/r8188eu/hal/odm_interface.c
index c97104c3682f..7ddba39a0f4b 100644
--- a/drivers/staging/r8188eu/hal/odm_interface.c
+++ b/drivers/staging/r8188eu/hal/odm_interface.c
@@ -77,11 +77,6 @@ s32 ODM_CompareMemory(struct odm_dm_struct *pDM_Odm, void *pBuf1, void *pBuf2, u
}

/* ODM Timer relative API. */
-void ODM_StallExecution(u32 usDelay)
-{
- udelay(usDelay);
-}
-
void ODM_delay_ms(u32 ms)
{
mdelay(ms);
diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
index 21e08a9f8bf8..db24678eb0bc 100644
--- a/drivers/staging/r8188eu/include/odm.h
+++ b/drivers/staging/r8188eu/include/odm.h
@@ -880,11 +880,6 @@ void ODM_TXPowerTrackingCheck(struct odm_dm_struct *pDM_Odm);
bool ODM_RAStateCheck(struct odm_dm_struct *pDM_Odm, s32 RSSI,
bool bForceUpdate, u8 *pRATRState);

-u32 ConvertTo_dB(u32 Value);
-
-u32 GetPSDData(struct odm_dm_struct *pDM_Odm, unsigned int point,
- u8 initial_gain_psd);
-
u32 ODM_Get_Rate_Bitmap(struct odm_dm_struct *pDM_Odm, u32 macid,
u32 ra_mask, u8 rssi_level);

diff --git a/drivers/staging/r8188eu/include/odm_interface.h b/drivers/staging/r8188eu/include/odm_interface.h
index 3af58e853828..17a315d19a50 100644
--- a/drivers/staging/r8188eu/include/odm_interface.h
+++ b/drivers/staging/r8188eu/include/odm_interface.h
@@ -50,8 +50,6 @@ s32 ODM_CompareMemory(struct odm_dm_struct *pDM_Odm, void *pBuf1, void *pBuf2,
u32 length);

/* ODM Timer relative API. */
-void ODM_StallExecution(u32 usDelay);
-
void ODM_delay_ms(u32 ms);

void ODM_delay_us(u32 us);
--
2.33.0

2021-10-17 05:10:45

by Michael Straube

[permalink] [raw]
Subject: [PATCH 4/7] staging: r8188eu: remove ODM_AntselStatistics_88C()

Function ODM_AntselStatistics_88C() is not used, remove it.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/hal/odm.c | 21 ---------------------
drivers/staging/r8188eu/include/odm.h | 3 ---
2 files changed, 24 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
index 28bd6f36cddd..d3d13164ca8f 100644
--- a/drivers/staging/r8188eu/hal/odm.c
+++ b/drivers/staging/r8188eu/hal/odm.c
@@ -1016,27 +1016,6 @@ void odm_InitHybridAntDiv(struct odm_dm_struct *pDM_Odm)
ODM_AntennaDiversityInit_88E(pDM_Odm);
}

-void ODM_AntselStatistics_88C(struct odm_dm_struct *pDM_Odm, u8 MacId, u32 PWDBAll, bool isCCKrate)
-{
- struct sw_ant_switch *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
-
- if (pDM_SWAT_Table->antsel == 1) {
- if (isCCKrate) {
- pDM_SWAT_Table->CCK_Ant1_Cnt[MacId]++;
- } else {
- pDM_SWAT_Table->OFDM_Ant1_Cnt[MacId]++;
- pDM_SWAT_Table->RSSI_Ant1_Sum[MacId] += PWDBAll;
- }
- } else {
- if (isCCKrate) {
- pDM_SWAT_Table->CCK_Ant2_Cnt[MacId]++;
- } else {
- pDM_SWAT_Table->OFDM_Ant2_Cnt[MacId]++;
- pDM_SWAT_Table->RSSI_Ant2_Sum[MacId] += PWDBAll;
- }
- }
-}
-
void odm_HwAntDiv(struct odm_dm_struct *pDM_Odm)
{
if (!(pDM_Odm->SupportAbility & ODM_BB_ANT_DIV))
diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
index db24678eb0bc..a8e9089433ba 100644
--- a/drivers/staging/r8188eu/include/odm.h
+++ b/drivers/staging/r8188eu/include/odm.h
@@ -899,7 +899,4 @@ void ODM_CmnInfoPtrArrayHook(struct odm_dm_struct *pDM_Odm,

void ODM_CmnInfoUpdate(struct odm_dm_struct *pDM_Odm, u32 CmnInfo, u64 Value);

-void ODM_AntselStatistics_88C(struct odm_dm_struct *pDM_Odm, u8 MacId,
- u32 PWDBAll, bool isCCKrate);
-
#endif
--
2.33.0

2021-10-17 06:02:54

by Michael Straube

[permalink] [raw]
Subject: [PATCH 5/7] staging: r8188eu: pBandType is never set

pBandType is never set, it stays at the default value 0. Remove it
from odm_dm_struct and remove related unneeded code.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 +-
drivers/staging/r8188eu/hal/odm.c | 3 ---
drivers/staging/r8188eu/include/odm.h | 8 --------
3 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
index f01ee3cd8795..8e9fbc9cf84d 100644
--- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
+++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
@@ -317,7 +317,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
X = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][4];
Y = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][5];

- if ((X != 0) && (*dm_odm->pBandType == ODM_BAND_2_4G)) {
+ if (X != 0) {
if ((X & 0x00000200) != 0) /* consider minus */
X = X | 0xFFFFFC00;
ele_A = ((X * ele_D) >> 8) & 0x000003FF;
diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
index d3d13164ca8f..85bc5050cda5 100644
--- a/drivers/staging/r8188eu/hal/odm.c
+++ b/drivers/staging/r8188eu/hal/odm.c
@@ -243,9 +243,6 @@ void ODM_CmnInfoHook(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def Cmn
case ODM_CMNINFO_WM_MODE:
pDM_Odm->pWirelessMode = (u8 *)pValue;
break;
- case ODM_CMNINFO_BAND:
- pDM_Odm->pBandType = (u8 *)pValue;
- break;
case ODM_CMNINFO_SEC_CHNL_OFFSET:
pDM_Odm->pSecChOffset = (u8 *)pValue;
break;
diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
index a8e9089433ba..9745069060d7 100644
--- a/drivers/staging/r8188eu/include/odm.h
+++ b/drivers/staging/r8188eu/include/odm.h
@@ -273,7 +273,6 @@ enum odm_common_info_def {
ODM_CMNINFO_TX_UNI,
ODM_CMNINFO_RX_UNI,
ODM_CMNINFO_WM_MODE, /* ODM_WIRELESS_MODE_E */
- ODM_CMNINFO_BAND, /* ODM_BAND_TYPE_E */
ODM_CMNINFO_SEC_CHNL_OFFSET, /* ODM_SEC_CHNL_OFFSET_E */
ODM_CMNINFO_SEC_MODE, /* ODM_SECURITY_E */
ODM_CMNINFO_BW, /* ODM_BW_E */
@@ -405,11 +404,6 @@ enum odm_wireless_mode {
ODM_WM_AUTO = BIT(5),
};

-/* ODM_CMNINFO_BAND */
-enum odm_band_type {
- ODM_BAND_2_4G = BIT(0),
-};
-
/* ODM_CMNINFO_SEC_CHNL_OFFSET */
enum odm_sec_chnl_offset {
ODM_DONT_CARE = 0,
@@ -635,8 +629,6 @@ struct odm_dm_struct {
u64 *pNumRxBytesUnicast;
/* Wireless mode B/G/A/N = BIT(0)/BIT(1)/BIT(2)/BIT(3) */
u8 *pWirelessMode; /* ODM_WIRELESS_MODE_E */
- /* Frequence band 2.4G/5G = 0/1 */
- u8 *pBandType;
/* Secondary channel offset don't_care/below/above = 0/1/2 */
u8 *pSecChOffset;
/* Security mode Open/WEP/AES/TKIP = 0/1/2/3 */
--
2.33.0

2021-10-17 06:03:19

by Michael Straube

[permalink] [raw]
Subject: [PATCH 7/7] staging: r8188eu: remove ODM_CmnInfoPtrArrayHook()

In ODM_CmnInfoPtrArrayHook() there is only the case
ODM_CMNINFO_STA_STATUS and the function is called only with this value.
Remove ODM_CmnInfoPtrArrayHook() and fix the three places where it is
called.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/hal/odm.c | 15 ---------------
drivers/staging/r8188eu/hal/rtl8188e_dm.c | 2 +-
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 5 +++--
drivers/staging/r8188eu/include/odm.h | 10 ----------
4 files changed, 4 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
index a2cbe727f6e0..0987ff3e382a 100644
--- a/drivers/staging/r8188eu/hal/odm.c
+++ b/drivers/staging/r8188eu/hal/odm.c
@@ -292,21 +292,6 @@ void ODM_CmnInfoHook(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def Cmn
}
}

-void ODM_CmnInfoPtrArrayHook(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def CmnInfo, u16 Index, void *pValue)
-{
- /* Hook call by reference pointer. */
- switch (CmnInfo) {
- /* Dynamic call by reference pointer. */
- case ODM_CMNINFO_STA_STATUS:
- pDM_Odm->pODM_StaInfo[Index] = (struct sta_info *)pValue;
- break;
- /* To remove the compiler warning, must add an empty default statement to handle the other values. */
- default:
- /* do nothing */
- break;
- }
-}
-
/* Update Band/CHannel/.. The values are dynamic but non-per-packet. */
void ODM_CmnInfoUpdate(struct odm_dm_struct *pDM_Odm, u32 CmnInfo, u64 Value)
{
diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c
index 1ca24a507d6d..f1a1015eedfb 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c
@@ -90,7 +90,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter)
ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_RF_ANTENNA_TYPE, hal_data->TRxAntDivType);

for (i = 0; i < NUM_STA; i++)
- ODM_CmnInfoPtrArrayHook(dm_odm, ODM_CMNINFO_STA_STATUS, i, NULL);
+ dm_odm->pODM_StaInfo[i] = NULL;
}

void rtl8188e_InitHalDm(struct adapter *Adapter)
diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
index dd8d6b4a9d48..8c00f2dd67da 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
@@ -1671,13 +1671,14 @@ void rtl8188e_SetHalODMVar(struct adapter *Adapter, enum hal_odm_variable eVaria
case HAL_ODM_STA_INFO:
{
struct sta_info *psta = (struct sta_info *)pValue1;
+
if (bSet) {
DBG_88E("### Set STA_(%d) info\n", psta->mac_id);
- ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta);
+ podmpriv->pODM_StaInfo[psta->mac_id] = psta;
ODM_RAInfo_Init(podmpriv, psta->mac_id);
} else {
DBG_88E("### Clean STA_(%d) info\n", psta->mac_id);
- ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, NULL);
+ podmpriv->pODM_StaInfo[psta->mac_id] = NULL;
}
}
break;
diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
index 6cbf64df9be7..841603b341bd 100644
--- a/drivers/staging/r8188eu/include/odm.h
+++ b/drivers/staging/r8188eu/include/odm.h
@@ -305,12 +305,6 @@ enum odm_common_info_def {
ODM_CMNINFO_BT_BUSY, /* Check Bt is using or not */
ODM_CMNINFO_BT_DISABLE_EDCA,
/* CALL BY VALUE-------------*/
-
- /* Dynamic ptr array hook itms. */
- ODM_CMNINFO_STA_STATUS,
- ODM_CMNINFO_PHY_STATUS,
- ODM_CMNINFO_MAC_STATUS,
- ODM_CMNINFO_MAX,
};

/* 2011/10/20 MH Define ODM support ability. ODM_CMNINFO_ABILITY */
@@ -882,10 +876,6 @@ void ODM_CmnInfoInit(struct odm_dm_struct *pDM_Odm,
void ODM_CmnInfoHook(struct odm_dm_struct *pDM_Odm,
enum odm_common_info_def CmnInfo, void *pValue);

-void ODM_CmnInfoPtrArrayHook(struct odm_dm_struct *pDM_Odm,
- enum odm_common_info_def CmnInfo,
- u16 Index, void *pValue);
-
void ODM_CmnInfoUpdate(struct odm_dm_struct *pDM_Odm, u32 CmnInfo, u64 Value);

#endif
--
2.33.0

2021-10-17 06:45:03

by Michael Straube

[permalink] [raw]
Subject: [PATCH 6/7] staging: r8188eu: pMacPhyMode is not used

pMacPhyMode is not used. Remove it from odm_dm_struct and remove
related dead code.

Signed-off-by: Michael Straube <[email protected]>
---
drivers/staging/r8188eu/hal/odm.c | 3 ---
drivers/staging/r8188eu/include/odm.h | 3 ---
2 files changed, 6 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
index 85bc5050cda5..a2cbe727f6e0 100644
--- a/drivers/staging/r8188eu/hal/odm.c
+++ b/drivers/staging/r8188eu/hal/odm.c
@@ -231,9 +231,6 @@ void ODM_CmnInfoHook(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def Cmn
/* */
switch (CmnInfo) {
/* Dynamic call by reference pointer. */
- case ODM_CMNINFO_MAC_PHY_MODE:
- pDM_Odm->pMacPhyMode = (u8 *)pValue;
- break;
case ODM_CMNINFO_TX_UNI:
pDM_Odm->pNumTxBytesUnicast = (u64 *)pValue;
break;
diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
index 9745069060d7..6cbf64df9be7 100644
--- a/drivers/staging/r8188eu/include/odm.h
+++ b/drivers/staging/r8188eu/include/odm.h
@@ -269,7 +269,6 @@ enum odm_common_info_def {

/* Dynamic value: */
/* POINTER REFERENCE----------- */
- ODM_CMNINFO_MAC_PHY_MODE, /* ODM_MAC_PHY_MODE_E */
ODM_CMNINFO_TX_UNI,
ODM_CMNINFO_RX_UNI,
ODM_CMNINFO_WM_MODE, /* ODM_WIRELESS_MODE_E */
@@ -621,8 +620,6 @@ struct odm_dm_struct {
bool bool_temp;
struct adapter *adapter_temp;

- /* MAC PHY Mode SMSP/DMSP/DMDP = 0/1/2 */
- u8 *pMacPhyMode;
/* TX Unicast byte count */
u64 *pNumTxBytesUnicast;
/* RX Unicast byte count */
--
2.33.0

2021-10-17 17:05:02

by Phillip Potter

[permalink] [raw]
Subject: Re: [PATCH 0/7] staging: r8188eu: odm cleanups

On Fri, Oct 15, 2021 at 06:35:00PM +0200, Michael Straube wrote:
> This series removes:
> - empty / unused functions from odm.c
> - two never set / unused fields from odm_dm_struct
> - the function ODM_CmnInfoPtrArrayHook()
>
> Tested on x86_64 with Inter-Tech DMG-02.
>
> Michael Straube (7):
> staging: r8188eu: remove empty functions from odm.c
> staging: r8188eu: remove ODM_SingleDualAntennaDefaultSetting()
> staging: r8188eu: remove GetPSDData()
> staging: r8188eu: remove ODM_AntselStatistics_88C()
> staging: r8188eu: pBandType is never set
> staging: r8188eu: pMacPhyMode is not used
> staging: r8188eu: remove ODM_CmnInfoPtrArrayHook()
>
> drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 +-
> drivers/staging/r8188eu/hal/odm.c | 144 ------------------
> drivers/staging/r8188eu/hal/odm_HWConfig.c | 7 +-
> drivers/staging/r8188eu/hal/odm_interface.c | 5 -
> drivers/staging/r8188eu/hal/rtl8188e_dm.c | 2 +-
> .../staging/r8188eu/hal/rtl8188e_hal_init.c | 5 +-
> drivers/staging/r8188eu/include/odm.h | 38 -----
> .../staging/r8188eu/include/odm_interface.h | 2 -
> drivers/staging/r8188eu/include/odm_precomp.h | 2 -
> 9 files changed, 6 insertions(+), 201 deletions(-)
>
> --
> 2.33.0
>

Dear Michael,

Looks good to me. Built and tested on my USB-N10 Nano, works well. Many
thanks.

For whole series:
Acked-by: Phillip Potter <[email protected]>

Regards,
Phil

2021-10-17 17:10:01

by Michael Straube

[permalink] [raw]
Subject: Re: [PATCH 0/7] staging: r8188eu: odm cleanups

On 10/15/21 20:07, Phillip Potter wrote:
> On Fri, Oct 15, 2021 at 06:35:00PM +0200, Michael Straube wrote:
>> This series removes:
>> - empty / unused functions from odm.c
>> - two never set / unused fields from odm_dm_struct
>> - the function ODM_CmnInfoPtrArrayHook()
>>
>> Tested on x86_64 with Inter-Tech DMG-02.
>>
>> Michael Straube (7):
>> staging: r8188eu: remove empty functions from odm.c
>> staging: r8188eu: remove ODM_SingleDualAntennaDefaultSetting()
>> staging: r8188eu: remove GetPSDData()
>> staging: r8188eu: remove ODM_AntselStatistics_88C()
>> staging: r8188eu: pBandType is never set
>> staging: r8188eu: pMacPhyMode is not used
>> staging: r8188eu: remove ODM_CmnInfoPtrArrayHook()
>>
>> drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 +-
>> drivers/staging/r8188eu/hal/odm.c | 144 ------------------
>> drivers/staging/r8188eu/hal/odm_HWConfig.c | 7 +-
>> drivers/staging/r8188eu/hal/odm_interface.c | 5 -
>> drivers/staging/r8188eu/hal/rtl8188e_dm.c | 2 +-
>> .../staging/r8188eu/hal/rtl8188e_hal_init.c | 5 +-
>> drivers/staging/r8188eu/include/odm.h | 38 -----
>> .../staging/r8188eu/include/odm_interface.h | 2 -
>> drivers/staging/r8188eu/include/odm_precomp.h | 2 -
>> 9 files changed, 6 insertions(+), 201 deletions(-)
>>
>> --
>> 2.33.0
>>
>
> Dear Michael,
>
> Looks good to me. Built and tested on my USB-N10 Nano, works well. Many
> thanks.
>
> For whole series:
> Acked-by: Phillip Potter <[email protected]>
>
> Regards,
> Phil
>

Thank you for testing and your ack Phillip.

Regards,
Michael

2021-10-18 03:32:22

by Martin Kaiser

[permalink] [raw]
Subject: Re: [PATCH 6/7] staging: r8188eu: pMacPhyMode is not used

Thus wrote Michael Straube ([email protected]):

> pMacPhyMode is not used. Remove it from odm_dm_struct and remove
> related dead code.

> Signed-off-by: Michael Straube <[email protected]>
> ---
> drivers/staging/r8188eu/hal/odm.c | 3 ---
> drivers/staging/r8188eu/include/odm.h | 3 ---
> 2 files changed, 6 deletions(-)

> diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
> index 85bc5050cda5..a2cbe727f6e0 100644
> --- a/drivers/staging/r8188eu/hal/odm.c
> +++ b/drivers/staging/r8188eu/hal/odm.c
> @@ -231,9 +231,6 @@ void ODM_CmnInfoHook(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def Cmn
> /* */
> switch (CmnInfo) {
> /* Dynamic call by reference pointer. */
> - case ODM_CMNINFO_MAC_PHY_MODE:
> - pDM_Odm->pMacPhyMode = (u8 *)pValue;
> - break;
> case ODM_CMNINFO_TX_UNI:
> pDM_Odm->pNumTxBytesUnicast = (u64 *)pValue;
> break;
> diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
> index 9745069060d7..6cbf64df9be7 100644
> --- a/drivers/staging/r8188eu/include/odm.h
> +++ b/drivers/staging/r8188eu/include/odm.h
> @@ -269,7 +269,6 @@ enum odm_common_info_def {

> /* Dynamic value: */
> /* POINTER REFERENCE----------- */
> - ODM_CMNINFO_MAC_PHY_MODE, /* ODM_MAC_PHY_MODE_E */
> ODM_CMNINFO_TX_UNI,
> ODM_CMNINFO_RX_UNI,
> ODM_CMNINFO_WM_MODE, /* ODM_WIRELESS_MODE_E */
> @@ -621,8 +620,6 @@ struct odm_dm_struct {
> bool bool_temp;
> struct adapter *adapter_temp;

> - /* MAC PHY Mode SMSP/DMSP/DMDP = 0/1/2 */
> - u8 *pMacPhyMode;
> /* TX Unicast byte count */
> u64 *pNumTxBytesUnicast;
> /* RX Unicast byte count */
> --
> 2.33.0

Acked-by: Martin Kaiser <[email protected]>

2021-10-18 03:32:23

by Michael Straube

[permalink] [raw]
Subject: Re: [PATCH 1/7] staging: r8188eu: remove empty functions from odm.c

On 10/16/21 11:29, Martin Kaiser wrote:
> Thus wrote Michael Straube ([email protected]):
>
>> Remove empty functions from odm.c.
>
>> Signed-off-by: Michael Straube <[email protected]>
>> ---
>> drivers/staging/r8188eu/hal/odm.c | 32 -------------------
>> drivers/staging/r8188eu/hal/odm_HWConfig.c | 7 +---
>> drivers/staging/r8188eu/include/odm.h | 7 ----
>> drivers/staging/r8188eu/include/odm_precomp.h | 2 --
>> 4 files changed, 1 insertion(+), 47 deletions(-)
>
>> diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
>> index 2178ffe41bb3..627213392795 100644
>> --- a/drivers/staging/r8188eu/hal/odm.c
>> +++ b/drivers/staging/r8188eu/hal/odm.c
>> @@ -196,13 +196,9 @@ void ODM_DMWatchdog(struct odm_dm_struct *pDM_Odm)
>> (pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) ||
>> (pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV))
>> odm_HwAntDiv(pDM_Odm);
>> - else if (pDM_Odm->AntDivType == CGCS_RX_SW_ANTDIV)
>> - odm_SwAntDivChkAntSwitch(pDM_Odm, SWAW_STEP_PEAK);
>
> This was the last user of SWAW_STEP_PEAK. The define can be removed now
> (maybe in a follow-up patch).
>
> Acked-by: Martin Kaiser <[email protected]>
>

Thank you for your review Martin. I'll send follow up patches to remove
this and other now unused variables I missed.

Thanks again,
Michael

2021-10-18 03:32:38

by Martin Kaiser

[permalink] [raw]
Subject: Re: [PATCH 1/7] staging: r8188eu: remove empty functions from odm.c

Thus wrote Michael Straube ([email protected]):

> Remove empty functions from odm.c.

> Signed-off-by: Michael Straube <[email protected]>
> ---
> drivers/staging/r8188eu/hal/odm.c | 32 -------------------
> drivers/staging/r8188eu/hal/odm_HWConfig.c | 7 +---
> drivers/staging/r8188eu/include/odm.h | 7 ----
> drivers/staging/r8188eu/include/odm_precomp.h | 2 --
> 4 files changed, 1 insertion(+), 47 deletions(-)

> diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
> index 2178ffe41bb3..627213392795 100644
> --- a/drivers/staging/r8188eu/hal/odm.c
> +++ b/drivers/staging/r8188eu/hal/odm.c
> @@ -196,13 +196,9 @@ void ODM_DMWatchdog(struct odm_dm_struct *pDM_Odm)
> (pDM_Odm->AntDivType == CGCS_RX_HW_ANTDIV) ||
> (pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV))
> odm_HwAntDiv(pDM_Odm);
> - else if (pDM_Odm->AntDivType == CGCS_RX_SW_ANTDIV)
> - odm_SwAntDivChkAntSwitch(pDM_Odm, SWAW_STEP_PEAK);

This was the last user of SWAW_STEP_PEAK. The define can be removed now
(maybe in a follow-up patch).

Acked-by: Martin Kaiser <[email protected]>

2021-10-18 03:32:58

by Martin Kaiser

[permalink] [raw]
Subject: Re: [PATCH 7/7] staging: r8188eu: remove ODM_CmnInfoPtrArrayHook()

Thus wrote Michael Straube ([email protected]):

> In ODM_CmnInfoPtrArrayHook() there is only the case
> ODM_CMNINFO_STA_STATUS and the function is called only with this value.
> Remove ODM_CmnInfoPtrArrayHook() and fix the three places where it is
> called.

> Signed-off-by: Michael Straube <[email protected]>
> ---
> drivers/staging/r8188eu/hal/odm.c | 15 ---------------
> drivers/staging/r8188eu/hal/rtl8188e_dm.c | 2 +-
> drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 5 +++--
> drivers/staging/r8188eu/include/odm.h | 10 ----------
> 4 files changed, 4 insertions(+), 28 deletions(-)

> diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
> index a2cbe727f6e0..0987ff3e382a 100644
> --- a/drivers/staging/r8188eu/hal/odm.c
> +++ b/drivers/staging/r8188eu/hal/odm.c
> @@ -292,21 +292,6 @@ void ODM_CmnInfoHook(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def Cmn
> }
> }

> -void ODM_CmnInfoPtrArrayHook(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def CmnInfo, u16 Index, void *pValue)
> -{
> - /* Hook call by reference pointer. */
> - switch (CmnInfo) {
> - /* Dynamic call by reference pointer. */
> - case ODM_CMNINFO_STA_STATUS:
> - pDM_Odm->pODM_StaInfo[Index] = (struct sta_info *)pValue;
> - break;
> - /* To remove the compiler warning, must add an empty default statement to handle the other values. */
> - default:
> - /* do nothing */
> - break;
> - }
> -}
> -
> /* Update Band/CHannel/.. The values are dynamic but non-per-packet. */
> void ODM_CmnInfoUpdate(struct odm_dm_struct *pDM_Odm, u32 CmnInfo, u64 Value)
> {
> diff --git a/drivers/staging/r8188eu/hal/rtl8188e_dm.c b/drivers/staging/r8188eu/hal/rtl8188e_dm.c
> index 1ca24a507d6d..f1a1015eedfb 100644
> --- a/drivers/staging/r8188eu/hal/rtl8188e_dm.c
> +++ b/drivers/staging/r8188eu/hal/rtl8188e_dm.c
> @@ -90,7 +90,7 @@ static void Update_ODM_ComInfo_88E(struct adapter *Adapter)
> ODM_CmnInfoInit(dm_odm, ODM_CMNINFO_RF_ANTENNA_TYPE, hal_data->TRxAntDivType);

> for (i = 0; i < NUM_STA; i++)
> - ODM_CmnInfoPtrArrayHook(dm_odm, ODM_CMNINFO_STA_STATUS, i, NULL);
> + dm_odm->pODM_StaInfo[i] = NULL;
> }

> void rtl8188e_InitHalDm(struct adapter *Adapter)
> diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
> index dd8d6b4a9d48..8c00f2dd67da 100644
> --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
> +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c
> @@ -1671,13 +1671,14 @@ void rtl8188e_SetHalODMVar(struct adapter *Adapter, enum hal_odm_variable eVaria
> case HAL_ODM_STA_INFO:
> {
> struct sta_info *psta = (struct sta_info *)pValue1;
> +
> if (bSet) {
> DBG_88E("### Set STA_(%d) info\n", psta->mac_id);
> - ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta);
> + podmpriv->pODM_StaInfo[psta->mac_id] = psta;
> ODM_RAInfo_Init(podmpriv, psta->mac_id);
> } else {
> DBG_88E("### Clean STA_(%d) info\n", psta->mac_id);
> - ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, NULL);
> + podmpriv->pODM_StaInfo[psta->mac_id] = NULL;
> }
> }
> break;
> diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
> index 6cbf64df9be7..841603b341bd 100644
> --- a/drivers/staging/r8188eu/include/odm.h
> +++ b/drivers/staging/r8188eu/include/odm.h
> @@ -305,12 +305,6 @@ enum odm_common_info_def {
> ODM_CMNINFO_BT_BUSY, /* Check Bt is using or not */
> ODM_CMNINFO_BT_DISABLE_EDCA,
> /* CALL BY VALUE-------------*/
> -
> - /* Dynamic ptr array hook itms. */
> - ODM_CMNINFO_STA_STATUS,
> - ODM_CMNINFO_PHY_STATUS,
> - ODM_CMNINFO_MAC_STATUS,
> - ODM_CMNINFO_MAX,
> };

> /* 2011/10/20 MH Define ODM support ability. ODM_CMNINFO_ABILITY */
> @@ -882,10 +876,6 @@ void ODM_CmnInfoInit(struct odm_dm_struct *pDM_Odm,
> void ODM_CmnInfoHook(struct odm_dm_struct *pDM_Odm,
> enum odm_common_info_def CmnInfo, void *pValue);

> -void ODM_CmnInfoPtrArrayHook(struct odm_dm_struct *pDM_Odm,
> - enum odm_common_info_def CmnInfo,
> - u16 Index, void *pValue);
> -
> void ODM_CmnInfoUpdate(struct odm_dm_struct *pDM_Odm, u32 CmnInfo, u64 Value);

> #endif
> --
> 2.33.0

Acked-by: Martin Kaiser <[email protected]>

2021-10-18 03:33:00

by Martin Kaiser

[permalink] [raw]
Subject: Re: [PATCH 3/7] staging: r8188eu: remove GetPSDData()

Thus wrote Michael Straube ([email protected]):

> Function GetPSDData() is not used, remove it. It is the only user of
> ConvertTo_dB() and ODM_StallExecution(), remove these two functions
> and the now unused dB_Invert_Table as well.

> Signed-off-by: Michael Straube <[email protected]>
> ---
> drivers/staging/r8188eu/hal/odm.c | 59 -------------------
> drivers/staging/r8188eu/hal/odm_interface.c | 5 --
> drivers/staging/r8188eu/include/odm.h | 5 --
> .../staging/r8188eu/include/odm_interface.h | 2 -
> 4 files changed, 71 deletions(-)

> diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
> index 030bc7bd9905..28bd6f36cddd 100644
> --- a/drivers/staging/r8188eu/hal/odm.c
> +++ b/drivers/staging/r8188eu/hal/odm.c
> @@ -5,17 +5,6 @@

> #include "../include/odm_precomp.h"

> -static const u16 dB_Invert_Table[8][12] = {
> - {1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4},
> - {4, 5, 6, 6, 7, 8, 9, 10, 11, 13, 14, 16},
> - {18, 20, 22, 25, 28, 32, 35, 40, 45, 50, 56, 63},
> - {71, 79, 89, 100, 112, 126, 141, 158, 178, 200, 224, 251},
> - {282, 316, 355, 398, 447, 501, 562, 631, 708, 794, 891, 1000},
> - {1122, 1259, 1413, 1585, 1778, 1995, 2239, 2512, 2818, 3162, 3548, 3981},
> - {4467, 5012, 5623, 6310, 7079, 7943, 8913, 10000, 11220, 12589, 14125, 15849},
> - {17783, 19953, 22387, 25119, 28184, 31623, 35481, 39811, 44668, 50119, 56234, 65535}
> -};
> -
> /* avoid to warn in FreeBSD ==> To DO modify */
> static u32 EDCAParam[HT_IOT_PEER_MAX][3] = {
> /* UL DL */
> @@ -1142,51 +1131,3 @@ void odm_EdcaTurboCheck(struct odm_dm_struct *pDM_Odm)
> pxmitpriv->last_tx_bytes = pxmitpriv->tx_bytes;
> precvpriv->last_rx_bytes = precvpriv->rx_bytes;
> }
> -
> -/* need to ODM CE Platform */
> -/* move to here for ANT detection mechanism using */
> -
> -u32 GetPSDData(struct odm_dm_struct *pDM_Odm, unsigned int point, u8 initial_gain_psd)
> -{
> - u32 psd_report;
> -
> - /* Set DCO frequency index, offset=(40MHz/SamplePts)*point */
> - ODM_SetBBReg(pDM_Odm, 0x808, 0x3FF, point);
> -
> - /* Start PSD calculation, Reg808[22]=0->1 */
> - ODM_SetBBReg(pDM_Odm, 0x808, BIT(22), 1);
> - /* Need to wait for HW PSD report */
> - ODM_StallExecution(30);
> - ODM_SetBBReg(pDM_Odm, 0x808, BIT(22), 0);
> - /* Read PSD report, Reg8B4[15:0] */
> - psd_report = ODM_GetBBReg(pDM_Odm, 0x8B4, bMaskDWord) & 0x0000FFFF;
> -
> - psd_report = (u32)(ConvertTo_dB(psd_report)) + (u32)(initial_gain_psd - 0x1c);
> -
> - return psd_report;
> -}
> -
> -u32 ConvertTo_dB(u32 Value)
> -{
> - u8 i;
> - u8 j;
> - u32 dB;
> -
> - Value = Value & 0xFFFF;
> - for (i = 0; i < 8; i++) {
> - if (Value <= dB_Invert_Table[i][11])
> - break;
> - }
> -
> - if (i >= 8)
> - return 96; /* maximum 96 dB */
> -
> - for (j = 0; j < 12; j++) {
> - if (Value <= dB_Invert_Table[i][j])
> - break;
> - }
> -
> - dB = i * 12 + j + 1;
> -
> - return dB;
> -}
> diff --git a/drivers/staging/r8188eu/hal/odm_interface.c b/drivers/staging/r8188eu/hal/odm_interface.c
> index c97104c3682f..7ddba39a0f4b 100644
> --- a/drivers/staging/r8188eu/hal/odm_interface.c
> +++ b/drivers/staging/r8188eu/hal/odm_interface.c
> @@ -77,11 +77,6 @@ s32 ODM_CompareMemory(struct odm_dm_struct *pDM_Odm, void *pBuf1, void *pBuf2, u
> }

> /* ODM Timer relative API. */
> -void ODM_StallExecution(u32 usDelay)
> -{
> - udelay(usDelay);
> -}
> -
> void ODM_delay_ms(u32 ms)
> {
> mdelay(ms);
> diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
> index 21e08a9f8bf8..db24678eb0bc 100644
> --- a/drivers/staging/r8188eu/include/odm.h
> +++ b/drivers/staging/r8188eu/include/odm.h
> @@ -880,11 +880,6 @@ void ODM_TXPowerTrackingCheck(struct odm_dm_struct *pDM_Odm);
> bool ODM_RAStateCheck(struct odm_dm_struct *pDM_Odm, s32 RSSI,
> bool bForceUpdate, u8 *pRATRState);

> -u32 ConvertTo_dB(u32 Value);
> -
> -u32 GetPSDData(struct odm_dm_struct *pDM_Odm, unsigned int point,
> - u8 initial_gain_psd);
> -
> u32 ODM_Get_Rate_Bitmap(struct odm_dm_struct *pDM_Odm, u32 macid,
> u32 ra_mask, u8 rssi_level);

> diff --git a/drivers/staging/r8188eu/include/odm_interface.h b/drivers/staging/r8188eu/include/odm_interface.h
> index 3af58e853828..17a315d19a50 100644
> --- a/drivers/staging/r8188eu/include/odm_interface.h
> +++ b/drivers/staging/r8188eu/include/odm_interface.h
> @@ -50,8 +50,6 @@ s32 ODM_CompareMemory(struct odm_dm_struct *pDM_Odm, void *pBuf1, void *pBuf2,
> u32 length);

> /* ODM Timer relative API. */
> -void ODM_StallExecution(u32 usDelay);
> -
> void ODM_delay_ms(u32 ms);

> void ODM_delay_us(u32 us);
> --
> 2.33.0

Acked-by: Martin Kaiser <[email protected]>

2021-10-18 03:33:38

by Martin Kaiser

[permalink] [raw]
Subject: Re: [PATCH 5/7] staging: r8188eu: pBandType is never set

Thus wrote Michael Straube ([email protected]):

> pBandType is never set, it stays at the default value 0. Remove it
> from odm_dm_struct and remove related unneeded code.

> Signed-off-by: Michael Straube <[email protected]>
> ---
> drivers/staging/r8188eu/hal/HalPhyRf_8188e.c | 2 +-
> drivers/staging/r8188eu/hal/odm.c | 3 ---
> drivers/staging/r8188eu/include/odm.h | 8 --------
> 3 files changed, 1 insertion(+), 12 deletions(-)

> diff --git a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
> index f01ee3cd8795..8e9fbc9cf84d 100644
> --- a/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
> +++ b/drivers/staging/r8188eu/hal/HalPhyRf_8188e.c
> @@ -317,7 +317,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
> X = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][4];
> Y = dm_odm->RFCalibrateInfo.IQKMatrixRegSetting.Value[0][5];

> - if ((X != 0) && (*dm_odm->pBandType == ODM_BAND_2_4G)) {
> + if (X != 0) {
> if ((X & 0x00000200) != 0) /* consider minus */
> X = X | 0xFFFFFC00;
> ele_A = ((X * ele_D) >> 8) & 0x000003FF;
> diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
> index d3d13164ca8f..85bc5050cda5 100644
> --- a/drivers/staging/r8188eu/hal/odm.c
> +++ b/drivers/staging/r8188eu/hal/odm.c
> @@ -243,9 +243,6 @@ void ODM_CmnInfoHook(struct odm_dm_struct *pDM_Odm, enum odm_common_info_def Cmn
> case ODM_CMNINFO_WM_MODE:
> pDM_Odm->pWirelessMode = (u8 *)pValue;
> break;
> - case ODM_CMNINFO_BAND:
> - pDM_Odm->pBandType = (u8 *)pValue;
> - break;
> case ODM_CMNINFO_SEC_CHNL_OFFSET:
> pDM_Odm->pSecChOffset = (u8 *)pValue;
> break;
> diff --git a/drivers/staging/r8188eu/include/odm.h b/drivers/staging/r8188eu/include/odm.h
> index a8e9089433ba..9745069060d7 100644
> --- a/drivers/staging/r8188eu/include/odm.h
> +++ b/drivers/staging/r8188eu/include/odm.h
> @@ -273,7 +273,6 @@ enum odm_common_info_def {
> ODM_CMNINFO_TX_UNI,
> ODM_CMNINFO_RX_UNI,
> ODM_CMNINFO_WM_MODE, /* ODM_WIRELESS_MODE_E */
> - ODM_CMNINFO_BAND, /* ODM_BAND_TYPE_E */
> ODM_CMNINFO_SEC_CHNL_OFFSET, /* ODM_SEC_CHNL_OFFSET_E */
> ODM_CMNINFO_SEC_MODE, /* ODM_SECURITY_E */
> ODM_CMNINFO_BW, /* ODM_BW_E */
> @@ -405,11 +404,6 @@ enum odm_wireless_mode {
> ODM_WM_AUTO = BIT(5),
> };

> -/* ODM_CMNINFO_BAND */
> -enum odm_band_type {
> - ODM_BAND_2_4G = BIT(0),
> -};
> -
> /* ODM_CMNINFO_SEC_CHNL_OFFSET */
> enum odm_sec_chnl_offset {
> ODM_DONT_CARE = 0,
> @@ -635,8 +629,6 @@ struct odm_dm_struct {
> u64 *pNumRxBytesUnicast;
> /* Wireless mode B/G/A/N = BIT(0)/BIT(1)/BIT(2)/BIT(3) */
> u8 *pWirelessMode; /* ODM_WIRELESS_MODE_E */
> - /* Frequence band 2.4G/5G = 0/1 */
> - u8 *pBandType;
> /* Secondary channel offset don't_care/below/above = 0/1/2 */
> u8 *pSecChOffset;
> /* Security mode Open/WEP/AES/TKIP = 0/1/2/3 */
> --
> 2.33.0

Acked-by: Martin Kaiser <[email protected]>

2021-10-18 03:33:38

by Martin Kaiser

[permalink] [raw]
Subject: Re: [PATCH 4/7] staging: r8188eu: remove ODM_AntselStatistics_88C()

Thus wrote Michael Straube ([email protected]):

> Function ODM_AntselStatistics_88C() is not used, remove it.

> Signed-off-by: Michael Straube <[email protected]>
> ---
> drivers/staging/r8188eu/hal/odm.c | 21 ---------------------
> drivers/staging/r8188eu/include/odm.h | 3 ---
> 2 files changed, 24 deletions(-)

> diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
> index 28bd6f36cddd..d3d13164ca8f 100644
> --- a/drivers/staging/r8188eu/hal/odm.c
> +++ b/drivers/staging/r8188eu/hal/odm.c
> @@ -1016,27 +1016,6 @@ void odm_InitHybridAntDiv(struct odm_dm_struct *pDM_Odm)
> ODM_AntennaDiversityInit_88E(pDM_Odm);
> }

> -void ODM_AntselStatistics_88C(struct odm_dm_struct *pDM_Odm, u8 MacId, u32 PWDBAll, bool isCCKrate)
> -{
> - struct sw_ant_switch *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
> -
> - if (pDM_SWAT_Table->antsel == 1) {
> - if (isCCKrate) {
> - pDM_SWAT_Table->CCK_Ant1_Cnt[MacId]++;
> - } else {
> - pDM_SWAT_Table->OFDM_Ant1_Cnt[MacId]++;
> - pDM_SWAT_Table->RSSI_Ant1_Sum[MacId] += PWDBAll;
> - }
> - } else {
> - if (isCCKrate) {
> - pDM_SWAT_Table->CCK_Ant2_Cnt[MacId]++;
> - } else {
> - pDM_SWAT_Table->OFDM_Ant2_Cnt[MacId]++;
> - pDM_SWAT_Table->RSSI_Ant2_Sum[MacId] += PWDBAll;
> - }
> - }
> -}
> -

Yet again, that seems to make a bunch of variables unused.
I guess that antsel, CCK_Ant1_Cnt, OFDM_Ant1_Cnt, RSSI_Ant1_Sum and their
Ant2 versions can be removed (haven't tried it yet, though).

I'm really curious to see what's left when we're done with all these
removals...

Best regards,
Martin

2021-10-18 03:33:40

by Martin Kaiser

[permalink] [raw]
Subject: Re: [PATCH 2/7] staging: r8188eu: remove ODM_SingleDualAntennaDefaultSetting()

Thus wrote Michael Straube ([email protected]):

> Function ODM_SingleDualAntennaDefaultSetting() is not used,
> remove it.

> Signed-off-by: Michael Straube <[email protected]>
> ---
> drivers/staging/r8188eu/hal/odm.c | 11 -----------
> drivers/staging/r8188eu/include/odm.h | 2 --
> 2 files changed, 13 deletions(-)

> diff --git a/drivers/staging/r8188eu/hal/odm.c b/drivers/staging/r8188eu/hal/odm.c
> index 627213392795..030bc7bd9905 100644
> --- a/drivers/staging/r8188eu/hal/odm.c
> +++ b/drivers/staging/r8188eu/hal/odm.c
> @@ -1190,14 +1190,3 @@ u32 ConvertTo_dB(u32 Value)

> return dB;
> }
> -
> -/* Description: */
> -/* Set Single/Dual Antenna default setting for products that do not do detection in advance. */
> -/* Added by Joseph, 2012.03.22 */
> -void ODM_SingleDualAntennaDefaultSetting(struct odm_dm_struct *pDM_Odm)
> -{
> - struct sw_ant_switch *pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table;
> -
> - pDM_SWAT_Table->ANTA_ON = true;
> - pDM_SWAT_Table->ANTB_ON = true;

ANTA_ON and ANTB_ON can now be removed from struct sw_ant_switch.