All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jes Sorensen <jes.sorensen@gmail.com>
To: Cristina Opriceana <cristina.opriceana@gmail.com>,
	 outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH] Staging: rtl8192u: Bool tests don't need comparisons
Date: Wed, 04 Mar 2015 20:36:01 -0500	[thread overview]
Message-ID: <54F7B301.8020203@gmail.com> (raw)
In-Reply-To: <20150304230752.GA22499@Inspiron>

On 03/04/15 18:07, Cristina Opriceana wrote:
> This patch removes the following coccinelle warning:
> WARNING: Comparison to bool.
> It also adds small fixes for some coding style warnings.
> 
> Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com>
> ---
>  drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c |  8 +++-----
>  drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c    |  4 ++--
>  drivers/staging/rtl8192u/r8192U_core.c                 |  2 +-
>  drivers/staging/rtl8192u/r8192U_dm.c                   | 12 ++++++------
>  drivers/staging/rtl8192u/r819xU_firmware.c             |  6 +++---
>  drivers/staging/rtl8192u/r819xU_phy.c                  |  2 +-
>  6 files changed, 16 insertions(+), 18 deletions(-)

This patch is technically correct, the only issue is with some cases
where you touch a line, you should try to fix up other aesthetic issues
on the same line while you are at it.

See my comments below.

Cheers,
Jes

> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> index 1cc66a1..92e6e7f 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> @@ -1364,12 +1364,10 @@ static void ieee80211_associate_complete_wq(struct work_struct *work)
>  		ieee->LinkDetectInfo.NumRecvDataInPeriod= 1;
>  	}
>  	ieee->link_change(ieee->dev);
> -	if(ieee->is_silent_reset == 0){
> +	if (!ieee->is_silent_reset) {
>  		printk("============>normal associate\n");
>  	notify_wx_assoc_event(ieee);
> -	}
> -	else if(ieee->is_silent_reset == 1)
> -	{
> +	} else if (ieee->is_silent_reset) {
>  		printk("==================>silent reset associate\n");
>  		ieee->is_silent_reset = false;
>  	}
> @@ -2053,7 +2051,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
>  								ieee->SetWirelessMode(ieee->dev, IEEE_G);
>  							}
>  
> -							if (ieee->current_network.mode == IEEE_N_24G && bHalfSupportNmode == true)
> +							if (ieee->current_network.mode == IEEE_N_24G && bHalfSupportNmode)
>  							{
>  								printk("===============>entern half N mode\n");
>  								ieee->bHalfWirelessN24GMode = true;

Here, since you are touching this line, you should break it down as well.

> diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
> index acaa723..8e77c6f 100644
> --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
> +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
> @@ -288,7 +288,7 @@ static PTS_COMMON_INFO SearchAdmitTRStream(struct ieee80211_device *ieee,
>  	//for(dir = DIR_UP; dir <= DIR_BI_DIR; dir++)
>  	for(dir = 0; dir <= DIR_BI_DIR; dir++)
>  	{
> -		if(search_dir[dir] ==false )
> +		if (!search_dir[dir])
>  			continue;
>  		list_for_each_entry(pRet, psearch_list, List){
>  	//		IEEE80211_DEBUG(IEEE80211_DL_TS, "ADD:%pM, TID:%d, dir:%d\n", pRet->Addr, pRet->TSpec.f.TSInfo.field.ucTSID, pRet->TSpec.f.TSInfo.field.ucDirection);
> @@ -400,7 +400,7 @@ bool GetTs(
>  	}
>  	else
>  	{
> -		if(bAddNewTs == false)
> +		if (!bAddNewTs)
>  		{
>  			IEEE80211_DEBUG(IEEE80211_DL_TS, "add new TS failed(tid:%d)\n", UP);
>  			return false;

Here you should move the bracket up on the if-line.

> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index 7f0ace1..f84569b 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -2822,7 +2822,7 @@ static bool rtl8192_adapter_start(struct net_device *dev)
>  		}
>  		dm_initialize_txpower_tracking(dev);
>  
> -		if (priv->bDcut == true) {
> +		if (priv->bDcut) {
>  			u32 i, TempCCk;
>  			u32 tmpRegA = rtl8192_QueryBBReg(dev, rOFDM0_XATxIQImbalance, bMaskDWord);
>  			for (i = 0; i < TxBBGainTableLength; i++) {
> diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
> index 167d3b1..307e1d0 100644
> --- a/drivers/staging/rtl8192u/r8192U_dm.c
> +++ b/drivers/staging/rtl8192u/r8192U_dm.c
> @@ -562,7 +562,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)
>  					break;
>  				}
>  			}
> -			if (viviflag == true) {
> +			if (viviflag) {
>  				write_nic_byte(dev, 0x1ba, 0);
>  				viviflag = false;
>  				RT_TRACE(COMP_POWER_TRACKING, "we filtered the data\n");
> @@ -765,7 +765,7 @@ void dm_txpower_trackingcallback(struct work_struct *work)
>  	struct r8192_priv *priv = container_of(dwork, struct r8192_priv, txpower_tracking_wq);
>  	struct net_device *dev = priv->ieee80211->dev;
>  
> -	if (priv->bDcut == true)
> +	if (priv->bDcut)
>  		dm_TXPowerTrackingCallback_TSSI(dev);
>  	else
>  		dm_TXPowerTrackingCallback_ThermalMeter(dev);
> @@ -1300,7 +1300,7 @@ void dm_initialize_txpower_tracking(struct net_device *dev)
>  {
>  	struct r8192_priv *priv = ieee80211_priv(dev);
>  
> -	if (priv->bDcut == true)
> +	if (priv->bDcut)
>  		dm_InitializeTXPowerTracking_TSSI(dev);
>  	else
>  		dm_InitializeTXPowerTracking_ThermalMeter(dev);
> @@ -1356,7 +1356,7 @@ static void dm_check_txpower_tracking(struct net_device *dev)
>  #ifdef RTL8190P
>  	dm_CheckTXPowerTracking_TSSI(dev);
>  #else
> -	if (priv->bDcut == true)
> +	if (priv->bDcut)
>  		dm_CheckTXPowerTracking_TSSI(dev);
>  	else
>  		dm_CheckTXPowerTracking_ThermalMeter(dev);
> @@ -1466,7 +1466,7 @@ void dm_cck_txpower_adjust(struct net_device *dev, bool binch14)
>  {	/*  dm_CCKTxPowerAdjust */
>  	struct r8192_priv *priv = ieee80211_priv(dev);
>  
> -	if (priv->bDcut == true)
> +	if (priv->bDcut)
>  		dm_CCKTxPowerAdjust_TSSI(dev, binch14);
>  	else
>  		dm_CCKTxPowerAdjust_ThermalMeter(dev, binch14);
> @@ -3063,7 +3063,7 @@ static void dm_dynamic_txpower(struct net_device *dev)
>  			priv->bDynamicTxLowPower = false;
>  		} else {
>  			/* high power state check */
> -			if (priv->undecorated_smoothed_pwdb < txlowpower_threshold && priv->bDynamicTxHighPower == true)
> +			if (priv->undecorated_smoothed_pwdb < txlowpower_threshold && priv->bDynamicTxHighPower)
>  				priv->bDynamicTxHighPower = false;
>  
>  			/* low power state check */

Here you should also break down the line to keep it below 80 characters.

> diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c
> index 1a3a09f..aae30fc 100644
> --- a/drivers/staging/rtl8192u/r819xU_firmware.c
> +++ b/drivers/staging/rtl8192u/r819xU_firmware.c
> @@ -281,7 +281,7 @@ bool init_firmware(struct net_device *dev)
>  		if (rst_opt == OPT_SYSTEM_RESET)
>  			release_firmware(fw_entry);
>  
> -		if (rt_status != true)
> +		if (!rt_status)
>  			goto download_firmware_fail;
>  
>  		switch (init_step) {
> @@ -304,7 +304,7 @@ bool init_firmware(struct net_device *dev)
>  
>  			/* Check Put Code OK and Turn On CPU */
>  			rt_status = CPUcheck_maincodeok_turnonCPU(dev);
> -			if (rt_status != true) {
> +			if (!rt_status) {
>  				RT_TRACE(COMP_ERR, "CPUcheck_maincodeok_turnonCPU fail!\n");
>  				goto download_firmware_fail;
>  			}
> @@ -318,7 +318,7 @@ bool init_firmware(struct net_device *dev)
>  			mdelay(1);
>  
>  			rt_status = CPUcheck_firmware_ready(dev);
> -			if (rt_status != true) {
> +			if (!rt_status) {
>  				RT_TRACE(COMP_ERR, "CPUcheck_firmware_ready fail(%d)!\n",rt_status);
>  				goto download_firmware_fail;
>  			}
> diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c
> index 084e04f..3451ec7 100644
> --- a/drivers/staging/rtl8192u/r819xU_phy.c
> +++ b/drivers/staging/rtl8192u/r819xU_phy.c
> @@ -1099,7 +1099,7 @@ bool rtl8192_SetRFPowerState(struct net_device *dev,
>  	if (eRFPowerState == priv->ieee80211->eRFPowerState)
>  		return false;
>  
> -	if (priv->SetRFPowerStateInProgress == true)
> +	if (priv->SetRFPowerStateInProgress)
>  		return false;
>  
>  	priv->SetRFPowerStateInProgress = true;
> 



  reply	other threads:[~2015-03-05  1:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04 23:07 [PATCH] Staging: rtl8192u: Bool tests don't need comparisons Cristina Opriceana
2015-03-05  1:36 ` Jes Sorensen [this message]
2015-03-05  9:25   ` [Outreachy kernel] " Cristina Opriceana

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=54F7B301.8020203@gmail.com \
    --to=jes.sorensen@gmail.com \
    --cc=cristina.opriceana@gmail.com \
    --cc=outreachy-kernel@googlegroups.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.