[PATCH 06/11] staging: rtl8192e: Remove dead code: rtl_dm.[ch]

Mateusz Kulikowski
2015-06-02T20:49:55Z

- Remove unused fields in dig_t structures. Some of them were only
initialized and never accessed.
- Remove unused enums/macros/defines in rtl_dm.h
- Remove duplicated function declarations
- Remove unused dm_change_dynamic_initgain_thresh() function
- Remove unused dm_shadow_init() function

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
---
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 80 ------------------------------
drivers/staging/rtl8192e/rtl8192e/rtl_dm.h | 70 --------------------------
2 files changed, 150 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index d480229..d869629 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -1303,63 +1303,14 @@ static void dm_bb_initialgain_backup(struct net_device *dev)

}

-void dm_change_dynamic_initgain_thresh(struct net_device *dev,
- u32 dm_type, u32 dm_value)
-{
- if (dm_type == DIG_TYPE_THRESH_HIGH) {
- dm_digtable.rssi_high_thresh = dm_value;
- } else if (dm_type == DIG_TYPE_THRESH_LOW) {
- dm_digtable.rssi_low_thresh = dm_value;
- } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH) {
- dm_digtable.rssi_high_power_highthresh = dm_value;
- } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_LOW) {
- dm_digtable.rssi_high_power_lowthresh = dm_value;
- } else if (dm_type == DIG_TYPE_ENABLE) {
- dm_digtable.dig_state = DM_STA_DIG_MAX;
- dm_digtable.dig_enable_flag = true;
- } else if (dm_type == DIG_TYPE_DISABLE) {
- dm_digtable.dig_state = DM_STA_DIG_MAX;
- dm_digtable.dig_enable_flag = false;
- } else if (dm_type == DIG_TYPE_DBG_MODE) {
- if (dm_value >= DM_DBG_MAX)
- dm_value = DM_DBG_OFF;
- dm_digtable.dbg_mode = (u8)dm_value;
- } else if (dm_type == DIG_TYPE_RSSI) {
- if (dm_value > 100)
- dm_value = 30;
- dm_digtable.rssi_val = (long)dm_value;
- } else if (dm_type == DIG_TYPE_ALGORITHM) {
- if (dm_value >= DIG_ALGO_MAX)
- dm_value = DIG_ALGO_BY_FALSE_ALARM;
- if (dm_digtable.dig_algorithm != (u8)dm_value)
- dm_digtable.dig_algorithm_switch = 1;
- dm_digtable.dig_algorithm = (u8)dm_value;
- } else if (dm_type == DIG_TYPE_BACKOFF) {
- if (dm_value > 30)
- dm_value = 30;
- dm_digtable.backoff_val = (u8)dm_value;
- } else if (dm_type == DIG_TYPE_RX_GAIN_MIN) {
- if (dm_value == 0)
- dm_value = 0x1;
- dm_digtable.rx_gain_range_min = (u8)dm_value;
- } else if (dm_type == DIG_TYPE_RX_GAIN_MAX) {
- if (dm_value > 0x50)
- dm_value = 0x50;
- dm_digtable.rx_gain_range_max = (u8)dm_value;
- }
-}
-
static void dm_dig_init(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);

dm_digtable.dig_enable_flag = true;
- dm_digtable.Backoff_Enable_Flag = true;

dm_digtable.dig_algorithm = DIG_ALGO_BY_RSSI;

- dm_digtable.Dig_TwoPort_Algorithm = DIG_TWO_PORT_ALGO_RSSI;
- dm_digtable.Dig_Ext_Port_Stage = DIG_EXT_PORT_STAGE_MAX;
dm_digtable.dbg_mode = DM_DBG_OFF;
dm_digtable.dig_algorithm_switch = 0;

