Commit 4c3fa640 authored by Vatika Harlalka's avatar Vatika Harlalka Committed by Greg Kroah-Hartman

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: default avatarVatika Harlalka <vatikaharlalka@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d5dd06ea
...@@ -548,27 +548,19 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) ...@@ -548,27 +548,19 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
if (thermal_avg_count) if (thermal_avg_count)
thermal_val = (u8)(thermal_avg / thermal_avg_count); thermal_val = (u8)(thermal_avg / thermal_avg_count);
if (dm_odm->RFCalibrateInfo.bReloadtxpowerindex) { if (dm_odm->RFCalibrateInfo.bDoneTxpower &&
delta = thermal_val > hal_data->EEPROMThermalMeter ? !dm_odm->RFCalibrateInfo.bReloadtxpowerindex)
(thermal_val - hal_data->EEPROMThermalMeter) : delta = abs(thermal_val - dm_odm->RFCalibrateInfo.ThermalValue);
(hal_data->EEPROMThermalMeter - thermal_val); else {
dm_odm->RFCalibrateInfo.bReloadtxpowerindex = false; delta = abs(thermal_val - hal_data->EEPROMThermalMeter);
dm_odm->RFCalibrateInfo.bDoneTxpower = false; if (dm_odm->RFCalibrateInfo.bReloadtxpowerindex) {
} else if (dm_odm->RFCalibrateInfo.bDoneTxpower) { dm_odm->RFCalibrateInfo.bReloadtxpowerindex = false;
delta = (thermal_val > dm_odm->RFCalibrateInfo.ThermalValue) ? dm_odm->RFCalibrateInfo.bDoneTxpower = false;
(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);
} }
delta_lck = (thermal_val > dm_odm->RFCalibrateInfo.ThermalValue_LCK) ?
(thermal_val - dm_odm->RFCalibrateInfo.ThermalValue_LCK) : delta_lck = abs(dm_odm->RFCalibrateInfo.ThermalValue_LCK - thermal_val);
(dm_odm->RFCalibrateInfo.ThermalValue_LCK - thermal_val); delta_iqk = abs(dm_odm->RFCalibrateInfo.ThermalValue_IQK - 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 temperature is equal to or larger than 20 centigrade.*/ /* Delta temperature is equal to or larger than 20 centigrade.*/
if ((delta_lck >= 8)) { if ((delta_lck >= 8)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment