[v4,3/3] Staging: rtl8188eu: Bool tests don't need comparisons
diff mbox series

Message ID 1442160279-6334-1-git-send-email-shraddha.6596@gmail.com
State New, archived
Headers show
Series
  • [v4,1/3] Staging: rtl8723au: core: Bool tests don't need comparisons
Related show

Commit Message

Shraddha Barke Sept. 13, 2015, 4:04 p.m. UTC
This patch removes comparisons to true/false values on bool variables.

Changes in v4-
 Remove unnecessary braces

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c       | 12 +++++------
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 28 +++++++++++++-------------
 2 files changed, 20 insertions(+), 20 deletions(-)

Comments

Julia Lawall Sept. 13, 2015, 4:18 p.m. UTC | #1
On Sun, 13 Sep 2015, Shraddha Barke wrote:

> This patch removes comparisons to true/false values on bool variables.
>
> Changes in v4-
>  Remove unnecessary braces

They are parentheses.  Braces are {}.

julia

> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
> ---
>  drivers/staging/rtl8188eu/core/rtw_cmd.c       | 12 +++++------
>  drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 28 +++++++++++++-------------
>  2 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c
> index 9dfe583..3952df3 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
> @@ -269,7 +269,7 @@ u8 rtw_sitesurvey_cmd(struct adapter  *padapter, struct ndis_802_11_ssid *ssid,
>  	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
>  	struct mlme_priv	*pmlmepriv = &padapter->mlmepriv;
>
> -	if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
> +	if (check_fwstate(pmlmepriv, _FW_LINKED))
>  		rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1);
>
>  	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> @@ -898,7 +898,7 @@ static void dynamic_chk_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz)
>  	pmlmepriv = &(padapter->mlmepriv);
>
>  #ifdef CONFIG_88EU_AP_MODE
> -	if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
> +	if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
>  		expire_timeout_chk(padapter);
>  #endif
>
> @@ -915,13 +915,13 @@ static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
>  	u8	mstatus;
>
>
> -	if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) ||
> -	    (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true))
> +	if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) ||
> +	    check_fwstate(pmlmepriv, WIFI_ADHOC_STATE))
>  		return;
>
>  	switch (lps_ctrl_type) {
>  	case LPS_CTRL_SCAN:
> -		if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
> +		if (check_fwstate(pmlmepriv, _FW_LINKED)) {
>  			/* connect */
>  			LPS_Leave(padapter);
>  		}
> @@ -1373,7 +1373,7 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter,  struct cmd_obj *
>
>  	spin_lock_bh(&pmlmepriv->lock);
>
> -	if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true))
> +	if (check_fwstate(pmlmepriv, WIFI_MP_STATE) && check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
>  		_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
>
>  	set_fwstate(pmlmepriv, _FW_LINKED);
> diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
> index 22f5b45..bc1bfb9 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
> @@ -89,7 +89,7 @@ u8 rtw_do_join(struct adapter *padapter)
>  			mod_timer(&pmlmepriv->assoc_timer,
>  				  jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
>  		} else {
> -			if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) {
> +			if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
>  				/*  submit createbss_cmd to change to a ADHOC_MASTER */
>
>  				/* pmlmepriv->lock has been acquired by caller... */
> @@ -162,7 +162,7 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
>
>
>  	DBG_88E("Set BSSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
> -	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
> +	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
>  		goto handle_tkip_countermeasure;
>  	else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
>  		goto release_mlme_lock;
> @@ -171,7 +171,7 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
>  		RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("set_bssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE\n"));
>
>  		if (!memcmp(&pmlmepriv->cur_network.network.MacAddress, bssid, ETH_ALEN)) {
> -			if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == false)
> +			if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE))
>  				goto release_mlme_lock;/* it means driver is in WIFI_ADHOC_MASTER_STATE, we needn't create bss again. */
>  		} else {
>  			RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("Set BSSID not the same bssid\n"));
> @@ -180,12 +180,12 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
>
>  			rtw_disassoc_cmd(padapter, 0, true);
>
> -			if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
> +			if (check_fwstate(pmlmepriv, _FW_LINKED))
>  				rtw_indicate_disconnect(padapter);
>
>  			rtw_free_assoc_resources(padapter);
>
> -			if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) {
> +			if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
>  				_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
>  				set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
>  			}
> @@ -248,9 +248,9 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
>  	spin_lock_bh(&pmlmepriv->lock);
>
>  	DBG_88E("Set SSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
> -	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
> +	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
>  		goto handle_tkip_countermeasure;
> -	else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true)
> +	else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
>  		goto release_mlme_lock;
>
>  	if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) {
> @@ -268,12 +268,12 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
>  					/* if in WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE, create bss or rejoin again */
>  					rtw_disassoc_cmd(padapter, 0, true);
>
> -					if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
> +					if (check_fwstate(pmlmepriv, _FW_LINKED))
>  						rtw_indicate_disconnect(padapter);
>
>  					rtw_free_assoc_resources(padapter);
>
> -					if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
> +					if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
>  						_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
>  						set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
>  					}
> @@ -290,12 +290,12 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
>
>  			rtw_disassoc_cmd(padapter, 0, true);
>
> -			if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
> +			if (check_fwstate(pmlmepriv, _FW_LINKED))
>  				rtw_indicate_disconnect(padapter);
>
>  			rtw_free_assoc_resources(padapter);
>
> -			if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
> +			if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
>  				_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
>  				set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
>  			}
> @@ -319,7 +319,7 @@ handle_tkip_countermeasure:
>  	memcpy(&pmlmepriv->assoc_ssid, ssid, sizeof(struct ndis_802_11_ssid));
>  	pmlmepriv->assoc_by_bssid = false;
>
> -	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
> +	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
>  		pmlmepriv->to_join = true;
>  	else
>  		status = rtw_do_join(padapter);
> @@ -369,7 +369,7 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter,
>  			rtw_free_assoc_resources(padapter);
>
>  		if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) {
> -			if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
> +			if (check_fwstate(pmlmepriv, _FW_LINKED))
>  				rtw_indicate_disconnect(padapter); /* will clr Linked_state; before this function, we must have checked whether  issue dis-assoc_cmd or not */
>  	       }
>
> @@ -450,7 +450,7 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s
>  		res = true;
>
>  		if (check_fwstate(pmlmepriv,
> -				(_FW_UNDER_SURVEY|_FW_UNDER_LINKING)) == true)
> +				(_FW_UNDER_SURVEY|_FW_UNDER_LINKING)))
>  			RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n###_FW_UNDER_SURVEY|_FW_UNDER_LINKING\n\n"));
>  		else
>  			RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n###pmlmepriv->sitesurveyctrl.traffic_busy == true\n\n"));
> --
> 2.1.4
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Patch
diff mbox series

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 9dfe583..3952df3 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -269,7 +269,7 @@  u8 rtw_sitesurvey_cmd(struct adapter  *padapter, struct ndis_802_11_ssid *ssid,
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
 	struct mlme_priv	*pmlmepriv = &padapter->mlmepriv;
 
-	if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
+	if (check_fwstate(pmlmepriv, _FW_LINKED))
 		rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1);
 
 	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
@@ -898,7 +898,7 @@  static void dynamic_chk_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz)
 	pmlmepriv = &(padapter->mlmepriv);
 
 #ifdef CONFIG_88EU_AP_MODE
-	if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
+	if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
 		expire_timeout_chk(padapter);
 #endif
 
@@ -915,13 +915,13 @@  static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
 	u8	mstatus;
 
 
-	if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) ||
-	    (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true))
+	if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) ||
+	    check_fwstate(pmlmepriv, WIFI_ADHOC_STATE))
 		return;
 
 	switch (lps_ctrl_type) {
 	case LPS_CTRL_SCAN:
-		if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
+		if (check_fwstate(pmlmepriv, _FW_LINKED)) {
 			/* connect */
 			LPS_Leave(padapter);
 		}
@@ -1373,7 +1373,7 @@  void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter,  struct cmd_obj *
 
 	spin_lock_bh(&pmlmepriv->lock);
 
-	if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true))
+	if (check_fwstate(pmlmepriv, WIFI_MP_STATE) && check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
 		_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
 
 	set_fwstate(pmlmepriv, _FW_LINKED);
diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
index 22f5b45..bc1bfb9 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
@@ -89,7 +89,7 @@  u8 rtw_do_join(struct adapter *padapter)
 			mod_timer(&pmlmepriv->assoc_timer,
 				  jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
 		} else {
-			if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) {
+			if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
 				/*  submit createbss_cmd to change to a ADHOC_MASTER */
 
 				/* pmlmepriv->lock has been acquired by caller... */
@@ -162,7 +162,7 @@  u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
 
 
 	DBG_88E("Set BSSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
-	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
+	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
 		goto handle_tkip_countermeasure;
 	else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
 		goto release_mlme_lock;
@@ -171,7 +171,7 @@  u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
 		RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("set_bssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE\n"));
 
 		if (!memcmp(&pmlmepriv->cur_network.network.MacAddress, bssid, ETH_ALEN)) {
-			if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == false)
+			if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE))
 				goto release_mlme_lock;/* it means driver is in WIFI_ADHOC_MASTER_STATE, we needn't create bss again. */
 		} else {
 			RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("Set BSSID not the same bssid\n"));