@@ -1367,16 +1318,10 @@ static void dm_dig_init(struct net_device *dev)
dm_digtable.dig_highpwr_state = DM_STA_DIG_MAX;
dm_digtable.CurSTAConnectState = DIG_STA_DISCONNECT;
dm_digtable.PreSTAConnectState = DIG_STA_DISCONNECT;
- dm_digtable.CurAPConnectState = DIG_AP_DISCONNECT;
- dm_digtable.PreAPConnectState = DIG_AP_DISCONNECT;
- dm_digtable.initialgain_lowerbound_state = false;

dm_digtable.rssi_low_thresh = DM_DIG_THRESH_LOW;
dm_digtable.rssi_high_thresh = DM_DIG_THRESH_HIGH;

- dm_digtable.FALowThresh = DM_FALSEALARM_THRESH_LOW;
- dm_digtable.FAHighThresh = DM_FALSEALARM_THRESH_HIGH;
-
dm_digtable.rssi_high_power_lowthresh = DM_DIG_HIGH_PWR_THRESH_LOW;
dm_digtable.rssi_high_power_highthresh = DM_DIG_HIGH_PWR_THRESH_HIGH;

@@ -1387,9 +1332,6 @@ static void dm_dig_init(struct net_device *dev)
dm_digtable.rx_gain_range_min = DM_DIG_MIN_Netcore;
else
dm_digtable.rx_gain_range_min = DM_DIG_MIN;
-
- dm_digtable.BackoffVal_range_max = DM_DIG_BACKOFF_MAX;
- dm_digtable.BackoffVal_range_min = DM_DIG_BACKOFF_MIN;
}

static void dm_ctrl_initgain_byrssi(struct net_device *dev)
@@ -2565,28 +2507,6 @@ void dm_check_fsync(struct net_device *dev)
}
}

