mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/4] Staging: rtl8723au: Bool tests don't need comparisons
@ 2015-09-12 11:05 Shraddha Barke
  2015-09-12 11:05 ` [PATCH v2 2/4] Staging: vt6656: " Shraddha Barke
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Shraddha Barke @ 2015-09-12 11:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jes Sorensen, Julia Lawall, linux-kernel
  Cc: Shraddha Barke

This patch removes comparisons to true/false values on bool variables.
Fixed using Coccinelle

Change in v2-
 Consider cases with false

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/rtl8723au/core/rtw_ap.c             | 4 ++--
 drivers/staging/rtl8723au/core/rtw_mlme_ext.c       | 4 ++--
 drivers/staging/rtl8723au/core/rtw_wlan_util.c      | 2 +-
 drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c | 6 +++---
 drivers/staging/rtl8723au/hal/rtl8723au_recv.c      | 2 +-
 drivers/staging/rtl8723au/hal/usb_halinit.c         | 2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
index 65b209a..bd1a306 100644
--- a/drivers/staging/rtl8723au/core/rtw_ap.c
+++ b/drivers/staging/rtl8723au/core/rtw_ap.c
@@ -409,7 +409,7 @@ void add_RATid23a(struct rtw_adapter *padapter, struct sta_info *psta, u8 rssi_l
 
 		arg |= BIT(7);/* support entry 2~31 */
 
-		if (shortGIrate == true)
+		if (shortGIrate)
 			arg |= BIT(5);
 
 		tx_ra_bitmap |= ((raid<<28)&0xf0000000);
@@ -424,7 +424,7 @@ void add_RATid23a(struct rtw_adapter *padapter, struct sta_info *psta, u8 rssi_l
 		/* arg[5] = Short GI */
 		rtl8723a_add_rateatid(padapter, tx_ra_bitmap, arg, rssi_level);
 
-		if (shortGIrate == true)
+		if (shortGIrate)
 			init_rate |= BIT(6);
 
 		/* set ra_id, init_rate */
diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
index be9a3d5..9cab19f 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c
@@ -4092,7 +4092,7 @@ static void rtw_site_survey(struct rtw_adapter *padapter)
 		/* turn on dynamic functions */
 		rtl8723a_odm_support_ability_restore(padapter);
 
-		if (is_client_associated_to_ap23a(padapter) == true)
+		if (is_client_associated_to_ap23a(padapter))
 			issue_nulldata23a(padapter, NULL, 0, 3, 500);
 
 		rtl8723a_mlme_sitesurvey(padapter, 0);
@@ -5195,7 +5195,7 @@ void linked_status_chk23a(struct rtw_adapter *padapter)
 		if (psta) {
 			bool is_p2p_enable = false;
 
-			if (chk_ap_is_alive(padapter, psta) == false)
+			if (!chk_ap_is_alive(padapter, psta))
 				rx_chk = _FAIL;
 
 			if (pxmitpriv->last_tx_pkts == pxmitpriv->tx_pkts)
diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
index 3c1315fc..208b24d 100644
--- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
@@ -231,7 +231,7 @@ static unsigned int ratetbl2rateset(struct rtw_adapter *padapter,
 		default:
 			rate = ratetbl_val_2wifirate(rate);
 
-			if (is_basicrate(padapter, rate) == true)
+			if (is_basicrate(padapter, rate))
 				rate |= IEEE80211_BASIC_RATE_MASK;
 
 			rateset[len] = rate;
diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
index cf15f80..503231c 100644
--- a/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
+++ b/drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
@@ -5192,7 +5192,7 @@ static void btdm_NotifyFwScan(struct rtw_adapter *padapter, u8 scanType)
 {
 	u8 H2C_Parameter[1] = {0};
 
-	if (scanType == true)
+	if (scanType)
 		H2C_Parameter[0] = 0x1;
 
 	RTPRINT(FBT, BT_TRACE, ("[BTCoex], Notify FW for wifi scan, write 0x3b = 0x%02x\n",
@@ -9141,7 +9141,7 @@ u8 BTDM_IsWifiConnectionExist(struct rtw_adapter *padapter)
 	if (BTHCI_HsConnectionEstablished(padapter))
 		bRet = true;
 
-	if (check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE) == true)
+	if (check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE))
 		bRet = true;
 
 	return bRet;
@@ -9945,7 +9945,7 @@ void BTDM_CheckBTIdleChange1Ant(struct rtw_adapter *padapter)
 	}
 	if (!pBtMgnt->ExtConfig.bBTBusy) {
 		RTPRINT(FBT, BT_TRACE, ("[DM][BT], BT is idle or disable\n"));
-		if (check_fwstate(&padapter->mlmepriv, WIFI_UNDER_LINKING|WIFI_SITE_MONITOR) == true)
+		if (check_fwstate(&padapter->mlmepriv, WIFI_UNDER_LINKING | WIFI_SITE_MONITOR))
 			BTDM_SetAntenna(padapter, BTDM_ANT_WIFI);
 	}
 }
diff --git a/drivers/staging/rtl8723au/hal/rtl8723au_recv.c b/drivers/staging/rtl8723au/hal/rtl8723au_recv.c
index 0fec84b..7acd8ae 100644
--- a/drivers/staging/rtl8723au/hal/rtl8723au_recv.c
+++ b/drivers/staging/rtl8723au/hal/rtl8723au_recv.c
@@ -231,7 +231,7 @@ void update_recvframe_phyinfo(struct recv_frame *precvframe,
 
 	pkt_info.StationID = 0xFF;
 	if (pkt_info.bPacketBeacon) {
-		if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE) == true)
+		if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE))
 			sa = padapter->mlmepriv.cur_network.network.MacAddress;
 		/* to do Ad-hoc */
 	} else {
diff --git a/drivers/staging/rtl8723au/hal/usb_halinit.c b/drivers/staging/rtl8723au/hal/usb_halinit.c
index 9926b07..f2d3f54 100644
--- a/drivers/staging/rtl8723au/hal/usb_halinit.c
+++ b/drivers/staging/rtl8723au/hal/usb_halinit.c
@@ -1256,7 +1256,7 @@ void rtl8723a_update_ramask(struct rtw_adapter *padapter,
 	arg = mac_id & 0x1f;/* MACID */
 	arg |= BIT(7);
 
-	if (shortGIrate == true)
+	if (shortGIrate)
 		arg |= BIT(5);
 
 	DBG_8723A("update raid entry, mask = 0x%x, arg = 0x%x\n", mask, arg);
-- 
2.1.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 2/4] Staging: vt6656: Bool tests don't need comparisons
  2015-09-12 11:05 [PATCH v2 1/4] Staging: rtl8723au: Bool tests don't need comparisons Shraddha Barke
@ 2015-09-12 11:05 ` Shraddha Barke
  2015-09-12 11:05 ` [PATCH v2 3/4] Staging: rtl8712: " Shraddha Barke
  2015-09-12 11:05 ` [PATCH v2 4/4] Staging: rtl8188eu: " Shraddha Barke
  2 siblings, 0 replies; 5+ messages in thread