@@ -180,12 +180,12 @@  u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
 
 			rtw_disassoc_cmd(padapter, 0, true);
 
-			if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
+			if (check_fwstate(pmlmepriv, _FW_LINKED))
 				rtw_indicate_disconnect(padapter);
 
 			rtw_free_assoc_resources(padapter);
 
-			if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) {
+			if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
 				_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
 				set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
 			}
@@ -248,9 +248,9 @@  u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
 	spin_lock_bh(&pmlmepriv->lock);
 
 	DBG_88E("Set SSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
-	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
+	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
 		goto handle_tkip_countermeasure;
-	else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true)
+	else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
 		goto release_mlme_lock;
 
 	if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) {
@@ -268,12 +268,12 @@  u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
 					/* if in WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE, create bss or rejoin again */
 					rtw_disassoc_cmd(padapter, 0, true);
 
-					if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
+					if (check_fwstate(pmlmepriv, _FW_LINKED))
 						rtw_indicate_disconnect(padapter);
 
 					rtw_free_assoc_resources(padapter);
 
-					if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
+					if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
 						_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
 						set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
 					}
@@ -290,12 +290,12 @@  u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
 
 			rtw_disassoc_cmd(padapter, 0, true);
 
-			if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
+			if (check_fwstate(pmlmepriv, _FW_LINKED))
 				rtw_indicate_disconnect(padapter);
 
 			rtw_free_assoc_resources(padapter);
 
-			if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
+			if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
 				_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
 				set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
 			}
@@ -319,7 +319,7 @@  handle_tkip_countermeasure:
 	memcpy(&pmlmepriv->assoc_ssid, ssid, sizeof(struct ndis_802_11_ssid));
 	pmlmepriv->assoc_by_bssid = false;
 
-	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
+	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
 		pmlmepriv->to_join = true;
 	else
 		status = rtw_do_join(padapter);
@@ -369,7 +369,7 @@  u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter,
 			rtw_free_assoc_resources(padapter);
 
 		if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) {
-			if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
+			if (check_fwstate(pmlmepriv, _FW_LINKED))
 				rtw_indicate_disconnect(padapter); /* will clr Linked_state; before this function, we must have checked whether  issue dis-assoc_cmd or not */
 	       }
 
@@ -450,7 +450,7 @@  u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s
 		res = true;
 
 		if (check_fwstate(pmlmepriv,
-				(_FW_UNDER_SURVEY|_FW_UNDER_LINKING)) == true)
+				(_FW_UNDER_SURVEY|_FW_UNDER_LINKING)))
 			RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n###_FW_UNDER_SURVEY|_FW_UNDER_LINKING\n\n"));
 		else
 			RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n###pmlmepriv->sitesurveyctrl.traffic_busy == true\n\n"));