[PATCH 02/18] staging:rtl8192u: Remove member variable rx_gain_range_max - Style

John Whitmore
2018-08-03T00:04:19Z

The structure 'dig' defines a member variable, (rx_gain_range_max)
which is initialised to the value 'DM_DIG_MAX', (a defined constant).
The variable is then used to test and set another variable. Since
the member rx_gain_range_max is never assigned any other value then
the constant 'DM_DIG_MAX' the code might as well simply use that
constant, rather the a member variable set to that constant.

The member variable has been removed and the constant used directly
in the code. This is a coding style change which should not impact
runtime code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
---
drivers/staging/rtl8192u/r8192U_dm.c | 5 ++---
drivers/staging/rtl8192u/r8192U_dm.h | 1 -
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index 3336798310ac..8b9d011e9eec 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -1650,7 +1650,6 @@ static void dm_dig_init(struct net_device *dev)

dm_digtable.rssi_val = 50; /* for new dig debug rssi value */
dm_digtable.backoff_val = DM_DIG_BACKOFF;
- dm_digtable.rx_gain_range_max = DM_DIG_MAX;
if (priv->CustomerID == RT_CID_819x_Netcore)
dm_digtable.rx_gain_range_min = DM_DIG_MIN_Netcore;
else
@@ -1968,8 +1967,8 @@ static void dm_initial_gain(

if (dm_digtable.pre_connect_state == dm_digtable.cur_connect_state) {
if (dm_digtable.cur_connect_state == DIG_CONNECT) {
- if ((dm_digtable.rssi_val+10-dm_digtable.backoff_val) > dm_digtable.rx_gain_range_max)
- dm_digtable.cur_ig_value = dm_digtable.rx_gain_range_max;
+ if ((dm_digtable.rssi_val + 10 - dm_digtable.backoff_val) > DM_DIG_MAX)
+ dm_digtable.cur_ig_value = DM_DIG_MAX;
else if ((dm_digtable.rssi_val+10-dm_digtable.backoff_val) < dm_digtable.rx_gain_range_min)
dm_digtable.cur_ig_value = dm_digtable.rx_gain_range_min;
else
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h
index bc736f2f5a5c..f3e3db18fdd0 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -118,7 +118,6 @@ struct dig {
u32 cur_ig_value;

u8 backoff_val;
- u8 rx_gain_range_max;
u8 rx_gain_range_min;
bool initialgain_lowerbound_state;

--
2.18.0