From: Shraddha Barke @ 2015-09-12 11:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jes Sorensen, Julia Lawall, linux-kernel
  Cc: Shraddha Barke

This patch removes comparisons to true/false values on bool variables.
Fix made using Coccinelle

Change in v2-
 Fixing logical error

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/vt6656/wcmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c
index 3cbf479..c8e69ff 100644
--- a/drivers/staging/vt6656/wcmd.c
+++ b/drivers/staging/vt6656/wcmd.c
@@ -177,7 +177,7 @@ int vnt_schedule_command(struct vnt_private *priv, enum vnt_cmd command)
 	ADD_ONE_WITH_WRAP_AROUND(priv->cmd_enqueue_idx, CMD_Q_SIZE);
 	priv->free_cmd_queue--;
 
-	if (priv->cmd_running == false)
+	if (!priv->cmd_running)
 		vnt_cmd_complete(priv);
 
 	return true;
-- 
2.1.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 3/4] Staging: rtl8712: Bool tests don't need comparisons
  2015-09-12 11:05 [PATCH v2 1/4] Staging: rtl8723au: Bool tests don't need comparisons Shraddha Barke
  2015-09-12 11:05 ` [PATCH v2 2/4] Staging: vt6656: " Shraddha Barke
@ 2015-09-12 11:05 ` Shraddha Barke
  2015-09-12 11:50   ` Sudip Mukherjee
  2015-09-12 11:05 ` [PATCH v2 4/4] Staging: rtl8188eu: " Shraddha Barke
  2 siblings, 1 reply; 5+ messages in thread
