Skip to contentSkip to conversation

Staging: rtl8188eu: Replace ternary operator with predefined macro

PATCH In review Vatika Harlalka 3 participants 3 messages Feb 23, 2015 – Feb 26, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8188eu: Replace ternary operator with predefined macro

Replace use of ternary operator with abs() macro to increase code readability.

---
 drivers/staging/rtl8188eu/hal/phy.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8188eu/hal/phy.c +1 -3
index e7ede44..115d611 100644
@@ -554,9 +554,7 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
 			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);
+			delta = abs(thermal_val - hal_data->EEPROMThermalMeter);
 			dm_odm->RFCalibrateInfo.bReloadtxpowerindex = false;
 			dm_odm->RFCalibrateInfo.bDoneTxpower = false;
 		} else if (dm_odm->RFCalibrateInfo.bDoneTxpower) {
Signature · 1 line
1.9.1
#1 lore raw
Quoted 2 lines · Vatika Harlalka

Replace use of ternary operator with abs() macro to increase code readability.

This is nice. You could see if you can use Coccinelle to find other occurrences.

julia

Quoted 30 lines
---
 drivers/staging/rtl8188eu/hal/phy.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8188eu/hal/phy.c +1 -4
index e7ede44..115d611 100644
@@ -554,9 +554,7 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
 			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);
+			delta = abs(thermal_val - hal_data->EEPROMThermalMeter);
 			dm_odm->RFCalibrateInfo.bReloadtxpowerindex = false;
 			dm_odm->RFCalibrateInfo.bDoneTxpower = false;
 		} else if (dm_odm->RFCalibrateInfo.bDoneTxpower) {
--

1.9.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150223162709.GA16766%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

maintainer
#2 lore raw
In reply to Vatika Harlalka
Quoted 13 lines · Vatika Harlalka

Replace use of ternary operator with abs() macro to increase code readability.

---
 drivers/staging/rtl8188eu/hal/phy.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8188eu/hal/phy.c +0 -0
index e7ede44..115d611 100644

drivers/staging/rtl8188eu/hal/phy.c void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt) · line 560

Quoted 10 lines
drivers/staging/rtl8188eu/hal/phy.c +1 -3
@@ -554,9 +554,7 @@ void rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
 			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);
+			delta = abs(thermal_val - hal_data->EEPROMThermalMeter);
 			dm_odm->RFCalibrateInfo.bReloadtxpowerindex = false;
 			dm_odm->RFCalibrateInfo.bDoneTxpower = false;
 		} else if (dm_odm->RFCalibrateInfo.bDoneTxpower) {

With the other changes you have made in this file, this patch no longer applies :(

Can you please refresh your tree against my staging-testing branch and respin this patch and resend it?

thanks,

greg k-h