diff options
author | Vatika Harlalka <vatikaharlalka@gmail.com> | 2015-02-23 18:10:27 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-02-26 20:53:48 (GMT) |
commit | 4c3fa640387e70b31cd1aee098f76559e50afe95 (patch) | |
tree | 7a54c983db4f17d9923017d495de43b850514a3a /drivers/staging/rtl8188eu | |
parent | d5dd06ea01807a6d32af1eb53f10ff5e08532e29 (diff) | |
download | linux-4c3fa640387e70b31cd1aee098f76559e50afe95.tar.xz |
Staging: rtl8188eu: Refactored code to increase readility
Refactored the conditional code to make it more compact.
Replaced the ternary operators with abs() macro to increase readability.
Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8188eu')
-rw-r--r-- | drivers/staging/rtl8188eu/hal/phy.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 175b87e..cee7cb7 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -548,27 +548,19 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) if (thermal_avg_count) thermal_val = (u8)(thermal_avg / thermal_avg_count); - if (dm_odm->RFCalibrateInfo.bReloadtxpowerindex) { - delta = thermal_val > hal_data->EEPROMThermalMeter ? - (thermal_val - hal_data->EEPROMThermalMeter) : - (hal_data->EEPROMThermalMeter - thermal_val); - dm_odm->RFCalibrateInfo.bReloadtxpowerindex = false; - dm_odm->RFCalibrateInfo.bDoneTxpower = false; - } else if (dm_odm->RFCalibrateInfo.bDoneTxpower) { - delta = (thermal_val > dm_odm->RFCalibrateInfo.ThermalValue) ? - (thermal_val - dm_odm->RFCalibrateInfo.ThermalValue) : - (dm_odm->RFCalibrateInfo.ThermalValue - thermal_val); - } else { - delta = thermal_val > hal_data->EEPROMThermalMeter ? - (thermal_val - hal_data->EEPROMThermalMeter) : - (hal_data->EEPROMThermalMeter - thermal_val); + if (dm_odm->RFCalibrateInfo.bDoneTxpower && + !dm_odm->RFCalibrateInfo.bReloadtxpowerindex) + delta = abs(thermal_val - dm_odm->RFCalibrateInfo.ThermalValue); + else { + delta = abs(thermal_val - hal_data->EEPROMThermalMeter); + if (dm_odm->RFCalibrateInfo.bReloadtxpowerindex) { + dm_odm->RFCalibrateInfo.bReloadtxpowerindex = false; + dm_odm->RFCalibrateInfo.bDoneTxpower = false; + } } - delta_lck = (thermal_val > dm_odm->RFCalibrateInfo.ThermalValue_LCK) ? - (thermal_val - dm_odm->RFCalibrateInfo.ThermalValue_LCK) : - (dm_odm->RFCalibrateInfo.ThermalValue_LCK - thermal_val); - delta_iqk = (thermal_val > dm_odm->RFCalibrateInfo.ThermalValue_IQK) ? - (thermal_val - dm_odm->RFCalibrateInfo.ThermalValue_IQK) : - (dm_odm->RFCalibrateInfo.ThermalValue_IQK - thermal_val); + + delta_lck = abs(dm_odm->RFCalibrateInfo.ThermalValue_LCK - thermal_val); + delta_iqk = abs(dm_odm->RFCalibrateInfo.ThermalValue_IQK - thermal_val); /* Delta temperature is equal to or larger than 20 centigrade.*/ if ((delta_lck >= 8)) { |