From: Shraddha Barke @ 2015-09-12 11:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jes Sorensen, Julia Lawall, linux-kernel
  Cc: Shraddha Barke

This patch removes comparisons to true/false values on bool variables.
Fix made using Coccinelle

Changes in v2-
 More instances covered

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/rtl8712/rtl871x_ioctl_set.c | 24 ++++-----
 drivers/staging/rtl8712/rtl871x_mlme.c      | 77 ++++++++++++++---------------
 2 files changed, 50 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
index 22262b3..fd78941 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c
@@ -136,12 +136,12 @@ u8 r8712_set_802_11_bssid(struct _adapter *padapter, u8 *bssid)
 	}
 	spin_lock_irqsave(&pmlmepriv->lock, irqL);
 	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY |
-	    _FW_UNDER_LINKING) == true) {
+	    _FW_UNDER_LINKING)) {
 		status = check_fwstate(pmlmepriv, _FW_UNDER_LINKING);
 		goto _Abort_Set_BSSID;
 	}
 	if (check_fwstate(pmlmepriv,
-	    _FW_LINKED|WIFI_ADHOC_MASTER_STATE) == true) {
+	    _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) {
 		if (!memcmp(&pmlmepriv->cur_network.network.MacAddress, bssid,
 		    ETH_ALEN)) {
 			if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE))
