All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jes Sorensen <jes.sorensen@gmail.com>
To: Vatika Harlalka <vatikaharlalka@gmail.com>,
	 outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH] Staging: rtl8188eu: Refactored code to increase readility
Date: Mon, 23 Feb 2015 15:14:36 -0500	[thread overview]
Message-ID: <54EB8A2C.9030105@gmail.com> (raw)
In-Reply-To: <20150223181027.GA21128@gmail.com>

On 02/23/15 13:10, Vatika Harlalka wrote:
> 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>
> ---
>  drivers/staging/rtl8188eu/hal/phy.c | 32 ++++++++++++--------------------
>  1 file changed, 12 insertions(+), 20 deletions(-)

This is a very nice cleanup.

Jes

> diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c
> index 3f663fe..f256004 100644
> --- a/drivers/staging/rtl8188eu/hal/phy.c
> +++ b/drivers/staging/rtl8188eu/hal/phy.c
> @@ -570,27 +570,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)) {
> 



      reply	other threads:[~2015-02-23 20:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23 18:10 [PATCH] Staging: rtl8188eu: Refactored code to increase readility Vatika Harlalka
2015-02-23 20:14 ` Jes Sorensen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54EB8A2C.9030105@gmail.com \
    --to=jes.sorensen@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=vatikaharlalka@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.