-void dm_shadow_init(struct net_device *dev)
-{
- u8 page;
- u16 offset;
-
- for (page = 0; page < 5; page++)
- for (offset = 0; offset < 256; offset++)
- dm_shadow[page][offset] = read_nic_byte(dev,
- offset+page * 256);
-
- for (page = 8; page < 11; page++)
- for (offset = 0; offset < 256; offset++)
- dm_shadow[page][offset] = read_nic_byte(dev,
- offset+page * 256);
-
- for (page = 12; page < 15; page++)
- for (offset = 0; offset < 256; offset++)
- dm_shadow[page][offset] = read_nic_byte(dev,
- offset+page*256);
-
-}
-
/*---------------------------Define function prototype------------------------*/
static void dm_init_dynamic_txpower(struct net_device *dev)
{
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h
index 6be8e8b..b0d9367 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h
@@ -87,17 +87,12 @@
struct dig_t {
u8 dig_enable_flag;
u8 dig_algorithm;
- u8 Dig_TwoPort_Algorithm;
- u8 Dig_Ext_Port_Stage;
u8 dbg_mode;
u8 dig_algorithm_switch;

long rssi_low_thresh;
long rssi_high_thresh;

- u32 FALowThresh;
- u32 FAHighThresh;
-
long rssi_high_power_lowthresh;
long rssi_high_power_highthresh;

@@ -105,8 +100,6 @@ struct dig_t {
u8 dig_highpwr_state;
u8 CurSTAConnectState;
u8 PreSTAConnectState;
- u8 CurAPConnectState;
- u8 PreAPConnectState;

u8 curpd_thstate;
u8 prepd_thstate;
@@ -116,13 +109,9 @@ struct dig_t {
u32 pre_ig_value;
u32 cur_ig_value;

- u8 Backoff_Enable_Flag;
u8 backoff_val;
- char BackoffVal_range_max;
- char BackoffVal_range_min;
u8 rx_gain_range_max;
u8 rx_gain_range_min;
- bool initialgain_lowerbound_state;

long rssi_val;
};
@@ -166,26 +155,6 @@ enum dm_dig_alg {
DIG_ALGO_MAX
};

-enum dm_dig_two_port_alg {
- DIG_TWO_PORT_ALGO_RSSI = 0,
- DIG_TWO_PORT_ALGO_FALSE_ALARM = 1,
-};
-
-
-enum dm_dig_ext_port_alg {
- DIG_EXT_PORT_STAGE_0 = 0,
- DIG_EXT_PORT_STAGE_1 = 1,
- DIG_EXT_PORT_STAGE_2 = 2,
- DIG_EXT_PORT_STAGE_3 = 3,
- DIG_EXT_PORT_STAGE_MAX = 4,
-};
-
-enum dm_dig_dbg {
- DIG_DBG_OFF = 0,
- DIG_DBG_ON = 1,
- DIG_DBG_MAX
-};
-
enum dm_dig_connect {
DIG_STA_DISCONNECT = 0,
DIG_STA_CONNECT = 1,
@@ -251,8 +220,6 @@ extern struct dig_t dm_digtable;
extern u8 dm_shadow[16][256];
extern struct drx_path_sel DM_RxPathSelTable;

-extern u8 test_flag;
-
/* Pre-calculated gain tables */
extern const u32 dm_tx_bb_gain[TxBBGainTableLength];
extern const u8 dm_cck_tx_bb_gain[CCKTxBBGainTableLength][8];
@@ -279,47 +246,10 @@ extern void dm_cck_txpower_adjust(struct net_device *dev, bool binch14);

extern void dm_restore_dynamic_mechanism_state(struct net_device *dev);
extern void dm_backup_dynamic_mechanism_state(struct net_device *dev);
-extern void dm_change_dynamic_initgain_thresh(struct net_device *dev,
- u32 dm_type,
- u32 dm_value);
-extern void DM_ChangeFsyncSetting(struct net_device *dev,
- s32 DM_Type,
- s32 DM_Value);
-extern void dm_force_tx_fw_info(struct net_device *dev,
- u32 force_type,
- u32 force_value);
extern void dm_init_edca_turbo(struct net_device *dev);
-extern void dm_rf_operation_test_callback(unsigned long data);
extern void dm_rf_pathcheck_workitemcallback(void *data);
extern void dm_fsync_timer_callback(unsigned long data);
extern void dm_check_fsync(struct net_device *dev);
-extern void dm_shadow_init(struct net_device *dev);
extern void dm_initialize_txpower_tracking(struct net_device *dev);
extern void dm_CheckRfCtrlGPIO(void *data);
-extern void dm_InitRateAdaptiveMask(struct net_device *dev);
-extern void init_hal_dm(struct net_device *dev);
-extern void deinit_hal_dm(struct net_device *dev);
-extern void hal_dm_watchdog(struct net_device *dev);
-extern void init_rate_adaptive(struct net_device *dev);
-extern void dm_txpower_trackingcallback(void *data);
-extern void dm_restore_dynamic_mechanism_state(struct net_device *dev);
-extern void dm_backup_dynamic_mechanism_state(struct net_device *dev);
-extern void dm_change_dynamic_initgain_thresh(struct net_device *dev,
- u32 dm_type,
- u32 dm_value);
-extern void DM_ChangeFsyncSetting(struct net_device *dev,
- s32 DM_Type,
- s32 DM_Value);
-extern void dm_force_tx_fw_info(struct net_device *dev,
- u32 force_type,
- u32 force_value);
-extern void dm_init_edca_turbo(struct net_device *dev);
-extern void dm_rf_operation_test_callback(unsigned long data);
-extern void dm_rf_pathcheck_workitemcallback(void *data);
-extern void dm_fsync_timer_callback(unsigned long data);
-extern void dm_check_fsync(struct net_device *dev);
-extern void dm_shadow_init(struct net_device *dev);
-extern void dm_initialize_txpower_tracking(struct net_device *dev);
-extern void dm_CheckRfCtrlGPIO(void *data);
-
#endif /*__R8192UDM_H__ */
--
1.8.4.1