@@ -149,7 +149,7 @@ u8 r8712_set_802_11_bssid(struct _adapter *padapter, u8 *bssid)
 						* WIFI_ADHOC_MASTER_STATE */
 		} else {
 			r8712_disassoc_cmd(padapter);
-			if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
+			if (check_fwstate(pmlmepriv, _FW_LINKED))
 				r8712_ind_disconnect(padapter);
 			r8712_free_assoc_resources(padapter);
 			if ((check_fwstate(pmlmepriv,
@@ -197,7 +197,7 @@ void r8712_set_802_11_ssid(struct _adapter *padapter,
 					 */
 					r8712_disassoc_cmd(padapter);
 					if (check_fwstate(pmlmepriv,
-					    _FW_LINKED) == true)
+					    _FW_LINKED))
 						r8712_ind_disconnect(padapter);
 					r8712_free_assoc_resources(padapter);
 					if (check_fwstate(pmlmepriv,
@@ -213,18 +213,18 @@ void r8712_set_802_11_ssid(struct _adapter *padapter,
 			}
 		} else {
 			r8712_disassoc_cmd(padapter);
-			if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
+			if (check_fwstate(pmlmepriv, _FW_LINKED))
 				r8712_ind_disconnect(padapter);
 			r8712_free_assoc_resources(padapter);
 			if (check_fwstate(pmlmepriv,
-			    WIFI_ADHOC_MASTER_STATE) == true) {
+			    WIFI_ADHOC_MASTER_STATE)) {
 				_clr_fwstate_(pmlmepriv,
 					      WIFI_ADHOC_MASTER_STATE);
 				set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
 			}
 		}
 	}
-	if (padapter->securitypriv.btkip_countermeasure == true)
+	if (padapter->securitypriv.btkip_countermeasure)
 		goto _Abort_Set_SSID;
 	if (!validate_ssid(ssid))
 		goto _Abort_Set_SSID;
@@ -248,13 +248,13 @@ void r8712_set_802_11_infrastructure_mode(struct _adapter *padapter,
 
 	if (*pold_state != networktype) {
 		spin_lock_irqsave(&pmlmepriv->lock, irqL);
-		if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) ||
+		if ((check_fwstate(pmlmepriv, _FW_LINKED)) ||
 		    (*pold_state == Ndis802_11IBSS))
 			r8712_disassoc_cmd(padapter);
 		if (check_fwstate(pmlmepriv,
-		    _FW_LINKED|WIFI_ADHOC_MASTER_STATE) == true)
+		    _FW_LINKED | WIFI_ADHOC_MASTER_STATE))
 			r8712_free_assoc_resources(padapter);
-		if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) ||
+		if ((check_fwstate(pmlmepriv, _FW_LINKED)) ||
 		    (*pold_state == Ndis802_11Infrastructure) ||
 		    (*pold_state == Ndis802_11IBSS)) {
 			/* will clr Linked_state before this function,
@@ -291,7 +291,7 @@ u8 r8712_set_802_11_disassociate(struct _adapter *padapter)
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
 	spin_lock_irqsave(&pmlmepriv->lock, irqL);
-	if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
+	if (check_fwstate(pmlmepriv, _FW_LINKED)) {
 		r8712_disassoc_cmd(padapter);
 		r8712_ind_disconnect(padapter);
 		r8712_free_assoc_resources(padapter);
@@ -313,7 +313,7 @@ u8 r8712_set_802_11_bssid_list_scan(struct _adapter *padapter)
 		return false;
 	spin_lock_irqsave(&pmlmepriv->lock, irqL);
 	if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING)) ||
-	    (pmlmepriv->sitesurveyctrl.traffic_busy == true)) {
+	    (pmlmepriv->sitesurveyctrl.traffic_busy)) {
 		/* Scan or linking is in progress, do nothing. */
 		ret = (u8)check_fwstate(pmlmepriv, _FW_UNDER_SURVEY);
 	} else {
diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index fc5dbea..32102ee 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -110,7 +110,7 @@ static void _free_network(struct mlme_priv *pmlmepriv,
 
 	if (pnetwork == NULL)
 		return;
-	if (pnetwork->fixed == true)
+	if (pnetwork->fixed)
 		return;
 	curr_time = jiffies;
 	delta_time = (curr_time - (u32)pnetwork->last_scanned) / HZ;
@@ -130,7 +130,7 @@ static void _free_network_nolock(struct mlme_priv *pmlmepriv,
 
 	if (pnetwork == NULL)
 		return;
-	if (pnetwork->fixed == true)
+	if (pnetwork->fixed)
 		return;
 	list_del_init(&pnetwork->list);
 	list_add_tail(&pnetwork->list, &free_queue->queue);
@@ -189,7 +189,7 @@ sint r8712_if_up(struct _adapter *padapter)
 	sint res;
 
 	if (padapter->bDriverStopped || padapter->bSurpriseRemoved ||
-	    (check_fwstate(&padapter->mlmepriv, _FW_LINKED) == false)) {
+	    (!check_fwstate(&padapter->mlmepriv, _FW_LINKED))) {
 		res = false;
 	} else
 		res = true;
@@ -392,7 +392,7 @@ static void update_scanned_network(struct _adapter *adapter,
 	plist = phead->next;
 
 	while (1) {
-		if (end_of_queue_search(phead, plist) == true)
+		if (end_of_queue_search(phead, plist))
 			break;
 
 		pnetwork = LIST_CONTAINOR(plist, struct wlan_network, list);
@@ -409,7 +409,7 @@ static void update_scanned_network(struct _adapter *adapter,
 
 	/* If we didn't find a match, then get a new network slot to initialize
 	 * with this beacon's information */
-	if (end_of_queue_search(phead, plist) == true) {
+	if (end_of_queue_search(phead, plist)) {
 		if (list_empty(&pmlmepriv->free_bss_pool.queue)) {
 			/* If there are no more slots, expire the oldest */
 			pnetwork = oldest;
@@ -468,10 +468,10 @@ static int is_desired_network(struct _adapter *adapter,
 	int bselected = true;
 	struct	security_priv *psecuritypriv = &adapter->securitypriv;
 
-	if (psecuritypriv->wps_phase == true) {
+	if (psecuritypriv->wps_phase) {
 		if (r8712_get_wps_ie(pnetwork->network.IEs,
 		    pnetwork->network.IELength, wps_ie,
-		    &wps_ielen) == true)
+		    &wps_ielen))
 			return true;
 		else
 			return false;
@@ -479,7 +479,7 @@ static int is_desired_network(struct _adapter *adapter,
 	if ((psecuritypriv->PrivacyAlgrthm != _NO_PRIVACY_) &&
 		    (pnetwork->network.Privacy == 0))
 		bselected = false;
-	if (check_fwstate(&adapter->mlmepriv, WIFI_ADHOC_STATE) == true) {
+	if (check_fwstate(&adapter->mlmepriv, WIFI_ADHOC_STATE)) {
 		if (pnetwork->network.InfrastructureMode !=
 			adapter->mlmepriv.cur_network.network.
 			InfrastructureMode)
@@ -533,7 +533,7 @@ void r8712_survey_event_callback(struct _adapter *adapter, u8 *pbuf)
 		return;
 	spin_lock_irqsave(&pmlmepriv->lock2, flags);
 	/* update IBSS_network 's timestamp */
-	if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
+	if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
 		if (!memcmp(&(pmlmepriv->cur_network.network.MacAddress),
 		    pnetwork->MacAddress, ETH_ALEN)) {
 			struct wlan_network *ibss_wlan = NULL;
@@ -551,7 +551,7 @@ void r8712_survey_event_callback(struct _adapter *adapter, u8 *pbuf)
 		}
 	}
 	/* lock pmlmepriv->lock when you accessing network_q */
-	if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == false) {
+	if (!check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
 		if (pnetwork->Ssid.Ssid[0] != 0)
 			rtl8711_add_network(adapter, pnetwork);
 		else {
@@ -571,15 +571,15 @@ void r8712_surveydone_event_callback(struct _adapter *adapter, u8 *pbuf)
 
 	spin_lock_irqsave(&pmlmepriv->lock, irqL);
 
-	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) {
+	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) {
 		del_timer(&pmlmepriv->scan_to_timer);
 
 		_clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY);
 	}
 
-	if (pmlmepriv->to_join == true) {
-		if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) {
-			if (check_fwstate(pmlmepriv, _FW_LINKED) == false) {
+	if (pmlmepriv->to_join) {
+		if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
+			if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
 				set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
 
 				if (r8712_select_and_join_from_scan(pmlmepriv)
@@ -679,7 +679,7 @@ void r8712_ind_disconnect(struct _adapter *padapter)
 {
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
-	if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
+	if (check_fwstate(pmlmepriv, _FW_LINKED)) {
 		_clr_fwstate_(pmlmepriv, _FW_LINKED);
 		padapter->ledpriv.LedControlHandler(padapter, LED_CTL_NO_LINK);
 		r8712_os_indicate_disconnect(padapter);
@@ -764,10 +764,10 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 	if (pnetwork->network.Length > sizeof(struct wlan_bssid_ex))
 		goto ignore_joinbss_callback;
 	if (pnetwork->join_res > 0) {
-		if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) {
+		if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
 			/*s1. find ptarget_wlan*/
-			if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
-				if (the_same_macaddr == true)
+			if (check_fwstate(pmlmepriv, _FW_LINKED)) {
+				if (the_same_macaddr)
 					ptarget_wlan =
 					    r8712_find_network(&pmlmepriv->
 					    scanned_queue,
@@ -813,7 +813,7 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 
 			/*s2. find ptarget_sta & update ptarget_sta*/
 			if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
-				if (the_same_macaddr == true) {
+				if (the_same_macaddr) {
 					ptarget_sta =
 						 r8712_get_stainfo(pstapriv,
 						 pnetwork->network.MacAddress);
@@ -897,14 +897,13 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 			update_ht_cap(adapter, cur_network->network.IEs,
 				      cur_network->network.IELength);
 			/*indicate connect*/
-			if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)
-				== true)
+			if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
 				r8712_indicate_connect(adapter);
 			del_timer(&pmlmepriv->assoc_timer);
 		} else
 			goto ignore_joinbss_callback;
 	} else {
-		if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) {
+		if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
 			mod_timer(&pmlmepriv->assoc_timer,
 				  jiffies + msecs_to_jiffies(1));
 			_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
@@ -924,7 +923,7 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf)
 	struct stassoc_event *pstassoc	= (struct stassoc_event *)pbuf;
 
 	/* to do: */
-	if (r8712_access_ctrl(&adapter->acl_list, pstassoc->macaddr) == false)
+	if (!r8712_access_ctrl(&adapter->acl_list, pstassoc->macaddr))
 		return;
 	psta = r8712_get_stainfo(&adapter->stapriv, pstassoc->macaddr);
 	if (psta != NULL) {
@@ -946,8 +945,8 @@ void r8712_stassoc_event_callback(struct _adapter *adapter, u8 *pbuf)
 		psta->XPrivacy = adapter->securitypriv.PrivacyAlgrthm;
 	psta->ieee8021x_blocked = false;
 	spin_lock_irqsave(&pmlmepriv->lock, irqL);
-	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))) {
 		if (adapter->stapriv.asoc_sta_count == 2) {
 			/* a sta + bc/mc_stainfo (not Ibss_stainfo) */
 			r8712_indicate_connect(adapter);
@@ -969,7 +968,7 @@ void r8712_stadel_event_callback(struct _adapter *adapter, u8 *pbuf)
 	struct wlan_network *tgt_network = &pmlmepriv->cur_network;
 
 	spin_lock_irqsave(&pmlmepriv->lock, irqL2);
-	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) {
+	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
 		r8712_ind_disconnect(adapter);
 		r8712_free_assoc_resources(adapter);
 	}
@@ -1046,7 +1045,7 @@ void r8712_got_addbareq_event_callback(struct _adapter *adapter, u8 *pbuf)
 
 void r8712_wpspbc_event_callback(struct _adapter *adapter, u8 *pbuf)
 {
-	if (adapter->securitypriv.wps_hw_pbc_pressed == false)
+	if (!adapter->securitypriv.wps_hw_pbc_pressed)
 		adapter->securitypriv.wps_hw_pbc_pressed = true;
 }
 
@@ -1081,7 +1080,7 @@ void _r8712_join_timeout_handler(struct _adapter *adapter)
 	spin_lock_irqsave(&pmlmepriv->lock, irqL);
 	_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
 	pmlmepriv->to_join = false;
-	if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
+	if (check_fwstate(pmlmepriv, _FW_LINKED)) {
 		r8712_os_indicate_disconnect(adapter);
 		_clr_fwstate_(pmlmepriv, _FW_LINKED);
 	}
@@ -1131,9 +1130,9 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
 	phead = &queue->queue;
 	pmlmepriv->pscanned = phead->next;
 	while (1) {
-		if (end_of_queue_search(phead, pmlmepriv->pscanned) == true) {
-			if ((pmlmepriv->assoc_by_rssi == true) &&
-			    (pnetwork_max_rssi != NULL)) {
+		if (end_of_queue_search(phead, pmlmepriv->pscanned)) {
+			if ((pmlmepriv->assoc_by_rssi) &&
+			    (pnetwork_max_rssi))
 				pnetwork = pnetwork_max_rssi;
 				goto ask_for_joinbss;
 			}
@@ -1144,7 +1143,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
 		if (pnetwork == NULL)
 			return _FAIL;
 		pmlmepriv->pscanned = pmlmepriv->pscanned->next;
-		if (pmlmepriv->assoc_by_bssid == true) {
+		if (pmlmepriv->assoc_by_bssid) {
 			dst_ssid = pnetwork->network.MacAddress;
 			src_ssid = pmlmepriv->assoc_bssid;
 			if (!memcmp(dst_ssid, src_ssid, ETH_ALEN)) {
@@ -1172,7 +1171,7 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
 		    pmlmepriv->assoc_ssid.SsidLength) &&
 		    (!memcmp(dst_ssid, src_ssid,
 		     pmlmepriv->assoc_ssid.SsidLength))) {
-			if (pmlmepriv->assoc_by_rssi == true) {
+			if (pmlmepriv->assoc_by_rssi) {
 				/* if the ssid is the same, select the bss
 				 *  which has the max rssi*/
 				if (pnetwork_max_rssi) {
@@ -1429,7 +1428,7 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie,
 		cnt += in_ie[cnt+1] + 2; /*get next*/
 	}
 	/*restruct WPA IE or WPA2 IE in sec_ie[] */
-	if (match == true) {
+	if (match) {
 		if (sec_ie[0] == _WPA_IE_ID_) {
 			/* parsing SSN IE to select required encryption
 			 * algorithm, and set the bc/mc encryption algorithm */
@@ -1566,7 +1565,7 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie,
 		memcpy(out_ie, in_ie, 12);
 		ielength = 12;
 		/*copy RSN or SSN*/
-		if (match == true) {
+		if (match) {
 			memcpy(&out_ie[ielength], &sec_ie[0], sec_ie[1]+2);
 			ielength += sec_ie[1] + 2;
 			if (authmode == _WPA2_IE_ID_) {
@@ -1580,7 +1579,7 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie,
 		/*copy fixed ie only*/
 		memcpy(out_ie, in_ie, 12);
 		ielength = 12;
-		if (psecuritypriv->wps_phase == true) {
+		if (psecuritypriv->wps_phase) {
 			memcpy(out_ie+ielength, psecuritypriv->wps_ie,
 				psecuritypriv->wps_ie_len);
 			ielength += psecuritypriv->wps_ie_len;
@@ -1738,7 +1737,7 @@ static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len)
 	if (!phtpriv->ht_option)
 		return;
 	/* maybe needs check if ap supports rx ampdu. */
-	if ((phtpriv->ampdu_enable == false) &&
+	if ((!phtpriv->ampdu_enable) &&
 	    (pregistrypriv->ampdu_enable == 1))
 		phtpriv->ampdu_enable = true;
 	/*check Max Rx A-MPDU Size*/
@@ -1788,8 +1787,8 @@ void r8712_issue_addbareq_cmd(struct _adapter *padapter, int priority)
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct ht_priv	 *phtpriv = &pmlmepriv->htpriv;
 
-	if ((phtpriv->ht_option == 1) && (phtpriv->ampdu_enable == true)) {
-		if (phtpriv->baddbareq_issued[priority] == false) {
+	if ((phtpriv->ht_option == 1) && (phtpriv->ampdu_enable)) {
+		if (!phtpriv->baddbareq_issued[priority]) {
 			r8712_addbareq_cmd(padapter, (u8)priority);
 			phtpriv->baddbareq_issued[priority] = true;
 		}
-- 
2.1.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 4/4] Staging: rtl8188eu: Bool tests don't need comparisons
  2015-09-12 11:05 [PATCH v2 1/4] Staging: rtl8723au: Bool tests don't need comparisons Shraddha Barke
  2015-09-12 11:05 ` [PATCH v2 2/4] Staging: vt6656: " Shraddha Barke
  2015-09-12 11:05 ` [PATCH v2 3/4] Staging: rtl8712: " Shraddha Barke
@ 2015-09-12 11:05 ` Shraddha Barke
  2 siblings, 0 replies; 5+ messages in thread
From: Shraddha Barke @ 2015-09-12 11:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jes Sorensen, Julia Lawall, linux-kernel
  Cc: Shraddha Barke

This patch removes comparisons to true/false values on bool variables.
Fix made using Coccinelle

Changes in v2-
 Included more instances of true and false

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 | 26 +++++++++++++-------------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 001a2f3..591ac5d 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -272,7 +272,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);
@@ -903,7 +903,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
 
@@ -920,13 +920,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);
 		}
@@ -1384,7 +1384,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..8ba2689 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 */
 	       }
 
-- 
2.1.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 3/4] Staging: rtl8712: Bool tests don't need comparisons
  2015-09-12 11:05 ` [PATCH v2 3/4] Staging: rtl8712: " Shraddha Barke
@ 2015-09-12 11:50   ` Sudip Mukherjee
  0 siblings, 0 replies; 5+ messages in thread
From: Sudip Mukherjee @ 2015-09-12 11:50 UTC (permalink / raw)
  To: Shraddha Barke
  Cc: Greg Kroah-Hartman, Jes Sorensen, Julia Lawall, linux-kernel

On Sat, Sep 12, 2015 at 04:35:30PM +0530, Shraddha Barke wrote:
> This patch removes comparisons to true/false values on bool variables.
> Fix made using Coccinelle
> 
> Changes in v2-
>  More instances covered
> 
> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
> ---
You have not even build tested before sending.
>  drivers/staging/rtl8712/rtl871x_ioctl_set.c | 24 ++++-----
>  drivers/staging/rtl8712/rtl871x_mlme.c      | 77 ++++++++++++++---------------
>  2 files changed, 50 insertions(+), 51 deletions(-)
<snip>	
> 
> @@ -1131,9 +1130,9 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
>  	phead = &queue->queue;
>  	pmlmepriv->pscanned = phead->next;
>  	while (1) {
> -		if (end_of_queue_search(phead, pmlmepriv->pscanned) == true) {
> -			if ((pmlmepriv->assoc_by_rssi == true) &&
> -			    (pnetwork_max_rssi != NULL)) {
> +		if (end_of_queue_search(phead, pmlmepriv->pscanned)) {
> +			if ((pmlmepriv->assoc_by_rssi) &&
> +			    (pnetwork_max_rssi))
Coccinelle will not remove the opening brace.

And in one part of the patch one test for !=NULL was modified.

regards
sudip

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-12 11:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-12 11:05 [PATCH v2 1/4] Staging: rtl8723au: Bool tests don't need comparisons Shraddha Barke
2015-09-12 11:05 ` [PATCH v2 2/4] Staging: vt6656: " Shraddha Barke
2015-09-12 11:05 ` [PATCH v2 3/4] Staging: rtl8712: " Shraddha Barke
2015-09-12 11:50   ` Sudip Mukherjee
2015-09-12 11:05 ` [PATCH v2 4/4] Staging: rtl8188eu: " Shraddha Barke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®