Skip to contentSkip to conversation

staging: code cleanup

PATCH In review Luis de Bethencourt 2 participants 6 messages Oct 19, 2015 – Oct 24, 2015 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover staging: code cleanup

Hi,

I initially submitted a patch to remove all the explicit boolean comparisons in rtl8712. These code changes included two instances where braces needed to be added to clean the output of checkpatch.pl on this patch.

Mike Rapaport correctly pointed out those changes had to go in a separate patch. Not wanting to only fix those two instances, but cover the whole rtl8712, I've added a second patch fixing these.

The checkpatch.pl of the second patch included some checks about needing spaces around operands. Including this fix as well for a nicer checkpatch.pl output. Plus also making it cover all rtl8712.

In other words, these are a series of recursive cleanup changes.

Thanks for the review Mike,
Luis

Luis de Bethencourt (3):
staging: rtl8712: Remove boolean comparisons
staging: rtl8712: braces should be used on all arms
staging: rtl8712: spaces preferred around operands

 drivers/staging/rtl8712/hal_init.c            |  11 +-
 drivers/staging/rtl8712/ieee80211.c           |  36 ++---
 drivers/staging/rtl8712/mlme_linux.c          |   2 +-
 drivers/staging/rtl8712/os_intfs.c            |   6 +-
 drivers/staging/rtl8712/rtl8712_cmd.c         |  27 ++--
 drivers/staging/rtl8712/rtl8712_efuse.c       | 138 ++++++++++---------
 drivers/staging/rtl8712/rtl8712_io.c          |   6 +-
 drivers/staging/rtl8712/rtl8712_led.c         | 187 +++++++++++++-------------
 drivers/staging/rtl8712/rtl8712_recv.c        |  53 ++++----
 drivers/staging/rtl8712/rtl8712_xmit.c        |  74 +++++-----
 drivers/staging/rtl8712/rtl871x_cmd.c         |  25 ++--
 drivers/staging/rtl8712/rtl871x_eeprom.c      |  22 +--
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 153 +++++++++++----------
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c   |  53 +++++---
 drivers/staging/rtl8712/rtl871x_ioctl_set.c   |  33 ++---
 drivers/staging/rtl8712/rtl871x_mlme.c        | 144 ++++++++++----------
 drivers/staging/rtl8712/rtl871x_mlme.h        |   2 +-
 drivers/staging/rtl8712/rtl871x_mp.c          |  23 ++--
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c    |  38 +++---
 drivers/staging/rtl8712/rtl871x_pwrctrl.c     |   6 +-
 drivers/staging/rtl8712/rtl871x_recv.c        |  70 +++++-----
 drivers/staging/rtl8712/rtl871x_security.c    | 133 +++++++++---------
 drivers/staging/rtl8712/rtl871x_sta_mgt.c     |  10 +-
 drivers/staging/rtl8712/rtl871x_xmit.c        |  95 ++++++-------
 drivers/staging/rtl8712/usb_halinit.c         |  13 +-
 drivers/staging/rtl8712/usb_intf.c            |  17 +--
 drivers/staging/rtl8712/usb_ops.c             |  20 +--
 drivers/staging/rtl8712/usb_ops_linux.c       |  20 +--
 drivers/staging/rtl8712/xmit_linux.c          |   4 +-
 29 files changed, 753 insertions(+), 668 deletions(-)
Signature · 1 line
2.5.3
#1 lore raw

PATCH v2 1/3 staging: rtl8712: Remove boolean comparisons

Boolean tests do not need explicit comparison to true or false.

---
 drivers/staging/rtl8712/os_intfs.c            |   4 +-
 drivers/staging/rtl8712/rtl8712_cmd.c         |   9 +-
 drivers/staging/rtl8712/rtl8712_efuse.c       |  56 ++++-----
 drivers/staging/rtl8712/rtl8712_io.c          |   6 +-
 drivers/staging/rtl8712/rtl8712_led.c         | 164 +++++++++++++-------------
 drivers/staging/rtl8712/rtl8712_recv.c        |  25 ++--
 drivers/staging/rtl8712/rtl8712_xmit.c        |   4 +-
 drivers/staging/rtl8712/rtl871x_cmd.c         |   8 +-
 drivers/staging/rtl8712/rtl871x_eeprom.c      |  22 ++--
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c |  56 ++++-----
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c   |  12 +-
 drivers/staging/rtl8712/rtl871x_ioctl_set.c   |  26 ++--
 drivers/staging/rtl8712/rtl871x_mlme.c        |  77 ++++++------
 drivers/staging/rtl8712/rtl871x_mlme.h        |   2 +-
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c    |  16 +--
 drivers/staging/rtl8712/rtl871x_pwrctrl.c     |   6 +-
 drivers/staging/rtl8712/rtl871x_recv.c        |  39 +++---
 drivers/staging/rtl8712/rtl871x_security.c    |   4 +-
 drivers/staging/rtl8712/rtl871x_sta_mgt.c     |   6 +-
 drivers/staging/rtl8712/rtl871x_xmit.c        |  38 +++---
 drivers/staging/rtl8712/usb_intf.c            |   4 +-
 drivers/staging/rtl8712/usb_ops_linux.c       |  10 +-
 drivers/staging/rtl8712/xmit_linux.c          |   4 +-
 23 files changed, 291 insertions(+), 307 deletions(-)
drivers/staging/rtl8712/os_intfs.c +2 -2
index 6805f79..92ab59d 100644
@@ -177,7 +177,7 @@ static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p)
 	struct _adapter *padapter = netdev_priv(pnetdev);
 	struct sockaddr *addr = p;
 
-	if (padapter->bup == false)
+	if (!padapter->bup)
 		ether_addr_copy(pnetdev->dev_addr, addr->sa_data);
 	return 0;
 }
@@ -384,7 +384,7 @@ static int netdev_open(struct net_device *pnetdev)
 	struct _adapter *padapter = netdev_priv(pnetdev);
 
 	mutex_lock(&padapter->mutex_start);
-	if (padapter->bup == false) {
+	if (!padapter->bup) {
 		padapter->bDriverStopped = false;
 		padapter->bSurpriseRemoved = false;
 		padapter->bup = true;
drivers/staging/rtl8712/rtl8712_cmd.c +4 -5
index f70235c..39b6320 100644
@@ -85,7 +85,7 @@ static void query_fw_rx_phy_status(struct _adapter *padapter)
 	u32 val32 = 0;
 	int pollingcnts = 50;
 
-	if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) == true) {
+	if (check_fwstate(&padapter->mlmepriv, _FW_LINKED)) {
 		r8712_write32(padapter, IOCMD_CTRL_REG, 0xf4000001);
 		msleep(100);
 		/* Wait FW complete IO Cmd */
@@ -324,8 +324,7 @@ int r8712_cmd_thread(void *context)
 	while (1) {
 		if ((_down_sema(&(pcmdpriv->cmd_queue_sema))) == _FAIL)
 			break;
-		if ((padapter->bDriverStopped == true) ||
-		    (padapter->bSurpriseRemoved == true))
+		if (padapter->bDriverStopped || padapter->bSurpriseRemoved)
 			break;
 		if (r8712_register_cmd_alive(padapter) != _SUCCESS)
 			continue;
@@ -375,8 +374,8 @@ _next:
 			pcmdbuf += 2; /* 8 bytes alignment */
 			memcpy((u8 *)pcmdbuf, pcmd->parmbuf, pcmd->cmdsz);
 			while (check_cmd_fifo(padapter, wr_sz) == _FAIL) {
-				if ((padapter->bDriverStopped == true) ||
-				    (padapter->bSurpriseRemoved == true))
+				if (padapter->bDriverStopped ||
+				    padapter->bSurpriseRemoved)
 					break;
 				msleep(100);
 				continue;
drivers/staging/rtl8712/rtl8712_efuse.c +26 -30

170 lines not on this page · raw message

drivers/staging/rtl8712/rtl8712_io.c +2 -4
index b9abe05..4148d48 100644
@@ -102,8 +102,7 @@ void r8712_read_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
 
 	void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
 			  u8 *pmem);
-	if ((adapter->bDriverStopped == true) ||
-	    (adapter->bSurpriseRemoved == true))
+	if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
 		return;
 	_read_mem = pintfhdl->io_ops._read_mem;
 	_read_mem(pintfhdl, addr, cnt, pmem);
@@ -127,8 +126,7 @@ void r8712_read_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
 
 	u32 (*_read_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt,
 			  u8 *pmem);
-	if ((adapter->bDriverStopped == true) ||
-	    (adapter->bSurpriseRemoved == true))
+	if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
 		return;
 	_read_port = pintfhdl->io_ops._read_port;
 	_read_port(pintfhdl, addr, cnt, pmem);
drivers/staging/rtl8712/rtl8712_led.c +80 -84

452 lines not on this page · raw message

drivers/staging/rtl8712/rtl8712_recv.c +12 -13
index 534dc04..83cdb61 100644
@@ -217,7 +217,7 @@ static union recv_frame *recvframe_defrag(struct _adapter *adapter,
 	curfragnum++;
 	plist = &defrag_q->queue;
 	plist = plist->next;
-	while (end_of_queue_search(phead, plist) == false) {
+	while (!end_of_queue_search(phead, plist)) {
 		pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u);
 		pnfhdr = &pnextrframe->u.hdr;
 		/*check the fragment sequence  (2nd ~n fragment frame) */
@@ -489,7 +489,7 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl,
 
 	phead = &ppending_recvframe_queue->queue;
 	plist = phead->next;
-	while (end_of_queue_search(phead, plist) == false) {
+	while (!end_of_queue_search(phead, plist)) {
 		pnextrframe = LIST_CONTAINOR(plist, union recv_frame, u);
 		pnextattrib = &pnextrframe->u.hdr.attrib;
 		if (SN_LESS(pnextattrib->seq_num, pattrib->seq_num))
@@ -519,7 +519,7 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter,
 	phead = &ppending_recvframe_queue->queue;
 	plist = phead->next;
 	/* Handling some condition for forced indicate case.*/
-	if (bforced == true) {
+	if (bforced) {
 		if (list_empty(phead))
 			return true;
 
@@ -541,8 +541,8 @@ int r8712_recv_indicatepkts_in_order(struct _adapter *padapter,
 				  (preorder_ctrl->indicate_seq + 1) % 4096;
 			/*indicate this recv_frame*/
 			if (!pattrib->amsdu) {
-				if ((padapter->bDriverStopped == false) &&
-				    (padapter->bSurpriseRemoved == false)) {
+				if (!padapter->bDriverStopped &&
+				    !padapter->bSurpriseRemoved) {
 					/* indicate this recv_frame */
 					r8712_recv_indicatepkt(padapter,
 							       prframe);
@@ -576,8 +576,8 @@ static int recv_indicatepkt_reorder(struct _adapter *padapter,
 		/* s1. */
 		r8712_wlanhdr_to_ethhdr(prframe);
 		if (pattrib->qos != 1) {
-			if ((padapter->bDriverStopped == false) &&
-			   (padapter->bSurpriseRemoved == false)) {
+			if (!padapter->bDriverStopped &&
+			    !padapter->bSurpriseRemoved) {
 				r8712_recv_indicatepkt(padapter, prframe);
 				return _SUCCESS;
 			} else
@@ -643,16 +643,15 @@ static int r8712_process_recv_indicatepkts(struct _adapter *padapter,
 	if (phtpriv->ht_option == 1) { /*B/G/N Mode*/
 		if (recv_indicatepkt_reorder(padapter, prframe) != _SUCCESS) {
 			/* including perform A-MPDU Rx Ordering Buffer Control*/
-			if ((padapter->bDriverStopped == false) &&
-			    (padapter->bSurpriseRemoved == false))
+			if (!padapter->bDriverStopped &&
+			    !padapter->bSurpriseRemoved)
 				return _FAIL;
 		}
 	} else { /*B/G mode*/
 		retval = r8712_wlanhdr_to_ethhdr(prframe);
 		if (retval != _SUCCESS)
 			return retval;
-		if ((padapter->bDriverStopped == false) &&
-		    (padapter->bSurpriseRemoved == false)) {
+		if (!padapter->bDriverStopped && !padapter->bSurpriseRemoved) {
 			/* indicate this recv_frame */
 			r8712_recv_indicatepkt(padapter, prframe);
 		} else
@@ -962,12 +961,12 @@ int recv_func(struct _adapter *padapter, void *pcontext)
 	prframe = (union recv_frame *)pcontext;
 	orig_prframe = prframe;
 	pattrib = &prframe->u.hdr.attrib;
-	if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) {
+	if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
 		if (pattrib->crc_err == 1)
 			padapter->mppriv.rx_crcerrpktcount++;
 		else
 			padapter->mppriv.rx_pktcount++;
-		if (check_fwstate(pmlmepriv, WIFI_MP_LPBK_STATE) == false) {
+		if (!check_fwstate(pmlmepriv, WIFI_MP_LPBK_STATE)) {
 			/* free this recv_frame */
 			r8712_free_recvframe(orig_prframe, pfree_recv_queue);
 			goto _exit_recv_func;
drivers/staging/rtl8712/rtl8712_xmit.c +2 -2
index 27b1213..2965919 100644
@@ -168,7 +168,7 @@ static struct xmit_frame *dequeue_one_xmitframe(struct xmit_priv *pxmitpriv,
 
 	xmitframe_phead = &pframe_queue->queue;
 	xmitframe_plist = xmitframe_phead->next;
-	if ((end_of_queue_search(xmitframe_phead, xmitframe_plist)) == false) {
+	if (!end_of_queue_search(xmitframe_phead, xmitframe_plist)) {
 		pxmitframe = LIST_CONTAINOR(xmitframe_plist,
 			     struct xmit_frame, list);
 		list_del_init(&pxmitframe->list);
@@ -208,7 +208,7 @@ static struct xmit_frame *dequeue_xframe_ex(struct xmit_priv *pxmitpriv,
 		phwxmit = phwxmit_i + inx[i];
 		sta_phead = &phwxmit->sta_queue->queue;
 		sta_plist = sta_phead->next;
-		while ((end_of_queue_search(sta_phead, sta_plist)) == false) {
+		while (!end_of_queue_search(sta_phead, sta_plist)) {
 			ptxservq = LIST_CONTAINOR(sta_plist, struct tx_servq,
 				  tx_pending);
 			pframe_queue = &ptxservq->sta_pending;
drivers/staging/rtl8712/rtl871x_cmd.c +4 -4
index ef71829..8331781 100644
@@ -172,7 +172,7 @@ u32 r8712_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *obj)
 {
 	int res;
 
-	if (pcmdpriv->padapter->eeprompriv.bautoload_fail_flag == true)
+	if (pcmdpriv->padapter->eeprompriv.bautoload_fail_flag)
 		return _FAIL;
 	res = _enqueue_cmd(&pcmdpriv->cmd_queue, obj);
 	up(&pcmdpriv->cmd_queue_sema);
@@ -186,7 +186,7 @@ u32 r8712_enqueue_cmd_ex(struct cmd_priv *pcmdpriv, struct cmd_obj *obj)
 
 	if (obj == NULL)
 		return _SUCCESS;
-	if (pcmdpriv->padapter->eeprompriv.bautoload_fail_flag == true)
+	if (pcmdpriv->padapter->eeprompriv.bautoload_fail_flag)
 		return _FAIL;
 	queue = &pcmdpriv->cmd_queue;
 	spin_lock_irqsave(&queue->lock, irqL);
@@ -519,7 +519,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	 * If not,  we copy the connecting AP's MAC address to it so that
 	 * the driver just has the bssid information for PMKIDList searching.
 	 */
-	if (pmlmepriv->assoc_by_bssid == false)
+	if (!pmlmepriv->assoc_by_bssid)
 		ether_addr_copy(&pmlmepriv->assoc_bssid[0],
 				&pnetwork->network.MacAddress[0]);
 	psecnetwork->IELength = r8712_restruct_sec_ie(padapter,
@@ -679,7 +679,7 @@ u8 r8712_setstakey_cmd(struct _adapter *padapter, u8 *psta, u8 unicast_key)
 	else
 		GET_ENCRY_ALGO(psecuritypriv, sta,
 			       psetstakey_para->algorithm, false);
-	if (unicast_key == true)
+	if (unicast_key)
 		memcpy(&psetstakey_para->key, &sta->x_UncstKey, 16);
 	else
 		memcpy(&psetstakey_para->key,
drivers/staging/rtl8712/rtl871x_eeprom.c +11 -11
index 50339e6..4e71361 100644
@@ -49,7 +49,7 @@ static void shift_out_bits(struct _adapter *padapter, u16 data, u16 count)
 {
 	u16 x, mask;
 
-	if (padapter->bSurpriseRemoved == true)
+	if (padapter->bSurpriseRemoved)
 		goto out;
 	mask = 0x01 << (count - 1);
 	x = r8712_read8(padapter, EE_9346CR);
@@ -58,7 +58,7 @@ static void shift_out_bits(struct _adapter *padapter, u16 data, u16 count)
 		x &= ~_EEDI;
 		if (data & mask)
 			x |= _EEDI;
-		if (padapter->bSurpriseRemoved == true)
+		if (padapter->bSurpriseRemoved)
 			goto out;
 		r8712_write8(padapter, EE_9346CR, (u8)x);
 		udelay(CLOCK_RATE);
@@ -66,7 +66,7 @@ static void shift_out_bits(struct _adapter *padapter, u16 data, u16 count)
 		down_clk(padapter, &x);
 		mask >>= 1;
 	} while (mask);
-	if (padapter->bSurpriseRemoved == true)
+	if (padapter->bSurpriseRemoved)
 		goto out;
 	x &= ~_EEDI;
 	r8712_write8(padapter, EE_9346CR, (u8)x);
@@ -77,7 +77,7 @@ static u16 shift_in_bits(struct _adapter *padapter)
 {
 	u16 x, d = 0, i;
 
-	if (padapter->bSurpriseRemoved == true)
+	if (padapter->bSurpriseRemoved)
 		goto out;
 	x = r8712_read8(padapter, EE_9346CR);
 	x &= ~(_EEDO | _EEDI);
@@ -85,7 +85,7 @@ static u16 shift_in_bits(struct _adapter *padapter)
 	for (i = 0; i < 16; i++) {
 		d <<= 1;
 		up_clk(padapter, &x);
-		if (padapter->bSurpriseRemoved == true)
+		if (padapter->bSurpriseRemoved)
 			goto out;
 		x = r8712_read8(padapter, EE_9346CR);
 		x &= ~(_EEDI);
@@ -129,17 +129,17 @@ static void eeprom_clean(struct _adapter *padapter)
 {
 	u16 x;
 
-	if (padapter->bSurpriseRemoved == true)
+	if (padapter->bSurpriseRemoved)
 		return;
 	x = r8712_read8(padapter, EE_9346CR);
-	if (padapter->bSurpriseRemoved == true)
+	if (padapter->bSurpriseRemoved)
 		return;
 	x &= ~(_EECS | _EEDI);
 	r8712_write8(padapter, EE_9346CR, (u8)x);
-	if (padapter->bSurpriseRemoved == true)
+	if (padapter->bSurpriseRemoved)
 		return;
 	up_clk(padapter, &x);
-	if (padapter->bSurpriseRemoved == true)
+	if (padapter->bSurpriseRemoved)
 		return;
 	down_clk(padapter, &x);
 }
@@ -206,11 +206,11 @@ u16 r8712_eeprom_read16(struct _adapter *padapter, u16 reg) /*ReadEEprom*/
 	tmp8_clk_new = tmp8_clk_ori | 0x20;
 	if (tmp8_clk_new != tmp8_clk_ori)
 		r8712_write8(padapter, 0x10250003, tmp8_clk_new);
-	if (padapter->bSurpriseRemoved == true)
+	if (padapter->bSurpriseRemoved)
 		goto out;
 	/* select EEPROM, reset bits, set _EECS */
 	x = r8712_read8(padapter, EE_9346CR);
-	if (padapter->bSurpriseRemoved == true)
+	if (padapter->bSurpriseRemoved)
 		goto out;
 	x &= ~(_EEDI | _EEDO | _EESK | _EEM0);
 	x |= _EEM1 | _EECS;
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +28 -28

182 lines not on this page · raw message

drivers/staging/rtl8712/rtl871x_ioctl_rtl.c +6 -6
index ac0baff..d8e62ec 100644
@@ -324,8 +324,8 @@ uint oid_rt_get_channel_hdl(struct oid_par_priv *poid_par_priv)
 
 	if (poid_par_priv->type_of_oid != QUERY_OID)
 		return RNDIS_STATUS_NOT_ACCEPTED;
-	if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) ||
-	    (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true))
+	if (check_fwstate(pmlmepriv, _FW_LINKED) ||
+	    check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))
 		pnic_Config = &pmlmepriv->cur_network.network.Configuration;
 	else
 		pnic_Config = &padapter->registrypriv.dev_network.
@@ -465,7 +465,7 @@ uint oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv)
 	if (poid_par_priv->type_of_oid != SET_OID) /* QUERY_OID */
 		return RNDIS_STATUS_NOT_ACCEPTED;
 	if (poid_par_priv->information_buf_len == (sizeof(unsigned long)*3)) {
-		if (Adapter->mppriv.act_in_progress == true)
+		if (Adapter->mppriv.act_in_progress)
 			status = RNDIS_STATUS_NOT_ACCEPTED;
 		else {
 			/* init workparam */
@@ -515,11 +515,11 @@ uint oid_rt_get_connect_state_hdl(struct oid_par_priv *poid_par_priv)
 	 * nStatus==2	AdHocMode
 	 * nStatus==3	NotAssociated
 	 */
-	if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true)
+	if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
 		ulInfo = CHECKINGSTATUS;
-	else if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
+	else if (check_fwstate(pmlmepriv, _FW_LINKED))
 		ulInfo = ASSOCIATED;
-	else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)
+	else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE))
 		ulInfo = ADHOCMODE;
 	else
 		ulInfo = NOTASSOCIATED;
drivers/staging/rtl8712/rtl871x_ioctl_set.c +13 -13
index 22262b3..67a2695 100644
@@ -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);
@@ -312,8 +312,8 @@ u8 r8712_set_802_11_bssid_list_scan(struct _adapter *padapter)
 	if (!padapter->hw_init_completed)
 		return false;
 	spin_lock_irqsave(&pmlmepriv->lock, irqL);
-	if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING)) ||
-	    (pmlmepriv->sitesurveyctrl.traffic_busy == true)) {
+	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING) ||
+	    pmlmepriv->sitesurveyctrl.traffic_busy) {
 		/* Scan or linking is in progress, do nothing. */
 		ret = (u8)check_fwstate(pmlmepriv, _FW_UNDER_SURVEY);
 	} else {
drivers/staging/rtl8712/rtl871x_mlme.c +38 -39

258 lines not on this page · raw message

drivers/staging/rtl8712/rtl871x_mlme.h +1 -1
index 08d6c98..61e0eb7 100644
@@ -153,7 +153,7 @@ static inline void clr_fwstate(struct mlme_priv *pmlmepriv, sint state)
 	unsigned long irqL;
 
 	spin_lock_irqsave(&pmlmepriv->lock, irqL);
-	if (check_fwstate(pmlmepriv, state) == true)
+	if (check_fwstate(pmlmepriv, state))
 		pmlmepriv->fw_state ^= state;
 	spin_unlock_irqrestore(&pmlmepriv->lock, irqL);
 }
drivers/staging/rtl8712/rtl871x_mp_ioctl.c +8 -8
index 77f01bf..7b00c35 100644
@@ -181,7 +181,7 @@ static int mp_start_test(struct _adapter *padapter)
 	} else
 		bssid.Length = length;
 	spin_lock_irqsave(&pmlmepriv->lock, irqL);
-	if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true)
+	if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
 		goto end_of_mp_start_test;
 	/*init mp_start_test status*/
 	pmppriv->prev_fw_state = get_fwstate(pmlmepriv);
@@ -223,7 +223,7 @@ static int mp_stop_test(struct _adapter *padapter)
 	unsigned long irqL;
 
 	spin_lock_irqsave(&pmlmepriv->lock, irqL);
-	if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == false)
+	if (!check_fwstate(pmlmepriv, WIFI_MP_STATE))
 		goto end_of_mp_stop_test;
 	/* 3 1. disconnect psudo AdHoc */
 	r8712_os_indicate_disconnect(padapter);
@@ -247,9 +247,9 @@ int mp_start_joinbss(struct _adapter *padapter, struct ndis_802_11_ssid *pssid)
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	unsigned char res = _SUCCESS;
 
-	if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == false)
+	if (!check_fwstate(pmlmepriv, WIFI_MP_STATE))
 		return _FAIL;
-	if (check_fwstate(pmlmepriv, _FW_LINKED) == false)
+	if (!check_fwstate(pmlmepriv, _FW_LINKED))
 		return _FAIL;
 	_clr_fwstate_(pmlmepriv, _FW_LINKED);
 	res = r8712_setassocsta_cmd(padapter, pmppriv->network_macaddr);
@@ -684,7 +684,7 @@ uint oid_rt_get_thermal_meter_hdl(struct oid_par_priv *poid_par_priv)
 	if (poid_par_priv->type_of_oid != QUERY_OID)
 		return RNDIS_STATUS_NOT_ACCEPTED;
 
-	if (Adapter->mppriv.act_in_progress == true)
+	if (Adapter->mppriv.act_in_progress)
 		return RNDIS_STATUS_NOT_ACCEPTED;
 
 	if (poid_par_priv->information_buf_len < sizeof(u8))
@@ -728,7 +728,7 @@ uint oid_rt_pro_read_efuse_hdl(struct oid_par_priv *poid_par_priv)
 	if ((addr > 511) || (cnts < 1) || (cnts > 512) || (addr + cnts) >
 	     EFUSE_MAX_SIZE)
 		return RNDIS_STATUS_NOT_ACCEPTED;
-	if (r8712_efuse_access(Adapter, true, addr, cnts, data) == false)
+	if (!r8712_efuse_access(Adapter, true, addr, cnts, data))
 		status = RNDIS_STATUS_FAILURE;
 	*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
 	return status;
@@ -756,7 +756,7 @@ uint oid_rt_pro_write_efuse_hdl(struct oid_par_priv *poid_par_priv)
 	if ((addr > 511) || (cnts < 1) || (cnts > 512) ||
 	    (addr + cnts) > r8712_efuse_get_max_size(Adapter))
 		return RNDIS_STATUS_NOT_ACCEPTED;
-	if (r8712_efuse_access(Adapter, false, addr, cnts, data) == false)
+	if (!r8712_efuse_access(Adapter, false, addr, cnts, data))
 		status = RNDIS_STATUS_FAILURE;
 	return status;
 }
@@ -824,7 +824,7 @@ uint oid_rt_pro_efuse_map_hdl(struct oid_par_priv *poid_par_priv)
 			status = RNDIS_STATUS_FAILURE;
 	} else {
 		/* SET_OID */
-		if (r8712_efuse_reg_init(Adapter) == true) {
+		if (r8712_efuse_reg_init(Adapter)) {
 			if (r8712_efuse_map_write(Adapter, 0,
 			    EFUSE_MAP_MAX_SIZE, data))
 				*poid_par_priv->bytes_rw = EFUSE_MAP_MAX_SIZE;
drivers/staging/rtl8712/rtl871x_pwrctrl.c +2 -4
index 9bc04f4..bf10d6d 100644
@@ -44,8 +44,7 @@ void r8712_set_rpwm(struct _adapter *padapter, u8 val8)
 		if (pwrpriv->rpwm_retry == 0)
 			return;
 	}
-	if ((padapter->bDriverStopped == true) ||
-	    (padapter->bSurpriseRemoved == true))
+	if (padapter->bDriverStopped || padapter->bSurpriseRemoved)
 		return;
 	rpwm = val8 | pwrpriv->tog;
 	switch (val8) {
@@ -129,8 +128,7 @@ static void _rpwm_check_handler (struct _adapter *padapter)
 {
 	struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
 
-	if (padapter->bDriverStopped == true ||
-	    padapter->bSurpriseRemoved == true)
+	if (padapter->bDriverStopped || padapter->bSurpriseRemoved)
 		return;
 	if (pwrpriv->cpwm != pwrpriv->rpwm)
 		schedule_work(&pwrpriv->rpwm_workitem);
drivers/staging/rtl8712/rtl871x_recv.c +19 -20
index 046a46c..8a54436 100644
@@ -147,7 +147,7 @@ void r8712_free_recvframe_queue(struct  __queue *pframequeue,
 	spin_lock(&pframequeue->lock);
 	phead = &pframequeue->queue;
 	plist = phead->next;
-	while (end_of_queue_search(phead, plist) == false) {
+	while (!end_of_queue_search(phead, plist)) {
 		precvframe = LIST_CONTAINOR(plist, union recv_frame, u);
 		plist = plist->next;
 		r8712_free_recvframe(precvframe, pfree_recv_queue);
@@ -178,7 +178,7 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter,
 				idx = iv[3];
 				mickey = &psecuritypriv->XGrprxmickey[(((idx >>
 					 6) & 0x3)) - 1].skey[0];
-				if (psecuritypriv->binstallGrpkey == false)
+				if (!psecuritypriv->binstallGrpkey)
 					return _FAIL;
 			} else
 				mickey = &stainfo->tkiprxmickey.skey[0];
@@ -197,16 +197,15 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter,
 				if (miccode[i] != *(pframemic + i))
 					bmic_err = true;
 			}
-			if (bmic_err == true) {
-				if (prxattrib->bdecrypted == true)
+			if (bmic_err) {
+				if (prxattrib->bdecrypted)
 					r8712_handle_tkip_mic_err(adapter,
 						(u8)IS_MCAST(prxattrib->ra));
 				res = _FAIL;
 			} else {
 				/* mic checked ok */
-				if ((psecuritypriv->bcheck_grpkey ==
-				     false) && (IS_MCAST(prxattrib->ra) ==
-				     true))
+				if (!psecuritypriv->bcheck_grpkey &&
+				    IS_MCAST(prxattrib->ra))
 					psecuritypriv->bcheck_grpkey = true;
 			}
 			recvframe_pull_tail(precvframe, 8);
@@ -224,7 +223,7 @@ union recv_frame *r8712_decryptor(struct _adapter *padapter,
 	union recv_frame *return_packet = precv_frame;
 
 	if ((prxattrib->encrypt > 0) && ((prxattrib->bdecrypted == 0) ||
-	   (psecuritypriv->sw_decrypt == true))) {
+	    psecuritypriv->sw_decrypt)) {
 		psecuritypriv->hw_decrypted = false;
 		switch (prxattrib->encrypt) {
 		case _WEP40_:
@@ -324,8 +323,8 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
 	u8 *sta_addr = NULL;
 	sint bmcast = IS_MCAST(pattrib->dst);
 
-	if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) ||
-	    (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) {
+	if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
+	    check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
 		/* filter packets that SA is myself or multicast or broadcast */
 		if (!memcmp(myhwaddr, pattrib->src, ETH_ALEN))
 			return _FAIL;
@@ -336,13 +335,13 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
 		    (memcmp(pattrib->bssid, mybssid, ETH_ALEN)))
 			return _FAIL;
 		sta_addr = pattrib->src;
-	} else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) {
+	} else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
 		/* For Station mode, sa and bssid should always be BSSID,
 		 * and DA is my mac-address */
 		if (memcmp(pattrib->bssid, pattrib->src, ETH_ALEN))
 			return _FAIL;
 	       sta_addr = pattrib->bssid;
-	 } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) {
+	 } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
 		if (bmcast) {
 			/* For AP mode, if DA == MCAST, then BSSID should
 			 * be also MCAST */
@@ -355,7 +354,7 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
 				return _FAIL;
 			sta_addr = pattrib->src;
 		}
-	  } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) {
+	  } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
 		memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN);
 		memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN);
 		memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN);
@@ -369,7 +368,7 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
 	else
 		*psta = r8712_get_stainfo(pstapriv, sta_addr); /* get ap_info */
 	if (*psta == NULL) {
-		if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true)
+		if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
 			adapter->mppriv.rx_pktloss++;
 		return _FAIL;
 	}
@@ -388,8 +387,8 @@ static sint ap2sta_data_frame(struct _adapter *adapter,
 	u8 *myhwaddr = myid(&adapter->eeprompriv);
 	sint bmcast = IS_MCAST(pattrib->dst);
 
-	if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true)
-	     && (check_fwstate(pmlmepriv, _FW_LINKED) == true)) {
+	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) &&
+	    check_fwstate(pmlmepriv, _FW_LINKED)) {
 		/* if NULL-frame, drop packet */
 		if ((GetFrameSubType(ptr)) == WIFI_DATA_NULL)
 			return _FAIL;
@@ -419,8 +418,8 @@ static sint ap2sta_data_frame(struct _adapter *adapter,
 		       *psta = r8712_get_stainfo(pstapriv, pattrib->bssid);
 		if (*psta == NULL)
 			return _FAIL;
-	} else if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) &&
-		   (check_fwstate(pmlmepriv, _FW_LINKED) == true)) {
+	} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) &&
+		   check_fwstate(pmlmepriv, _FW_LINKED)) {
 		memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN);
 		memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN);
 		memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN);
@@ -444,7 +443,7 @@ static sint sta2ap_data_frame(struct _adapter *adapter,
 	struct	mlme_priv *pmlmepriv = &adapter->mlmepriv;
 	unsigned char *mybssid  = get_bssid(pmlmepriv);
 
-	if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) {
+	if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
 		/* For AP mode, if DA is non-MCAST, then it must be BSSID,
 		 * and bssid == BSSID
 		 * For AP mode, RA=BSSID, TX=STA(SRC_ADDR), A3=DST_ADDR */
@@ -630,7 +629,7 @@ sint r8712_wlanhdr_to_ethhdr(union recv_frame *precvframe)
 	rmv_len = pattrib->hdrlen + pattrib->iv_len +
 		  (bsnaphdr ? SNAP_SIZE : 0);
 	len = precvframe->u.hdr.len - rmv_len;
-	if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) {
+	if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
 		ptr += rmv_len;
 		*ptr = 0x87;
 		*(ptr+1) = 0x12;
drivers/staging/rtl8712/rtl871x_security.c +2 -2
index 8627928..48b0557 100644
@@ -675,7 +675,7 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe)
 				idx = iv[3];
 				prwskey = &psecuritypriv->XGrpKey[
 					 ((idx >> 6) & 0x3) - 1].skey[0];
-				if (psecuritypriv->binstallGrpkey == false)
+				if (!psecuritypriv->binstallGrpkey)
 					return _FAIL;
 			} else
 				prwskey = &stainfo->x_UncstKey.skey[0];
@@ -1374,7 +1374,7 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe)
 				idx = iv[3];
 				prwskey = &psecuritypriv->XGrpKey[
 					  ((idx >> 6) & 0x3) - 1].skey[0];
-				if (psecuritypriv->binstallGrpkey == false)
+				if (!psecuritypriv->binstallGrpkey)
 					return _FAIL;
 
 			} else
drivers/staging/rtl8712/rtl871x_sta_mgt.c +3 -3
index 6ae8cdc..400dfb6 100644
@@ -83,7 +83,7 @@ static void mfree_all_stainfo(struct sta_priv *pstapriv)
 	spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL);
 	phead = &pstapriv->free_sta_queue.queue;
 	plist = phead->next;
-	while ((end_of_queue_search(phead, plist)) == false)
+	while (!end_of_queue_search(phead, plist))
 		plist = plist->next;
 
 	spin_unlock_irqrestore(&pstapriv->sta_hash_lock, irqL);
@@ -222,7 +222,7 @@ void r8712_free_all_stainfo(struct _adapter *padapter)
 	for (index = 0; index < NUM_STA; index++) {
 		phead = &(pstapriv->sta_hash[index]);
 		plist = phead->next;
-		while ((end_of_queue_search(phead, plist)) == false) {
+		while (!end_of_queue_search(phead, plist)) {
 			psta = LIST_CONTAINOR(plist,
 					      struct sta_info, hash_list);
 			plist = plist->next;
@@ -247,7 +247,7 @@ struct sta_info *r8712_get_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
 	spin_lock_irqsave(&pstapriv->sta_hash_lock, irqL);
 	phead = &(pstapriv->sta_hash[index]);
 	plist = phead->next;
-	while ((end_of_queue_search(phead, plist)) == false) {
+	while (!end_of_queue_search(phead, plist)) {
 		psta = LIST_CONTAINOR(plist, struct sta_info, hash_list);
 		if ((!memcmp(psta->hwaddr, hwaddr, ETH_ALEN))) {
 			/* if found the matched address */
drivers/staging/rtl8712/rtl871x_xmit.c +19 -19
index 2e4fa88..d414139 100644
@@ -217,8 +217,8 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
 	memcpy(pattrib->dst, &etherhdr.h_dest, ETH_ALEN);
 	memcpy(pattrib->src, &etherhdr.h_source, ETH_ALEN);
 	pattrib->pctrl = 0;
-	if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) ||
-	    (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) {
+	if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
+	    check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
 		memcpy(pattrib->ra, pattrib->dst, ETH_ALEN);
 		memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
 	} else if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
@@ -227,7 +227,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
 	} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
 		memcpy(pattrib->ra, pattrib->dst, ETH_ALEN);
 		memcpy(pattrib->ta, get_bssid(pmlmepriv), ETH_ALEN);
-	} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) {
+	} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
 		/*firstly, filter packet not belongs to mp*/
 		if (pattrib->ether_type != 0x8712)
 			return _FAIL;
@@ -267,7 +267,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
 		psta = r8712_get_bcmc_stainfo(padapter);
 		pattrib->mac_id = 4;
 	} else {
-		if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) {
+		if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
 			psta = r8712_get_stainfo(pstapriv,
 						 get_bssid(pmlmepriv));
 			pattrib->mac_id = 5;
@@ -300,10 +300,10 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
 		pattrib->subtype = WIFI_DATA_TYPE;
 		pattrib->priority = 0;
 	}
-	if (psta->ieee8021x_blocked == true) {
+	if (psta->ieee8021x_blocked) {
 		pattrib->encrypt = 0;
 		if ((pattrib->ether_type != 0x888e) &&
-		    (check_fwstate(pmlmepriv, WIFI_MP_STATE) == false))
+		    !check_fwstate(pmlmepriv, WIFI_MP_STATE))
 			return _FAIL;
 	} else
 		GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast);
@@ -330,14 +330,14 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
 	}
 
 	if (pattrib->encrypt &&
-	    ((padapter->securitypriv.sw_encrypt == true) ||
-	     (psecuritypriv->hw_decrypted == false)))
+	    (padapter->securitypriv.sw_encrypt ||
+	    !psecuritypriv->hw_decrypted))
 		pattrib->bswenc = true;
 	else
 		pattrib->bswenc = false;
 	/* if in MP_STATE, update pkt_attrib from mp_txcmd, and overwrite
 	 * some settings above.*/
-	if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true)
+	if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
 		pattrib->priority = (txdesc.txdw1 >> QSEL_SHT) & 0x1f;
 	return _SUCCESS;
 }
@@ -483,28 +483,28 @@ static sint make_wlanhdr(struct _adapter *padapter, u8 *hdr,
 	memset(hdr, 0, WLANHDR_OFFSET);
 	SetFrameSubType(fctrl, pattrib->subtype);
 	if (pattrib->subtype & WIFI_DATA_TYPE) {
-		if (check_fwstate(pmlmepriv,  WIFI_STATION_STATE) == true) {
+		if (check_fwstate(pmlmepriv,  WIFI_STATION_STATE)) {
 			/* to_ds = 1, fr_ds = 0; */
 			SetToDs(fctrl);
 			memcpy(pwlanhdr->addr1, get_bssid(pmlmepriv),
 				ETH_ALEN);
 			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
 			memcpy(pwlanhdr->addr3, pattrib->dst, ETH_ALEN);
-		} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) {
+		} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
 			/* to_ds = 0, fr_ds = 1; */
 			SetFrDs(fctrl);
 			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
 			memcpy(pwlanhdr->addr2, get_bssid(pmlmepriv),
 				ETH_ALEN);
 			memcpy(pwlanhdr->addr3, pattrib->src, ETH_ALEN);
-		} else if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)
-			   || (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)
-			   == true)) {
+		} else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ||
+			   check_fwstate(pmlmepriv,
+					 WIFI_ADHOC_MASTER_STATE)) {
 			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
 			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
 			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
 				ETH_ALEN);
-		} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) {
+		} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
 			memcpy(pwlanhdr->addr1, pattrib->dst, ETH_ALEN);
 			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
 			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
@@ -609,7 +609,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
 		return _FAIL;
 	_r8712_open_pktfile(pkt, &pktfile);
 	_r8712_pktfile_read(&pktfile, NULL, (uint) pattrib->pkt_hdrlen);
-	if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) {
+	if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
 		/* truncate TXDESC_SIZE bytes txcmd if at mp mode for 871x */
 		if (pattrib->ether_type == 0x8712) {
 			/* take care -  update_txdesc overwrite this */
@@ -680,7 +680,7 @@ sint r8712_xmitframe_coalesce(struct _adapter *padapter, _pkt *pkt,
 			pframe += pattrib->icv_len;
 		}
 		frg_inx++;
-		if (bmcst || (r8712_endofpktfile(&pktfile) == true)) {
+		if (bmcst || r8712_endofpktfile(&pktfile)) {
 			pattrib->nr_frags = frg_inx;
 			pattrib->last_txcmdsz = pattrib->hdrlen +
 						pattrib->iv_len +
@@ -855,7 +855,7 @@ void r8712_free_xmitframe_queue(struct xmit_priv *pxmitpriv,
 	spin_lock_irqsave(&(pframequeue->lock), irqL);
 	phead = &pframequeue->queue;
 	plist = phead->next;
-	while (end_of_queue_search(phead, plist) == false) {
+	while (!end_of_queue_search(phead, plist)) {
 		pxmitframe = LIST_CONTAINOR(plist, struct xmit_frame, list);
 		plist = plist->next;
 		r8712_free_xmitframe(pxmitpriv, pxmitframe);
@@ -923,7 +923,7 @@ sint r8712_xmit_classifier(struct _adapter *padapter,
 		if (bmcst)
 			psta = r8712_get_bcmc_stainfo(padapter);
 		else {
-			if (check_fwstate(pmlmepriv, WIFI_MP_STATE) == true)
+			if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
 				psta = r8712_get_stainfo(pstapriv,
 				       get_bssid(pmlmepriv));
 			else
drivers/staging/rtl8712/usb_intf.c +2 -2
index 4c63baa..5c11db9 100644
@@ -301,7 +301,7 @@ void rtl871x_intf_stop(struct _adapter *padapter)
 
 void r871x_dev_unload(struct _adapter *padapter)
 {
-	if (padapter->bup == true) {
+	if (padapter->bup) {
 		/*s1.*/
 		padapter->bDriverStopped = true;
 
@@ -610,7 +610,7 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)
 		release_firmware(padapter->fw);
 		/* never exit with a firmware callback pending */
 		wait_for_completion(&padapter->rtl8712_fw_ready);
-		if (drvpriv.drv_registered == true)
+		if (drvpriv.drv_registered)
 			padapter->bSurpriseRemoved = true;
 		unregister_netdev(pnetdev); /* will call netdev_close() */
 		flush_scheduled_work();
drivers/staging/rtl8712/usb_ops_linux.c +5 -5
index c940722..e33eeed 100644
@@ -266,7 +266,7 @@ u32 r8712_usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
 	if (adapter->bDriverStopped || adapter->bSurpriseRemoved ||
 	    adapter->pwrctrlpriv.pnp_bstop_trx)
 		return _FAIL;
-	if (!precvbuf->reuse == false || !precvbuf->pskb) {
+	if (precvbuf->reuse || !precvbuf->pskb) {
 		precvbuf->pskb = skb_dequeue(&precvpriv->free_recv_skb_queue);
 		if (precvbuf->pskb != NULL)
 			precvbuf->reuse = true;
@@ -330,13 +330,13 @@ void r8712_xmit_bh(void *priv)
 	struct _adapter *padapter = (struct _adapter *)priv;
 	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
 
-	if ((padapter->bDriverStopped == true) ||
-	    (padapter->bSurpriseRemoved == true)) {
+	if (padapter->bDriverStopped ||
+	    padapter->bSurpriseRemoved) {
 		netdev_err(padapter->pnetdev, "xmit_bh => bDriverStopped or bSurpriseRemoved\n");
 		return;
 	}
 	ret = r8712_xmitframe_complete(padapter, pxmitpriv, NULL);
-	if (ret == false)
+	if (!ret)
 		return;
 	tasklet_hi_schedule(&pxmitpriv->xmit_tasklet);
 }
@@ -410,7 +410,7 @@ u32 r8712_usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
 	    (padapter->pwrctrlpriv.pnp_bstop_trx))
 		return _FAIL;
 	for (i = 0; i < 8; i++) {
-		if (pxmitframe->bpending[i] == false) {
+		if (!pxmitframe->bpending[i]) {
 			spin_lock_irqsave(&pxmitpriv->lock, irqL);
 			pxmitpriv->txirp_cnt++;
 			pxmitframe->bpending[i]  = true;
drivers/staging/rtl8712/xmit_linux.c +2 -2
index d15fb1a..d398183 100644
@@ -166,7 +166,7 @@ int r8712_xmit_entry(_pkt *pkt, struct  net_device *pnetdev)
 	struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
 	int ret = 0;
 
-	if (r8712_if_up(padapter) == false) {
+	if (!r8712_if_up(padapter)) {
 		ret = 0;
 		goto _xmit_entry_drop;
 	}
@@ -181,7 +181,7 @@ int r8712_xmit_entry(_pkt *pkt, struct  net_device *pnetdev)
 	}
 	padapter->ledpriv.LedControlHandler(padapter, LED_CTL_TX);
 	pxmitframe->pkt = pkt;
-	if (r8712_pre_xmit(padapter, pxmitframe) == true) {
+	if (r8712_pre_xmit(padapter, pxmitframe)) {
 		/*dump xmitframe directly or drop xframe*/
 		dev_kfree_skb_any(pkt);
 		pxmitframe->pkt = NULL;
Signature · 1 line
2.5.3
#2 lore raw

Re: [PATCH v2 1/3] staging: rtl8712: Remove boolean comparisons

Quoted 9 lines · Luis de Bethencourt

Boolean tests do not need explicit comparison to true or false.

---

drivers/staging/rtl8712/usb_ops_linux.c +0 -0
index c940722..e33eeed 100644

drivers/staging/rtl8712/usb_ops_linux.c u32 r8712_usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) · line 272

Quoted 8 lines
drivers/staging/rtl8712/usb_ops_linux.c +1 -1
@@ -266,7 +266,7 @@ u32 r8712_usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
 	if (adapter->bDriverStopped || adapter->bSurpriseRemoved ||
 	    adapter->pwrctrlpriv.pnp_bstop_trx)
 		return _FAIL;
-	if (!precvbuf->reuse == false || !precvbuf->pskb) {
+	if (precvbuf->reuse || !precvbuf->pskb) {
 		precvbuf->pskb = skb_dequeue(&precvpriv->free_recv_skb_queue);
 		if (precvbuf->pskb != NULL)
 			precvbuf->reuse = true;

You have transformed this faithfully, but my instinct says that the original code is wrong. It should be:

	if (!precvbuf->reuse || !precvbuf->pskb) {

I checked and usb_read_port() is implemented this way in drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c. Again I am going on instinct and not a full understanding of the code, but I'm probably correct.

Anyway, this is not related to the patch so we should fix it in a later patch, but let's not forget.

TODO: rtl8712: fix a reversed condition in r8712_usb_read_port()

regards,
dan carpenter

#3 lore raw

Re: [PATCH v2 1/3] staging: rtl8712: Remove boolean comparisons

Quoted 29 lines · Dan Carpenter
Quoted 9 lines · Luis de Bethencourt

Boolean tests do not need explicit comparison to true or false.

---

drivers/staging/rtl8712/usb_ops_linux.c +0 -0
index c940722..e33eeed 100644

drivers/staging/rtl8712/usb_ops_linux.c u32 r8712_usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) · line 272

Quoted 8 lines
drivers/staging/rtl8712/usb_ops_linux.c +1 -1
@@ -266,7 +266,7 @@ u32 r8712_usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
 	if (adapter->bDriverStopped || adapter->bSurpriseRemoved ||
 	    adapter->pwrctrlpriv.pnp_bstop_trx)
 		return _FAIL;
-	if (!precvbuf->reuse == false || !precvbuf->pskb) {
+	if (precvbuf->reuse || !precvbuf->pskb) {
 		precvbuf->pskb = skb_dequeue(&precvpriv->free_recv_skb_queue);
 		if (precvbuf->pskb != NULL)
 			precvbuf->reuse = true;

You have transformed this faithfully, but my instinct says that the original code is wrong. It should be:

	if (!precvbuf->reuse || !precvbuf->pskb) {

I checked and usb_read_port() is implemented this way in drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c. Again I am going on instinct and not a full understanding of the code, but I'm probably correct.

Quoted 8 lines

Anyway, this is not related to the patch so we should fix it in a later patch, but let's not forget.

TODO: rtl8712: fix a reversed condition in r8712_usb_read_port()

regards,
dan carpenter

Hi Dan,

Thank you for the review. I will study the code and make sure that your intuition is correct, which initially it sounds to be.

Thanks,
Luis

#4 lore raw

PATCH v2 2/3 staging: rtl8712: braces should be used on all arms

In reply to Luis de Bethencourt

Fix all instances of the following checkpatch.pl check:
CHECK: braces {} should be used on all arms of this statement

---
 drivers/staging/rtl8712/hal_init.c            | 11 +++---
 drivers/staging/rtl8712/ieee80211.c           | 15 +++++---
 drivers/staging/rtl8712/rtl8712_cmd.c         |  6 ++--
 drivers/staging/rtl8712/rtl8712_efuse.c       | 20 ++++++-----
 drivers/staging/rtl8712/rtl8712_led.c         | 15 +++++---
 drivers/staging/rtl8712/rtl8712_recv.c        | 16 +++++----
 drivers/staging/rtl8712/rtl8712_xmit.c        | 10 +++---
 drivers/staging/rtl8712/rtl871x_cmd.c         |  7 ++--
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 50 ++++++++++++++++-----------
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c   | 40 +++++++++++++--------
 drivers/staging/rtl8712/rtl871x_ioctl_set.c   |  3 +-
 drivers/staging/rtl8712/rtl871x_mlme.c        | 29 ++++++++++------
 drivers/staging/rtl8712/rtl871x_mp.c          |  6 ++--
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c    | 18 ++++++----
 drivers/staging/rtl8712/rtl871x_recv.c        | 27 +++++++++------
 drivers/staging/rtl8712/rtl871x_security.c    | 21 +++++++----
 drivers/staging/rtl8712/rtl871x_sta_mgt.c     |  4 +--
 drivers/staging/rtl8712/rtl871x_xmit.c        | 37 +++++++++++---------
 drivers/staging/rtl8712/usb_halinit.c         |  3 +-
 drivers/staging/rtl8712/usb_intf.c            |  9 ++---
 drivers/staging/rtl8712/usb_ops_linux.c       |  6 ++--
 21 files changed, 216 insertions(+), 137 deletions(-)
drivers/staging/rtl8712/hal_init.c +6 -5
index e0ae57d..8008efe 100644
@@ -191,9 +191,9 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter)
 		imem_sz = fwhdr.img_IMEM_size;
 		do {
 			memset(ptx_desc, 0, TXDESC_SIZE);
-			if (imem_sz >  MAX_DUMP_FWSZ/*49152*/)
+			if (imem_sz >  MAX_DUMP_FWSZ/*49152*/) {
 				dump_imem_sz = MAX_DUMP_FWSZ;
-			else {
+			} else {
 				dump_imem_sz = imem_sz;
 				ptx_desc->txdw0 |= cpu_to_le32(BIT(28));
 			}
@@ -309,8 +309,9 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter)
 		}
 		if (i == 0)
 			goto exit_fail;
-	} else
+	} else {
 		goto exit_fail;
+	}
 	ret = _SUCCESS;
 
 exit_fail:
@@ -386,9 +387,9 @@ uint rtl871x_hal_init(struct _adapter *padapter)
 		return _FAIL;
 	if (padapter->halpriv.hal_bus_init(padapter) != _SUCCESS)
 		return _FAIL;
-	if (rtl8712_hal_init(padapter) == _SUCCESS)
+	if (rtl8712_hal_init(padapter) == _SUCCESS) {
 		padapter->hw_init_completed = true;
-	else {
+	} else {
 		padapter->hw_init_completed = false;
 		return _FAIL;
 	}
drivers/staging/rtl8712/ieee80211.c +10 -5
index 261a973..3c38fcb 100644
@@ -304,8 +304,9 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
 		*group_cipher = r8712_get_wpa_cipher_suite(pos);
 		pos += WPA_SELECTOR_LEN;
 		left -= WPA_SELECTOR_LEN;
-	} else if (left > 0)
+	} else if (left > 0) {
 		return _FAIL;
+	}
 	/*pairwise_cipher*/
 	if (left >= 2) {
 		count = le16_to_cpu(*(u16 *)pos);
@@ -318,8 +319,9 @@ int r8712_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
 			pos += WPA_SELECTOR_LEN;
 			left -= WPA_SELECTOR_LEN;
 		}
-	} else if (left == 1)
+	} else if (left == 1) {
 		return _FAIL;
+	}
 	return _SUCCESS;
 }
 
@@ -344,8 +346,9 @@ int r8712_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher,
 		*group_cipher = r8712_get_wpa2_cipher_suite(pos);
 		pos += RSN_SELECTOR_LEN;
 		left -= RSN_SELECTOR_LEN;
-	} else if (left > 0)
+	} else if (left > 0) {
 		return _FAIL;
+	}
 	/*pairwise_cipher*/
 	if (left >= 2) {
 		count = le16_to_cpu(*(u16 *)pos);
@@ -358,8 +361,9 @@ int r8712_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher,
 			pos += RSN_SELECTOR_LEN;
 			left -= RSN_SELECTOR_LEN;
 		}
-	} else if (left == 1)
+	} else if (left == 1) {
 		return _FAIL;
+	}
 	return _SUCCESS;
 }
 
@@ -385,8 +389,9 @@ int r8712_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,
 					in_ie[cnt + 1] + 2);
 				*rsn_len = in_ie[cnt+1] + 2;
 				cnt += in_ie[cnt+1] + 2;  /*get next*/
-			} else
+			} else {
 				cnt += in_ie[cnt+1] + 2;   /*get next*/
+			}
 		}
 	}
 	return *rsn_len + *wpa_len;
drivers/staging/rtl8712/rtl8712_cmd.c +4 -2
index 39b6320..ac6c22f 100644
@@ -405,10 +405,12 @@ _next:
 			if (list_empty(&pcmdpriv->cmd_queue.queue)) {
 				r8712_unregister_cmd_alive(padapter);
 				continue;
-			} else
+			} else {
 				goto _next;
-		} else
+			}
+		} else {
 			goto _next;
+		}
 		flush_signals_thread();
 	}
 	/* free all cmd_obj resources */
drivers/staging/rtl8712/rtl8712_efuse.c +12 -8
index 13d4b8d..4dcc826 100644
@@ -163,8 +163,9 @@ static u8 efuse_is_empty(struct _adapter *padapter, u8 *empty)
 			*empty = true;
 		else
 			*empty = false;
-	} else
+	} else {
 		ret = false;
+	}
 	return ret;
 }
 
@@ -229,8 +230,9 @@ u16 r8712_efuse_get_current_size(struct _adapter *padapter)
 			word_cnts = calculate_word_cnts(hworden);
 			/* read next header */
 			efuse_addr = efuse_addr + (word_cnts * 2) + 1;
-		} else
+		} else {
 			bContinual = false;
+		}
 	}
 	return efuse_addr;
 }
@@ -263,8 +265,9 @@ u8 r8712_efuse_pg_packet_read(struct _adapter *padapter, u8 offset, u8 *data)
 					if (efuse_one_byte_read(padapter,
 					    efuse_addr+1+tmpidx, &efuse_data)) {
 						tmpdata[tmpidx] = efuse_data;
-					} else
+					} else {
 						ret = false;
+					}
 				}
 				pgpacket_copy_data(hworden, tmpdata, data);
 			}
@@ -335,17 +338,17 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr)
 			efuse_one_byte_write(padapter, addr+1,
 					pkt.data[i*2 + 1]);
 			/* additional check */
-			if (!efuse_one_byte_read(padapter, addr, &value))
+			if (!efuse_one_byte_read(padapter, addr, &value)) {
 				ret = false;
-			else if (pkt.data[i*2] != value) {
+			} else if (pkt.data[i*2] != value) {
 				ret = false;
 				if (0xFF == value) /* write again */
 					efuse_one_byte_write(padapter, addr,
 							pkt.data[i * 2]);
 			}
-			if (!efuse_one_byte_read(padapter, addr+1, &value))
+			if (!efuse_one_byte_read(padapter, addr+1, &value)) {
 				ret = false;
-			else if (pkt.data[i*2 + 1] != value) {
+			} else if (pkt.data[i*2 + 1] != value) {
 				ret = false;
 				if (0xFF == value) /* write again */
 					efuse_one_byte_write(padapter, addr+1,
@@ -503,8 +506,9 @@ u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr, u16 cnts,
 	if (efuse_is_empty(padapter, &empty)) {
 		if (empty)
 			memset(pktdata, 0xFF, PGPKT_DATA_SIZE);
-	} else
+	} else {
 		return false;
+	}
 	offset = (addr >> 3) & 0xF;
 	if (!empty)
 		if (!r8712_efuse_pg_packet_read(padapter, offset, pktdata))
drivers/staging/rtl8712/rtl8712_led.c +10 -5
index 48d744d..79981b5 100644
@@ -297,14 +297,16 @@ static void SwLedBlink1(struct LED_871x *pLed)
 			if (!pLed1->bSWLedCtrl) {
 				SwLedOn(padapter, pLed1);
 				pLed1->bSWLedCtrl = true;
-			} else if (!pLed1->bLedOn)
+			} else if (!pLed1->bLedOn) {
 				SwLedOn(padapter, pLed1);
+			}
 		} else {
 			if (!pLed1->bSWLedCtrl) {
 				SwLedOff(padapter, pLed1);
 				pLed1->bSWLedCtrl = true;
-			} else if (pLed1->bLedOn)
+			} else if (pLed1->bLedOn) {
 				SwLedOff(padapter, pLed1);
+			}
 		}
 	}
 	switch (pLed->CurrLedState) {
@@ -407,8 +409,9 @@ static void SwLedBlink1(struct LED_871x *pLed)
 			mod_timer(&pLed->BlinkTimer, jiffies +
 				  msecs_to_jiffies(LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA));
 			bStopBlinking = false;
-		} else
+		} else {
 			bStopBlinking = true;
+		}
 		if (bStopBlinking) {
 			pLed->bLedLinkBlinkInProgress = true;
 			pLed->CurrLedState = LED_BLINK_NORMAL;
@@ -570,8 +573,9 @@ static void SwLedBlink3(struct LED_871x *pLed)
 			mod_timer(&pLed->BlinkTimer, jiffies +
 				  msecs_to_jiffies(LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA));
 			bStopBlinking = false;
-		} else
+		} else {
 			bStopBlinking = true;
+		}
 		if (bStopBlinking) {
 			pLed->CurrLedState = LED_ON;
 			pLed->BlinkingLedState = LED_ON;
@@ -1317,8 +1321,9 @@ static void SwLedControlMode3(struct _adapter *padapter,
 		if (pLed->bLedWPSBlinkInProgress) {
 			del_timer(&pLed->BlinkTimer);
 			pLed->bLedWPSBlinkInProgress = false;
-		} else
+		} else {
 			pLed->bLedWPSBlinkInProgress = true;
+		}
 		pLed->CurrLedState = LED_BLINK_WPS_STOP;
 		if (pLed->bLedOn) {
 			pLed->BlinkingLedState = LED_OFF;
drivers/staging/rtl8712/rtl8712_recv.c +10 -6
index 83cdb61..b6b2b42 100644
@@ -180,8 +180,9 @@ static void update_recvframe_attrib_from_recvstat(struct rx_pkt_attrib *pattrib,
 			pattrib->ip_chkrpt = 1; /* correct */
 		else
 			pattrib->ip_chkrpt = 0; /* incorrect */
-	} else
+	} else {
 		pattrib->tcpchk_valid = 0; /* invalid */
+	}
 	pattrib->mcs_rate = (u8)((le32_to_cpu(prxstat->rxdw3)) & 0x3f);
 	pattrib->htc = (u8)((le32_to_cpu(prxstat->rxdw3) >> 14) & 0x1);
 	/*Offset 16*/
@@ -414,8 +415,9 @@ static int amsdu_to_msdu(struct _adapter *padapter, union recv_frame *prframe)
 			if ((pattrib->tcpchk_valid == 1) &&
 			    (pattrib->tcp_chkrpt == 1)) {
 				sub_skb->ip_summed = CHECKSUM_UNNECESSARY;
-			} else
+			} else {
 				sub_skb->ip_summed = CHECKSUM_NONE;
+			}
 			netif_rx(sub_skb);
 		}
 	}
@@ -580,8 +582,9 @@ static int recv_indicatepkt_reorder(struct _adapter *padapter,
 			    !padapter->bSurpriseRemoved) {
 				r8712_recv_indicatepkt(padapter, prframe);
 				return _SUCCESS;
-			} else
+			} else {
 				return _FAIL;
+			}
 		}
 	}
 	spin_lock_irqsave(&ppending_recvframe_queue->lock, irql);
@@ -654,8 +657,9 @@ static int r8712_process_recv_indicatepkts(struct _adapter *padapter,
 		if (!padapter->bDriverStopped && !padapter->bSurpriseRemoved) {
 			/* indicate this recv_frame */
 			r8712_recv_indicatepkt(padapter, prframe);
-		} else
+		} else {
 			return _FAIL;
+		}
 	}
 	return retval;
 }
@@ -812,9 +816,9 @@ static void query_rx_phy_status(struct _adapter *padapter,
 		/*
 		 * (3) Get Signal Quality (EVM)
 		 */
-		if (pwdb_all > 40)
+		if (pwdb_all > 40) {
 			sq = 100;
-		else {
+		} else {
 			sq = pcck_buf->sq_rpt;
 			if (pcck_buf->sq_rpt > 64)
 				sq = 0;
drivers/staging/rtl8712/rtl8712_xmit.c +5 -5
index 2965919..02140b0 100644
@@ -98,11 +98,11 @@ static u32 get_ff_hwaddr(struct xmit_frame *pxmitframe)
 	struct _adapter *padapter = pxmitframe->padapter;
 	struct dvobj_priv *pdvobj = &padapter->dvobjpriv;
 
-	if (pxmitframe->frame_tag == TXAGG_FRAMETAG)
+	if (pxmitframe->frame_tag == TXAGG_FRAMETAG) {
 		addr = RTL8712_DMA_H2CCMD;
-	else if (pxmitframe->frame_tag == MGNT_FRAMETAG)
+	} else if (pxmitframe->frame_tag == MGNT_FRAMETAG) {
 		addr = RTL8712_DMA_MGTQ;
-	else if (pdvobj->nr_endpoint == 6) {
+	} else if (pdvobj->nr_endpoint == 6) {
 		switch (pattrib->priority) {
 		case 0:
 		case 3:
@@ -239,9 +239,9 @@ void r8712_do_queue_select(struct _adapter *padapter,
 	unsigned int qsel = 0;
 	struct dvobj_priv *pdvobj = &padapter->dvobjpriv;
 
-	if (pdvobj->nr_endpoint == 6)
+	if (pdvobj->nr_endpoint == 6) {
 		qsel = (unsigned int) pattrib->priority;
-	else if (pdvobj->nr_endpoint == 4) {
+	} else if (pdvobj->nr_endpoint == 4) {
 		qsel = (unsigned int) pattrib->priority;
 		if (qsel == 0 || qsel == 3)
 			qsel = 3;
drivers/staging/rtl8712/rtl871x_cmd.c +4 -3
index 8331781..1f6e69b 100644
@@ -137,9 +137,9 @@ static struct cmd_obj *_dequeue_cmd(struct  __queue *queue)
 	struct cmd_obj *obj;
 
 	spin_lock_irqsave(&(queue->lock), irqL);
-	if (list_empty(&(queue->queue)))
+	if (list_empty(&(queue->queue))) {
 		obj = NULL;
-	else {
+	} else {
 		obj = LIST_CONTAINOR(queue->queue.next,
 				     struct cmd_obj, list);
 		list_del_init(&obj->list);
@@ -538,8 +538,9 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		if (psecnetwork->IELength != tmp_len) {
 			psecnetwork->IELength = tmp_len;
 			pqospriv->qos_option = 1; /* WMM IE in beacon */
-		} else
+		} else {
 			pqospriv->qos_option = 0; /* no WMM IE in beacon */
+		}
 	}
 	if (pregistrypriv->ht_enable) {
 		/* For WEP mode, we will use the bg mode to do the connection
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +30 -20

147 lines not on this page · raw message

drivers/staging/rtl8712/rtl871x_ioctl_rtl.c +26 -14
index d8e62ec..b10b3e8 100644
@@ -58,8 +58,9 @@ uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 		*(u32 *)poid_par_priv->information_buf =
 				padapter->recvpriv.rx_smallpacket_crcerr;
 		*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-	} else
+	} else {
 		return RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return RNDIS_STATUS_SUCCESS;
 }
 
@@ -74,8 +75,9 @@ uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 		*(u32 *)poid_par_priv->information_buf =
 				padapter->recvpriv.rx_middlepacket_crcerr;
 		*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-	} else
+	} else {
 		return RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return RNDIS_STATUS_SUCCESS;
 }
 
@@ -90,8 +92,9 @@ uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv)
 		*(u32 *)poid_par_priv->information_buf =
 				 padapter->recvpriv.rx_largepacket_crcerr;
 		*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-	} else
+	} else {
 		return RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return RNDIS_STATUS_SUCCESS;
 }
 
@@ -122,8 +125,9 @@ uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv)
 					 padapter->recvpriv.rx_pkts +
 					 padapter->recvpriv.rx_drop;
 		*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-	} else
+	} else {
 		return RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return RNDIS_STATUS_SUCCESS;
 }
 
@@ -152,8 +156,9 @@ uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv)
 		*(uint *)poid_par_priv->information_buf =
 					 padapter->recvpriv.rx_icv_err;
 		*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-	} else
+	} else {
 		return RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return RNDIS_STATUS_SUCCESS;
 }
 
@@ -182,8 +187,9 @@ uint oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv)
 			preamblemode = 2;
 		*(u32 *)poid_par_priv->information_buf = preamblemode;
 		*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-	} else
+	} else {
 		return RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return RNDIS_STATUS_SUCCESS;
 }
 
@@ -239,8 +245,9 @@ uint oid_rt_set_preamble_mode_hdl(struct oid_par_priv
 			padapter->registrypriv.preamble = PREAMBLE_SHORT;
 		*(u32 *)poid_par_priv->information_buf = preamblemode;
 		*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-	} else
+	} else {
 		return RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return RNDIS_STATUS_SUCCESS;
 }
 
@@ -269,8 +276,9 @@ uint oid_rt_get_total_tx_bytes_hdl(struct oid_par_priv
 		*(u32 *)poid_par_priv->information_buf =
 						 padapter->xmitpriv.tx_bytes;
 		*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-	} else
+	} else {
 		return RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return RNDIS_STATUS_SUCCESS;
 }
 
@@ -287,8 +295,9 @@ uint oid_rt_get_total_rx_bytes_hdl(struct oid_par_priv
 					   padapter->recvpriv.rx_bytes;
 		*poid_par_priv->bytes_rw = poid_par_priv->
 					   information_buf_len;
-	} else
+	} else {
 		return RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return RNDIS_STATUS_SUCCESS;
 }
 
@@ -364,8 +373,9 @@ uint oid_rt_supported_wireless_mode_hdl(struct oid_par_priv
 		ulInfo |= 0x0400; /* WIRELESS_MODE_A */
 		*(u32 *) poid_par_priv->information_buf = ulInfo;
 		*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-	} else
+	} else {
 		return RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return RNDIS_STATUS_SUCCESS;
 }
 
@@ -451,8 +461,9 @@ uint oid_rt_pro_rf_write_registry_hdl(struct oid_par_priv*
 			(unsigned long)(*((unsigned long *)
 					poid_par_priv->information_buf + 2))))
 			status = RNDIS_STATUS_NOT_ACCEPTED;
-	} else
+	} else {
 		status = RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return status;
 }
 
@@ -465,9 +476,9 @@ uint oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv)
 	if (poid_par_priv->type_of_oid != SET_OID) /* QUERY_OID */
 		return RNDIS_STATUS_NOT_ACCEPTED;
 	if (poid_par_priv->information_buf_len == (sizeof(unsigned long)*3)) {
-		if (Adapter->mppriv.act_in_progress)
+		if (Adapter->mppriv.act_in_progress) {
 			status = RNDIS_STATUS_NOT_ACCEPTED;
-		else {
+		} else {
 			/* init workparam */
 			Adapter->mppriv.act_in_progress = true;
 			Adapter->mppriv.workparam.bcompleted = false;
@@ -489,8 +500,9 @@ uint oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv)
 			    io_value))
 				status = RNDIS_STATUS_NOT_ACCEPTED;
 		}
-	} else
+	} else {
 		status = RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return status;
 }
 
drivers/staging/rtl8712/rtl871x_ioctl_set.c +2 -1
index 67a2695..ab84a40 100644
@@ -207,9 +207,10 @@ void r8712_set_802_11_ssid(struct _adapter *padapter,
 						set_fwstate(pmlmepriv,
 							    WIFI_ADHOC_STATE);
 					}
-				} else
+				} else {
 					goto _Abort_Set_SSID; /* driver is in
 						  * WIFI_ADHOC_MASTER_STATE */
+				}
 			}
 		} else {
 			r8712_disassoc_cmd(padapter);
drivers/staging/rtl8712/rtl871x_mlme.c +18 -11
index c1890f5..98113c4 100644
@@ -191,8 +191,9 @@ sint r8712_if_up(struct _adapter *padapter)
 	if (padapter->bDriverStopped || padapter->bSurpriseRemoved ||
 	    !check_fwstate(&padapter->mlmepriv, _FW_LINKED)) {
 		res = false;
-	} else
+	} else {
 		res = true;
+	}
 	return res;
 }
 
@@ -354,8 +355,9 @@ static void update_network(struct wlan_bssid_ex *dst,
 		padapter->recvpriv.signal = (u8)tmpVal;
 
 		src->Rssi = padapter->recvpriv.signal;
-	} else
+	} else {
 		src->Rssi = (src->Rssi + dst->Rssi) / 2;
+	}
 	memcpy((u8 *)dst, (u8 *)src, r8712_get_wlan_bssid_ex_sz(src));
 }
 
@@ -552,9 +554,9 @@ 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)) {
-		if (pnetwork->Ssid.Ssid[0] != 0)
+		if (pnetwork->Ssid.Ssid[0] != 0) {
 			rtl8711_add_network(adapter, pnetwork);
-		else {
+		} else {
 			pnetwork->Ssid.SsidLength = 8;
 			memcpy(pnetwork->Ssid.Ssid, "<hidden>", 8);
 			rtl8711_add_network(adapter, pnetwork);
@@ -719,8 +721,9 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 			return;
 		memcpy((u8 *)pnetwork+16, (u8 *)pbuf + 8,
 			sizeof(struct wlan_network) - 16);
-	} else
+	} else {
 		pnetwork = (struct wlan_network *)pbuf;
+	}
 
 #ifdef __BIG_ENDIAN
 	/* endian_convert */
@@ -767,12 +770,12 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 		if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
 			/*s1. find ptarget_wlan*/
 			if (check_fwstate(pmlmepriv, _FW_LINKED)) {
-				if (the_same_macaddr)
+				if (the_same_macaddr) {
 					ptarget_wlan =
 					    r8712_find_network(&pmlmepriv->
 					    scanned_queue,
 					    cur_network->network.MacAddress);
-				else {
+				} else {
 					pcur_wlan =
 					     r8712_find_network(&pmlmepriv->
 					     scanned_queue,
@@ -821,10 +824,11 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 						ptarget_sta =
 						 r8712_alloc_stainfo(pstapriv,
 						 pnetwork->network.MacAddress);
-				} else
+				} else {
 					ptarget_sta =
 						 r8712_alloc_stainfo(pstapriv,
 						 pnetwork->network.MacAddress);
+				}
 				if (ptarget_sta) /*update ptarget_sta*/ {
 					ptarget_sta->aid = pnetwork->join_res;
 					ptarget_sta->qos_option = 1;
@@ -900,8 +904,9 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 			if (check_fwstate(pmlmepriv, WIFI_STATION_STATE))
 				r8712_indicate_connect(adapter);
 			del_timer(&pmlmepriv->assoc_timer);
-		} else
+		} else {
 			goto ignore_joinbss_callback;
+		}
 	} else {
 		if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
 			mod_timer(&pmlmepriv->assoc_timer,
@@ -1163,8 +1168,9 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
 				}
 				goto ask_for_joinbss;
 			}
-		} else if (pmlmepriv->assoc_ssid.SsidLength == 0)
+		} else if (pmlmepriv->assoc_ssid.SsidLength == 0) {
 			goto ask_for_joinbss;
+		}
 		dst_ssid = pnetwork->network.Ssid.Ssid;
 		src_ssid = pmlmepriv->assoc_ssid.Ssid;
 		if ((pnetwork->network.Ssid.SsidLength ==
@@ -1178,8 +1184,9 @@ int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv)
 					if (pnetwork->network.Rssi >
 					    pnetwork_max_rssi->network.Rssi)
 						pnetwork_max_rssi = pnetwork;
-				} else
+				} else {
 					pnetwork_max_rssi = pnetwork;
+				}
 			} else if (is_desired_network(adapter, pnetwork)) {
 				if (check_fwstate(pmlmepriv, _FW_LINKED)) {
 					r8712_disassoc_cmd(adapter);
drivers/staging/rtl8712/rtl871x_mp.c +4 -2
index 26201ea..6783055 100644
@@ -237,8 +237,9 @@ static u8 set_bb_reg(struct _adapter *pAdapter,
 		org_value = r8712_bb_reg_read(pAdapter, offset);
 		bit_shift = bitshift(bitmask);
 		new_value = ((org_value & (~bitmask)) | (value << bit_shift));
-	} else
+	} else {
 		new_value = value;
+	}
 	return r8712_bb_reg_write(pAdapter, offset, new_value);
 }
 
@@ -262,8 +263,9 @@ static u8 set_rf_reg(struct _adapter *pAdapter, u8 path, u8 offset, u32 bitmask,
 		org_value = r8712_rf_reg_read(pAdapter, path, offset);
 		bit_shift = bitshift(bitmask);
 		new_value = ((org_value & (~bitmask)) | (value << bit_shift));
-	} else
+	} else {
 		new_value = value;
+	}
 	return r8712_rf_reg_write(pAdapter, path, offset, new_value);
 }
 
drivers/staging/rtl8712/rtl871x_mp_ioctl.c +12 -6
index 7b00c35..26786ad 100644
@@ -56,8 +56,9 @@ uint oid_rt_wireless_mode_hdl(struct oid_par_priv *poid_par_priv)
 					 Adapter->registrypriv.wireless_mode;
 			*poid_par_priv->bytes_rw =
 					poid_par_priv->information_buf_len;
-		} else
+		} else {
 			status = RNDIS_STATUS_INVALID_LENGTH;
+		}
 	} else {
 		status = RNDIS_STATUS_NOT_ACCEPTED;
 	}
@@ -178,8 +179,9 @@ static int mp_start_test(struct _adapter *padapter)
 	if (length % 4) {
 		/*round up to multiple of 4 bytes.*/
 		bssid.Length = ((length >> 2) + 1) << 2;
-	} else
+	} else {
 		bssid.Length = length;
+	}
 	spin_lock_irqsave(&pmlmepriv->lock, irqL);
 	if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
 		goto end_of_mp_start_test;
@@ -388,8 +390,9 @@ uint oid_rt_pro_query_tx_packet_sent_hdl(
 		*(u32 *)poid_par_priv->information_buf =
 					Adapter->mppriv.tx_pktcount;
 		*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-	} else
+	} else {
 		status = RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return status;
 }
 
@@ -408,8 +411,9 @@ uint oid_rt_pro_query_rx_packet_received_hdl(
 		*(u32 *)poid_par_priv->information_buf =
 					Adapter->mppriv.rx_pktcount;
 		*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-	} else
+	} else {
 		status = RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return status;
 }
 
@@ -428,8 +432,9 @@ uint oid_rt_pro_query_rx_packet_crc32_error_hdl(
 		*(u32 *)poid_par_priv->information_buf =
 					Adapter->mppriv.rx_crcerrpktcount;
 		*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len;
-	} else
+	} else {
 		status = RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return status;
 }
 
@@ -457,8 +462,9 @@ uint oid_rt_pro_reset_rx_packet_received_hdl(struct oid_par_priv
 	if (poid_par_priv->information_buf_len == sizeof(u32)) {
 		Adapter->mppriv.rx_pktcount = 0;
 		Adapter->mppriv.rx_crcerrpktcount = 0;
-	} else
+	} else {
 		status = RNDIS_STATUS_INVALID_LENGTH;
+	}
 	return status;
 }
 
drivers/staging/rtl8712/rtl871x_recv.c +16 -11
index 8a54436..e9dc1f4 100644
@@ -112,9 +112,9 @@ union recv_frame *r8712_alloc_recvframe(struct  __queue *pfree_recv_queue)
 	struct recv_priv *precvpriv;
 
 	spin_lock_irqsave(&pfree_recv_queue->lock, irqL);
-	if (list_empty(&pfree_recv_queue->queue))
+	if (list_empty(&pfree_recv_queue->queue)) {
 		precvframe = NULL;
-	else {
+	} else {
 		phead = &pfree_recv_queue->queue;
 		plist = phead->next;
 		precvframe = LIST_CONTAINOR(plist, union recv_frame, u);
@@ -180,8 +180,9 @@ sint r8712_recvframe_chkmic(struct _adapter *adapter,
 					 6) & 0x3)) - 1].skey[0];
 				if (!psecuritypriv->binstallGrpkey)
 					return _FAIL;
-			} else
+			} else {
 				mickey = &stainfo->tkiprxmickey.skey[0];
+			}
 			/*icv_len included the mic code*/
 			datalen = precvframe->u.hdr.len - prxattrib->hdrlen -
 				  prxattrib->iv_len - prxattrib->icv_len - 8;
@@ -239,8 +240,9 @@ union recv_frame *r8712_decryptor(struct _adapter *padapter,
 		default:
 				break;
 		}
-	} else if (prxattrib->bdecrypted == 1)
+	} else if (prxattrib->bdecrypted == 1) {
 		psecuritypriv->hw_decrypted = true;
+	}
 	return return_packet;
 }
 /*###set the security information in the recv_frame */
@@ -270,9 +272,9 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter,
 		if ((psta != NULL) && (psta->ieee8021x_blocked)) {
 			/* blocked
 			 * only accept EAPOL frame */
-			if (ether_type == 0x888e)
+			if (ether_type == 0x888e) {
 				prtnframe = precv_frame;
-			else {
+			} else {
 				/*free this frame*/
 				r8712_free_recvframe(precv_frame,
 					 &adapter->recvpriv.free_recv_queue);
@@ -289,8 +291,9 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter,
 				prtnframe = precv_frame;
 			}
 		}
-	} else
+	} else {
 		prtnframe = precv_frame;
+	}
 	return prtnframe;
 }
 
@@ -341,7 +344,7 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
 		if (memcmp(pattrib->bssid, pattrib->src, ETH_ALEN))
 			return _FAIL;
 	       sta_addr = pattrib->bssid;
-	 } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
+	} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
 		if (bmcast) {
 			/* For AP mode, if DA == MCAST, then BSSID should
 			 * be also MCAST */
@@ -354,15 +357,16 @@ static sint sta2sta_data_frame(struct _adapter *adapter,
 				return _FAIL;
 			sta_addr = pattrib->src;
 		}
-	  } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
+	} else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
 		memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN);
 		memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN);
 		memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN);
 		memcpy(pattrib->ra, pattrib->dst, ETH_ALEN);
 		memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
 		sta_addr = mybssid;
-	  } else
+	} else {
 		ret  = _FAIL;
+	}
 	if (bmcast)
 		*psta = r8712_get_bcmc_stainfo(adapter);
 	else
@@ -429,8 +433,9 @@ static sint ap2sta_data_frame(struct _adapter *adapter,
 		*psta = r8712_get_stainfo(pstapriv, pattrib->bssid);
 		if (*psta == NULL)
 			return _FAIL;
-	} else
+	} else {
 		return _FAIL;
+	}
 	return _SUCCESS;
 }
 
drivers/staging/rtl8712/rtl871x_security.c +14 -7
index 48b0557..1d7888a 100644
@@ -636,8 +636,9 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe)
 					pframe = (u8 *)RND4((addr_t)(pframe));
 				}
 			}
-		} else
+		} else {
 			res = _FAIL;
+		}
 	}
 	return res;
 }
@@ -677,8 +678,9 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe)
 					 ((idx >> 6) & 0x3) - 1].skey[0];
 				if (!psecuritypriv->binstallGrpkey)
 					return _FAIL;
-			} else
+			} else {
 				prwskey = &stainfo->x_UncstKey.skey[0];
+			}
 			GET_TKIP_PN(iv, txpn);
 			pnl = (u16)(txpn.val);
 			pnh = (u32)(txpn.val >> 16);
@@ -696,8 +698,9 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe)
 			    crc[1] != payload[length - 3] ||
 			    crc[0] != payload[length - 4])
 				return _FAIL;
-		} else
+		} else {
 			return _FAIL;
+		}
 	}
 	return _SUCCESS;
 }
@@ -1069,8 +1072,9 @@ static sint aes_cipher(u8 *key, uint	hdrlen,
 			if (hdrlen !=  WLAN_HDR_A3_QOS_LEN)
 				hdrlen += 2;
 			qc_exists = 1;
-	} else
+	} else {
 		qc_exists = 0;
+	}
 	pn_vector[0] = pframe[hdrlen];
 	pn_vector[1] = pframe[hdrlen+1];
 	pn_vector[2] = pframe[hdrlen+4];
@@ -1188,8 +1192,9 @@ u32 r8712_aes_encrypt(struct _adapter *padapter, u8 *pxmitframe)
 					pframe = (u8 *)RND4((addr_t)(pframe));
 				}
 			}
-		} else
+		} else {
 			res = _FAIL;
+		}
 	}
 	return res;
 }
@@ -1377,14 +1382,16 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe)
 				if (!psecuritypriv->binstallGrpkey)
 					return _FAIL;
 
-			} else
+			} else {
 				prwskey = &stainfo->x_UncstKey.skey[0];
+			}
 			length = ((union recv_frame *)precvframe)->
 				 u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len;
 			aes_decipher(prwskey, prxattrib->hdrlen, pframe,
 				     length);
-		} else
+		} else {
 			return _FAIL;
+		}
 	}
 	return _SUCCESS;
 }
drivers/staging/rtl8712/rtl871x_sta_mgt.c +2 -2
index 400dfb6..162e61c 100644
@@ -117,9 +117,9 @@ struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
 
 	pfree_sta_queue = &pstapriv->free_sta_queue;
 	spin_lock_irqsave(&(pfree_sta_queue->lock), flags);
-	if (list_empty(&pfree_sta_queue->queue))
+	if (list_empty(&pfree_sta_queue->queue)) {
 		psta = NULL;
-	else {
+	} else {
 		psta = LIST_CONTAINOR(pfree_sta_queue->queue.next,
 				      struct sta_info, list);
 		list_del_init(&(psta->list));
drivers/staging/rtl8712/rtl871x_xmit.c +20 -17
index d414139..eb41f76 100644
@@ -293,9 +293,9 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
 	/* get ether_hdr_len */
 	pattrib->pkt_hdrlen = ETH_HLEN;
 
-	if (pqospriv->qos_option)
+	if (pqospriv->qos_option) {
 		r8712_set_qos(&pktfile, pattrib);
-	else {
+	} else {
 		pattrib->hdrlen = WLAN_HDR_A3_LEN;
 		pattrib->subtype = WIFI_DATA_TYPE;
 		pattrib->priority = 0;
@@ -305,8 +305,9 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
 		if ((pattrib->ether_type != 0x888e) &&
 		    !check_fwstate(pmlmepriv, WIFI_MP_STATE))
 			return _FAIL;
-	} else
+	} else {
 		GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, bmcast);
+	}
 	switch (pattrib->encrypt) {
 	case _WEP40_:
 	case _WEP104_:
@@ -509,8 +510,9 @@ static sint make_wlanhdr(struct _adapter *padapter, u8 *hdr,
 			memcpy(pwlanhdr->addr2, pattrib->src, ETH_ALEN);
 			memcpy(pwlanhdr->addr3, get_bssid(pmlmepriv),
 				ETH_ALEN);
-		} else
+		} else {
 			return _FAIL;
+		}
 
 		if (pattrib->encrypt)
 			SetPrivacy(fctrl);
@@ -526,9 +528,9 @@ static sint make_wlanhdr(struct _adapter *padapter, u8 *hdr,
 			struct sta_info *psta;
 			sint bmcst = IS_MCAST(pattrib->ra);
 
-			if (pattrib->psta)
+			if (pattrib->psta) {
 				psta = pattrib->psta;
-			else {
+			} else {
 				if (bmcst)
 					psta = r8712_get_bcmc_stainfo(padapter);
 				else
@@ -719,17 +721,18 @@ void r8712_update_protection(struct _adapter *padapter, u8 *ie, uint ie_len)
 	case AUTO_VCS:
 	default:
 		perp = r8712_get_ie(ie, _ERPINFO_IE_, &erp_len, ie_len);
-		if (perp == NULL)
+		if (perp == NULL) {
 			pxmitpriv->vcs = NONE_VCS;
-		else {
+		} else {
 			protection = (*(perp + 2)) & BIT(1);
 			if (protection) {
 				if (pregistrypriv->vcs_type == RTS_CTS)
 					pxmitpriv->vcs = RTS_CTS;
 				else
 					pxmitpriv->vcs = CTS_TO_SELF;
-			} else
+			} else {
 				pxmitpriv->vcs = NONE_VCS;
+			}
 		}
 		break;
 	}
@@ -743,9 +746,9 @@ struct xmit_buf *r8712_alloc_xmitbuf(struct xmit_priv *pxmitpriv)
 	struct  __queue *pfree_xmitbuf_queue = &pxmitpriv->free_xmitbuf_queue;
 
 	spin_lock_irqsave(&pfree_xmitbuf_queue->lock, irqL);
-	if (list_empty(&pfree_xmitbuf_queue->queue))
+	if (list_empty(&pfree_xmitbuf_queue->queue)) {
 		pxmitbuf = NULL;
-	else {
+	} else {
 		phead = &pfree_xmitbuf_queue->queue;
 		plist = phead->next;
 		pxmitbuf = LIST_CONTAINOR(plist, struct xmit_buf, list);
@@ -797,9 +800,9 @@ struct xmit_frame *r8712_alloc_xmitframe(struct xmit_priv *pxmitpriv)
 	struct  __queue *pfree_xmit_queue = &pxmitpriv->free_xmit_queue;
 
 	spin_lock_irqsave(&pfree_xmit_queue->lock, irqL);
-	if (list_empty(&pfree_xmit_queue->queue))
+	if (list_empty(&pfree_xmit_queue->queue)) {
 		pxframe =  NULL;
-	else {
+	} else {
 		phead = &pfree_xmit_queue->queue;
 		plist = phead->next;
 		pxframe = LIST_CONTAINOR(plist, struct xmit_frame, list);
@@ -917,12 +920,12 @@ sint r8712_xmit_classifier(struct _adapter *padapter,
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	sint bmcst = IS_MCAST(pattrib->ra);
 
-	if (pattrib->psta)
+	if (pattrib->psta) {
 		psta = pattrib->psta;
-	else {
-		if (bmcst)
+	} else {
+		if (bmcst) {
 			psta = r8712_get_bcmc_stainfo(padapter);
-		else {
+		} else {
 			if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
 				psta = r8712_get_stainfo(pstapriv,
 				       get_bssid(pmlmepriv));
drivers/staging/rtl8712/usb_halinit.c +2 -1
index b4ae11a..944df85 100644
@@ -285,8 +285,9 @@ u8 r8712_usb_hal_bus_init(struct _adapter *padapter)
 			/* Reset TxDMA */
 			r8712_write8(padapter, CR, val8|_TXDMA_EN);
 		}
-	} else
+	} else {
 		ret = _FAIL;
+	}
 	return ret;
 }
 
drivers/staging/rtl8712/usb_intf.c +5 -4
index 5c11db9..4366b12 100644
@@ -394,9 +394,9 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
 	/* step 3.
 	 * initialize the dvobj_priv
 	 */
-	if (!padapter->dvobj_init)
-			goto error;
-	else {
+	if (!padapter->dvobj_init) {
+		goto error;
+	} else {
 		status = padapter->dvobj_init(padapter);
 		if (status != _SUCCESS)
 			goto error;
@@ -552,8 +552,9 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
 				padapter->ledpriv.bRegUseLed = false;
 				break;
 			}
-		} else
+		} else {
 			AutoloadFail = false;
+		}
 		if (((mac[0] == 0xff) && (mac[1] == 0xff) &&
 		     (mac[2] == 0xff) && (mac[3] == 0xff) &&
 		     (mac[4] == 0xff) && (mac[5] == 0xff)) ||
drivers/staging/rtl8712/usb_ops_linux.c +4 -2
index e33eeed..f35b3b6 100644
@@ -144,8 +144,9 @@ static unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr)
 			pipe = usb_sndbulkpipe(pusbd, 0x0d);
 			break;
 		}
-	} else
+	} else {
 	   pipe = 0;
+	}
 	return pipe;
 }
 
@@ -306,8 +307,9 @@ u32 r8712_usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
 		err = usb_submit_urb(purb, GFP_ATOMIC);
 		if ((err) && (err != (-EPERM)))
 			ret = _FAIL;
-	} else
+	} else {
 		ret = _FAIL;
+	}
 	return ret;
 }
 
Signature · 1 line
2.5.3
#5 lore raw

PATCH v2 3/3 staging: rtl8712: spaces preferred around operands

In reply to Luis de Bethencourt

Clean up all instances of checkpatch.pl checks:
CHECK: spaces preferred around that '+'
(and other operands)

---
 drivers/staging/rtl8712/ieee80211.c           |  21 ++---
 drivers/staging/rtl8712/mlme_linux.c          |   2 +-
 drivers/staging/rtl8712/os_intfs.c            |   2 +-
 drivers/staging/rtl8712/rtl8712_cmd.c         |  12 +--
 drivers/staging/rtl8712/rtl8712_efuse.c       |  74 +++++++++---------
 drivers/staging/rtl8712/rtl8712_led.c         |   8 +-
 drivers/staging/rtl8712/rtl8712_recv.c        |  12 +--
 drivers/staging/rtl8712/rtl8712_xmit.c        |  60 +++++++-------
 drivers/staging/rtl8712/rtl871x_cmd.c         |  10 +--
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c |  47 +++++------
 drivers/staging/rtl8712/rtl871x_ioctl_rtl.c   |   3 +-
 drivers/staging/rtl8712/rtl871x_ioctl_set.c   |   4 +-
 drivers/staging/rtl8712/rtl871x_mlme.c        |  40 +++++-----
 drivers/staging/rtl8712/rtl871x_mp.c          |  17 ++--
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c    |   4 +-
 drivers/staging/rtl8712/rtl871x_recv.c        |   8 +-
 drivers/staging/rtl8712/rtl871x_security.c    | 108 ++++++++++++++------------
 drivers/staging/rtl8712/rtl871x_xmit.c        |  20 ++---
 drivers/staging/rtl8712/usb_halinit.c         |  10 +--
 drivers/staging/rtl8712/usb_intf.c            |   4 +-
 drivers/staging/rtl8712/usb_ops.c             |  20 ++---
 drivers/staging/rtl8712/usb_ops_linux.c       |   4 +-
 22 files changed, 256 insertions(+), 234 deletions(-)
drivers/staging/rtl8712/ieee80211.c +11 -10
index 3c38fcb..974ca02 100644
@@ -336,7 +336,8 @@ int r8712_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher,
 		/* No RSN IE - fail silently */
 		return _FAIL;
 	}
-	if ((*rsn_ie != _WPA2_IE_ID_) || (*(rsn_ie+1) != (u8)(rsn_ie_len - 2)))
+	if ((*rsn_ie != _WPA2_IE_ID_) ||
+	    (*(rsn_ie + 1) != (u8)(rsn_ie_len - 2)))
 		return _FAIL;
 	pos = rsn_ie;
 	pos += 4;
@@ -381,16 +382,16 @@ int r8712_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,
 		if ((authmode == _WPA_IE_ID_) &&
 		    (!memcmp(&in_ie[cnt + 2], &wpa_oui[0], 4))) {
 			memcpy(wpa_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
-			*wpa_len = in_ie[cnt+1]+2;
+			*wpa_len = in_ie[cnt + 1] + 2;
 			cnt += in_ie[cnt + 1] + 2;  /*get next */
 		} else {
 			if (authmode == _WPA2_IE_ID_) {
 				memcpy(rsn_ie, &in_ie[cnt],
 					in_ie[cnt + 1] + 2);
-				*rsn_len = in_ie[cnt+1] + 2;
-				cnt += in_ie[cnt+1] + 2;  /*get next*/
+				*rsn_len = in_ie[cnt + 1] + 2;
+				cnt += in_ie[cnt + 1] + 2;  /*get next*/
 			} else {
-				cnt += in_ie[cnt+1] + 2;   /*get next*/
+				cnt += in_ie[cnt + 1] + 2;   /*get next*/
 			}
 		}
 	}
@@ -408,14 +409,14 @@ int r8712_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen)
 	while (cnt < in_len) {
 		eid = in_ie[cnt];
 		if ((eid == _WPA_IE_ID_) &&
-		    (!memcmp(&in_ie[cnt+2], wps_oui, 4))) {
-			memcpy(wps_ie, &in_ie[cnt], in_ie[cnt+1]+2);
-			*wps_ielen = in_ie[cnt+1]+2;
-			cnt += in_ie[cnt+1]+2;
+		    (!memcmp(&in_ie[cnt + 2], wps_oui, 4))) {
+			memcpy(wps_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
+			*wps_ielen = in_ie[cnt + 1] + 2;
+			cnt += in_ie[cnt + 1] + 2;
 			match = true;
 			break;
 		}
-			cnt += in_ie[cnt+1]+2; /* goto next */
+			cnt += in_ie[cnt + 1] + 2; /* goto next */
 	}
 	return match;
 }
drivers/staging/rtl8712/mlme_linux.c +1 -1
index 6d253bf..e4e4bde 100644
@@ -163,7 +163,7 @@ void r8712_report_sec_ie(struct _adapter *adapter, u8 authmode, u8 *sec_ie)
 			p += sprintf(p, "%02x", sec_ie[i]);
 		p += sprintf(p, ")");
 		memset(&wrqu, 0, sizeof(wrqu));
-		wrqu.data.length = p-buff;
+		wrqu.data.length = p - buff;
 		wrqu.data.length = (wrqu.data.length < IW_CUSTOM_MAX) ?
 				   wrqu.data.length : IW_CUSTOM_MAX;
 		wireless_send_event(adapter->pnetdev, IWEVCUSTOM, &wrqu, buff);
drivers/staging/rtl8712/os_intfs.c +1 -1
index 92ab59d..b89e2d3 100644
@@ -97,7 +97,7 @@ static char *initmac;
  */
 static int wifi_test;
 
-module_param_string(ifname, ifname, sizeof(ifname), S_IRUGO|S_IWUSR);
+module_param_string(ifname, ifname, sizeof(ifname), S_IRUGO | S_IWUSR);
 module_param(wifi_test, int, 0644);
 module_param(initmac, charp, 0644);
 module_param(video_mode, int, 0644);
drivers/staging/rtl8712/rtl8712_cmd.c +6 -6
index ac6c22f..9b91609 100644
@@ -62,7 +62,7 @@ static void check_hw_pbc(struct _adapter *padapter)
 	tmp1byte = r8712_read8(padapter, GPIO_CTRL);
 	if (tmp1byte == 0xff)
 		return;
-	if (tmp1byte&HAL_8192S_HW_GPIO_WPS_BIT) {
+	if (tmp1byte & HAL_8192S_HW_GPIO_WPS_BIT) {
 		/* Here we only set bPbcPressed to true
 		 * After trigger PBC, the variable will be set to false
 		 */
@@ -345,7 +345,7 @@ _next:
 			pcmdpriv->cmd_issued_cnt++;
 			cmdsz = round_up(pcmd->cmdsz, 8);
 			wr_sz = TXDESC_SIZE + 8 + cmdsz;
-			pdesc->txdw0 |= cpu_to_le32((wr_sz-TXDESC_SIZE) &
+			pdesc->txdw0 |= cpu_to_le32((wr_sz - TXDESC_SIZE) &
 						     0x0000ffff);
 			if (pdvobj->ishighspeed) {
 				if ((wr_sz % 512) == 0)
@@ -443,20 +443,20 @@ void r8712_event_handle(struct _adapter *padapter, uint *peventbuf)
 	}
 	/* checking if event code is valid */
 	if (evt_code >= MAX_C2HEVT) {
-		pevt_priv->event_seq = ((evt_seq+1) & 0x7f);
+		pevt_priv->event_seq = ((evt_seq + 1) & 0x7f);
 		goto _abort_event_;
 	} else if ((evt_code == GEN_EVT_CODE(_Survey)) &&
 		   (evt_sz > sizeof(struct wlan_bssid_ex))) {
-		pevt_priv->event_seq = ((evt_seq+1)&0x7f);
+		pevt_priv->event_seq = ((evt_seq + 1) & 0x7f);
 		goto _abort_event_;
 	}
 	/* checking if event size match the event parm size */
 	if ((wlanevents[evt_code].parmsize) &&
 	    (wlanevents[evt_code].parmsize != evt_sz)) {
-		pevt_priv->event_seq = ((evt_seq+1)&0x7f);
+		pevt_priv->event_seq = ((evt_seq + 1) & 0x7f);
 		goto _abort_event_;
 	} else if ((evt_sz == 0) && (evt_code != GEN_EVT_CODE(_WPS_PBC))) {
-		pevt_priv->event_seq = ((evt_seq+1)&0x7f);
+		pevt_priv->event_seq = ((evt_seq + 1) & 0x7f);
 		goto _abort_event_;
 	}
 	pevt_priv->event_seq++;	/* update evt_seq */
drivers/staging/rtl8712/rtl8712_efuse.c +39 -35

181 lines not on this page · raw message

drivers/staging/rtl8712/rtl8712_led.c +4 -4
index 79981b5..9055827 100644
@@ -130,11 +130,11 @@ static void SwLedOn(struct _adapter *padapter, struct LED_871x *pLed)
 		break;
 	case LED_PIN_LED0:
 		/* SW control led0 on.*/
-		r8712_write8(padapter, LEDCFG, LedCfg&0xf0);
+		r8712_write8(padapter, LEDCFG, LedCfg & 0xf0);
 		break;
 	case LED_PIN_LED1:
 		/* SW control led1 on.*/
-		r8712_write8(padapter, LEDCFG, LedCfg&0x0f);
+		r8712_write8(padapter, LEDCFG, LedCfg & 0x0f);
 		break;
 	default:
 		break;
@@ -158,11 +158,11 @@ static void SwLedOff(struct _adapter *padapter, struct LED_871x *pLed)
 		break;
 	case LED_PIN_LED0:
 		LedCfg &= 0xf0; /* Set to software control.*/
-		r8712_write8(padapter, LEDCFG, (LedCfg|BIT(3)));
+		r8712_write8(padapter, LEDCFG, (LedCfg | BIT(3)));
 		break;
 	case LED_PIN_LED1:
 		LedCfg &= 0x0f; /* Set to software control.*/
-		r8712_write8(padapter, LEDCFG, (LedCfg|BIT(7)));
+		r8712_write8(padapter, LEDCFG, (LedCfg | BIT(7)));
 		break;
 	default:
 		break;
drivers/staging/rtl8712/rtl8712_recv.c +6 -6
index b6b2b42..d187508 100644
@@ -89,7 +89,7 @@ int r8712_init_recv_priv(struct recv_priv *precvpriv, struct _adapter *padapter)
 		       RECVBUFF_ALIGN_SZ);
 		if (pskb) {
 			tmpaddr = (addr_t)pskb->data;
-			alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
+			alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1);
 			skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignment));
 			skb_queue_tail(&precvpriv->free_recv_skb_queue, pskb);
 		}
@@ -160,7 +160,7 @@ static void update_recvframe_attrib_from_recvstat(struct rx_pkt_attrib *pattrib,
 {
 	u16 drvinfo_sz;
 
-	drvinfo_sz = (le32_to_cpu(prxstat->rxdw0)&0x000f0000)>>16;
+	drvinfo_sz = (le32_to_cpu(prxstat->rxdw0) & 0x000f0000) >> 16;
 	drvinfo_sz <<= 3;
 	/*TODO:
 	 * Offset 0 */
@@ -825,7 +825,7 @@ static void query_rx_phy_status(struct _adapter *padapter,
 			else if (pcck_buf->sq_rpt < 20)
 				sq = 100;
 			else
-				sq = ((64-sq) * 100) / 44;
+				sq = ((64 - sq) * 100) / 44;
 		}
 		prframe->u.hdr.attrib.signal_qual = sq;
 		prframe->u.hdr.attrib.rx_mimo_signal_qual[0] = sq;
@@ -1022,8 +1022,8 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb)
 	pfree_recv_queue = &(precvpriv->free_recv_queue);
 	pbuf = pskb->data;
 	prxstat = (struct recv_stat *)pbuf;
-	pkt_cnt = (le32_to_cpu(prxstat->rxdw2)>>16)&0xff;
-	pkt_len =  le32_to_cpu(prxstat->rxdw0)&0x00003fff;
+	pkt_cnt = (le32_to_cpu(prxstat->rxdw2) >> 16) & 0xff;
+	pkt_len =  le32_to_cpu(prxstat->rxdw0) & 0x00003fff;
 	transfer_len = pskb->len;
 	/* Test throughput with Netgear 3700 (No security) with Chariot 3T3R
 	 * pairs. The packet count will be a big number so that the containing
@@ -1035,7 +1035,7 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb)
 	}
 	do {
 		prxstat = (struct recv_stat *)pbuf;
-		pkt_len =  le32_to_cpu(prxstat->rxdw0)&0x00003fff;
+		pkt_len =  le32_to_cpu(prxstat->rxdw0) & 0x00003fff;
 		/* more fragment bit */
 		mf = (le32_to_cpu(prxstat->rxdw1) >> 27) & 0x1;
 		/* ragmentation number */
drivers/staging/rtl8712/rtl8712_xmit.c +33 -27

150 lines not on this page · raw message

drivers/staging/rtl8712/rtl871x_cmd.c +5 -5
index 1f6e69b..562a102 100644
@@ -70,7 +70,7 @@ static sint _init_cmd_priv(struct cmd_priv *pcmdpriv)
 		return _FAIL;
 	pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf  +  CMDBUFF_ALIGN_SZ -
 			    ((addr_t)(pcmdpriv->cmd_allocated_buf) &
-			    (CMDBUFF_ALIGN_SZ-1));
+			    (CMDBUFF_ALIGN_SZ - 1));
 	pcmdpriv->rsp_allocated_buf = kmalloc(MAX_RSPSZ + 4, GFP_ATOMIC);
 	if (pcmdpriv->rsp_allocated_buf == NULL)
 		return _FAIL;
@@ -485,7 +485,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		return _FAIL;
 
 	/* for hidden ap to set fw_state here */
-	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
+	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE) !=
 	    true) {
 		switch (ndis_network_mode) {
 		case Ndis802_11IBSS:
@@ -508,12 +508,12 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
-	if ((psecnetwork->IELength-12) < (256 - 1))
+	if ((psecnetwork->IELength - 12) < (256 - 1))
 		memcpy(&psecuritypriv->authenticator_ie[1],
-			&psecnetwork->IEs[12], psecnetwork->IELength-12);
+			&psecnetwork->IEs[12], psecnetwork->IELength - 12);
 	else
 		memcpy(&psecuritypriv->authenticator_ie[1],
-			&psecnetwork->IEs[12], (256-1));
+			&psecnetwork->IEs[12], (256 - 1));
 	psecnetwork->IELength = 0;
 	/* If the driver wants to use the bssid to create the connection.
 	 * If not,  we copy the connecting AP's MAC address to it so that
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +25 -22

158 lines not on this page · raw message

drivers/staging/rtl8712/rtl871x_ioctl_rtl.c +2 -1
index b10b3e8..7c346a4 100644
@@ -475,7 +475,8 @@ uint oid_rt_pro_rf_read_registry_hdl(struct oid_par_priv *poid_par_priv)
 
 	if (poid_par_priv->type_of_oid != SET_OID) /* QUERY_OID */
 		return RNDIS_STATUS_NOT_ACCEPTED;
-	if (poid_par_priv->information_buf_len == (sizeof(unsigned long)*3)) {
+	if (poid_par_priv->information_buf_len == (sizeof(unsigned long) *
+						   3)) {
 		if (Adapter->mppriv.act_in_progress) {
 			status = RNDIS_STATUS_NOT_ACCEPTED;
 		} else {
drivers/staging/rtl8712/rtl871x_ioctl_set.c +2 -2
index ab84a40..f772675 100644
@@ -180,11 +180,11 @@ void r8712_set_802_11_ssid(struct _adapter *padapter,
 	if (!padapter->hw_init_completed)
 		return;
 	spin_lock_irqsave(&pmlmepriv->lock, irqL);
-	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING)) {
+	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING)) {
 		check_fwstate(pmlmepriv, _FW_UNDER_LINKING);
 		goto _Abort_Set_SSID;
 	}
-	if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) {
+	if (check_fwstate(pmlmepriv, _FW_LINKED | WIFI_ADHOC_MASTER_STATE)) {
 		if ((pmlmepriv->assoc_ssid.SsidLength == ssid->SsidLength) &&
 		    (!memcmp(&pmlmepriv->assoc_ssid.Ssid, ssid->Ssid,
 		    ssid->SsidLength))) {
drivers/staging/rtl8712/rtl871x_mlme.c +20 -20
index 98113c4..b22dbd5 100644
@@ -205,8 +205,8 @@ void r8712_generate_random_ibss(u8 *pibss)
 	pibss[1] = 0x11;
 	pibss[2] = 0x87;
 	pibss[3] = (u8)(curtime & 0xff);
-	pibss[4] = (u8)((curtime>>8) & 0xff);
-	pibss[5] = (u8)((curtime>>16) & 0xff);
+	pibss[4] = (u8)((curtime >> 8) & 0xff);
+	pibss[5] = (u8)((curtime >> 16) & 0xff);
 }
 
 uint r8712_get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss)
@@ -635,7 +635,7 @@ void r8712_free_assoc_resources(struct _adapter *adapter)
 	pwlan = r8712_find_network(&pmlmepriv->scanned_queue,
 				   tgt_network->network.MacAddress);
 
-	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_AP_STATE)) {
+	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_AP_STATE)) {
 		struct sta_info *psta;
 
 		psta = r8712_get_stainfo(&adapter->stapriv,
@@ -647,7 +647,7 @@ void r8712_free_assoc_resources(struct _adapter *adapter)
 	}
 
 	if (check_fwstate(pmlmepriv,
-	    WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE))
+	    WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE | WIFI_AP_STATE))
 		r8712_free_all_stainfo(adapter);
 	if (pwlan)
 		pwlan->fixed = false;
@@ -719,8 +719,8 @@ void r8712_joinbss_event_callback(struct _adapter *adapter, u8 *pbuf)
 		pnetwork = kmalloc(sizeof(struct wlan_network), GFP_ATOMIC);
 		if (!pnetwork)
 			return;
-		memcpy((u8 *)pnetwork+16, (u8 *)pbuf + 8,
-			sizeof(struct wlan_network) - 16);
+		memcpy((u8 *)pnetwork + 16, (u8 *)pbuf + 8,
+		       sizeof(struct wlan_network) - 16);
 	} else {
 		pnetwork = (struct wlan_network *)pbuf;
 	}
@@ -1414,7 +1414,7 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie,
 	while (cnt < in_len) {
 		if (in_ie[cnt] == authmode) {
 			if ((authmode == _WPA_IE_ID_) &&
-			    (!memcmp(&in_ie[cnt+2], &wpa_oui[0], 4))) {
+			    (!memcmp(&in_ie[cnt + 2], &wpa_oui[0], 4))) {
 				memcpy(&sec_ie[0], &in_ie[cnt],
 					in_ie[cnt + 1] + 2);
 				match = true;
@@ -1432,7 +1432,7 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie,
 				memcpy(&bkup_ie[0], &in_ie[cnt],
 					in_ie[cnt + 1] + 2);
 		}
-		cnt += in_ie[cnt+1] + 2; /*get next*/
+		cnt += in_ie[cnt + 1] + 2; /*get next*/
 	}
 	/*restruct WPA IE or WPA2 IE in sec_ie[] */
 	if (match) {
@@ -1492,7 +1492,7 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie,
 					/*select the uncst_oui and remove
 					 * the other uncst_oui*/
 					cnt = sec_ie[12];
-					remove_cnt = (cnt-1) * 4;
+					remove_cnt = (cnt - 1) * 4;
 					sec_ie[12] = 0x01;
 					memcpy(&sec_ie[14], &uncst_oui[0], 4);
 					/*remove the other unicast suit*/
@@ -1553,7 +1553,7 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie,
 					/*select the uncst_oui and remove the
 					 * other uncst_oui*/
 					cnt = sec_ie[8];
-					remove_cnt = (cnt-1)*4;
+					remove_cnt = (cnt - 1) * 4;
 					sec_ie[8] = 0x01;
 					memcpy(&sec_ie[10], &uncst_oui[0], 4);
 					/*remove the other unicast suit*/
@@ -1561,7 +1561,7 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie,
 						&sec_ie[14 + remove_cnt],
 						(sec_ie[1] - 14 + 2 -
 						remove_cnt));
-					sec_ie[1] = sec_ie[1]-remove_cnt;
+					sec_ie[1] = sec_ie[1] - remove_cnt;
 				}
 				break;
 			}
@@ -1573,7 +1573,7 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie,
 		ielength = 12;
 		/*copy RSN or SSN*/
 		if (match) {
-			memcpy(&out_ie[ielength], &sec_ie[0], sec_ie[1]+2);
+			memcpy(&out_ie[ielength], &sec_ie[0], sec_ie[1] + 2);
 			ielength += sec_ie[1] + 2;
 			if (authmode == _WPA2_IE_ID_) {
 				/*the Pre-Authentication bit should be zero*/
@@ -1587,8 +1587,8 @@ sint r8712_restruct_sec_ie(struct _adapter *adapter, u8 *in_ie,
 		memcpy(out_ie, in_ie, 12);
 		ielength = 12;
 		if (psecuritypriv->wps_phase) {
-			memcpy(out_ie+ielength, psecuritypriv->wps_ie,
-				psecuritypriv->wps_ie_len);
+			memcpy(out_ie + ielength, psecuritypriv->wps_ie,
+			       psecuritypriv->wps_ie_len);
 			ielength += psecuritypriv->wps_ie_len;
 		}
 	}
@@ -1702,11 +1702,11 @@ unsigned int r8712_restructure_ht_ie(struct _adapter *padapter, u8 *in_ie,
 	struct ht_priv *phtpriv = &pmlmepriv->htpriv;
 
 	phtpriv->ht_option = 0;
-	p = r8712_get_ie(in_ie+12, _HT_CAPABILITY_IE_, &ielen, in_len-12);
+	p = r8712_get_ie(in_ie + 12, _HT_CAPABILITY_IE_, &ielen, in_len - 12);
 	if (p && (ielen > 0)) {
 		if (pqospriv->qos_option == 0) {
 			out_len = *pout_len;
-			r8712_set_ie(out_ie+out_len, _VENDOR_SPECIFIC_IE_,
+			r8712_set_ie(out_ie + out_len, _VENDOR_SPECIFIC_IE_,
 				     _WMM_IE_Length_, WMM_IE, pout_len);
 			pqospriv->qos_option = 1;
 		}
@@ -1720,7 +1720,7 @@ unsigned int r8712_restructure_ht_ie(struct _adapter *padapter, u8 *in_ie,
 				    IEEE80211_HT_CAP_DSSSCCK40;
 		ht_capie.ampdu_params_info = (IEEE80211_HT_CAP_AMPDU_FACTOR &
 				0x03) | (IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00);
-		r8712_set_ie(out_ie+out_len, _HT_CAPABILITY_IE_,
+		r8712_set_ie(out_ie + out_len, _HT_CAPABILITY_IE_,
 			     sizeof(struct ieee80211_ht_cap),
 			     (unsigned char *)&ht_capie, pout_len);
 		phtpriv->ht_option = 1;
@@ -1754,11 +1754,11 @@ static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len)
 				&len, ie_len -
 				sizeof(struct NDIS_802_11_FIXED_IEs));
 	if (p && len > 0) {
-		pht_capie = (struct ieee80211_ht_cap *)(p+2);
+		pht_capie = (struct ieee80211_ht_cap *)(p + 2);
 		max_ampdu_sz = (pht_capie->ampdu_params_info &
 				IEEE80211_HT_CAP_AMPDU_FACTOR);
 		/* max_ampdu_sz (kbytes); */
-		max_ampdu_sz = 1 << (max_ampdu_sz+3);
+		max_ampdu_sz = 1 << (max_ampdu_sz + 3);
 		phtpriv->rx_ampdu_maxlen = max_ampdu_sz;
 	}
 	/* for A-MPDU Rx reordering buffer control for bmc_sta & sta_info
@@ -1786,7 +1786,7 @@ static void update_ht_cap(struct _adapter *padapter, u8 *pie, uint ie_len)
 	len = 0;
 	p = r8712_get_ie(pie + sizeof(struct NDIS_802_11_FIXED_IEs),
 		   _HT_ADD_INFO_IE_, &len,
-		   ie_len-sizeof(struct NDIS_802_11_FIXED_IEs));
+		   ie_len - sizeof(struct NDIS_802_11_FIXED_IEs));
 }
 
 void r8712_issue_addbareq_cmd(struct _adapter *padapter, int priority)
drivers/staging/rtl8712/rtl871x_mp.c +9 -8
index 6783055..e1cb149 100644
@@ -211,7 +211,7 @@ static u32 bitshift(u32 bitmask)
 	u32 i;
 
 	for (i = 0; i <= 31; i++)
-		if (((bitmask>>i) &  0x1) == 1)
+		if (((bitmask >> i) &  0x1) == 1)
 			break;
 	return i;
 }
@@ -307,7 +307,8 @@ static void SetOFDMTxPower(struct _adapter *pAdapter, u8 TxPower)
 {
 	u32 TxAGC = 0;
 
-	TxAGC |= ((TxPower<<24)|(TxPower<<16)|(TxPower<<8)|TxPower);
+	TxAGC |= ((TxPower << 24) | (TxPower << 16) | (TxPower << 8) |
+		  TxPower);
 	set_bb_reg(pAdapter, rTxAGC_Rate18_06, bTxAGCRate18_06, TxAGC);
 	set_bb_reg(pAdapter, rTxAGC_Rate54_24, bTxAGCRate54_24, TxAGC);
 	set_bb_reg(pAdapter, rTxAGC_Mcs03_Mcs00, bTxAGCRateMCS3_MCS0, TxAGC);
@@ -328,12 +329,12 @@ void r8712_SetTxAGCOffset(struct _adapter *pAdapter, u32 ulTxAGCOffset)
 {
 	u32 TxAGCOffset_B, TxAGCOffset_C, TxAGCOffset_D, tmpAGC;
 
-	TxAGCOffset_B = (ulTxAGCOffset&0x000000ff);
-	TxAGCOffset_C = (ulTxAGCOffset & 0x0000ff00)>>8;
-	TxAGCOffset_D = (ulTxAGCOffset & 0x00ff0000)>>16;
-	tmpAGC = (TxAGCOffset_D<<8 | TxAGCOffset_C<<4 | TxAGCOffset_B);
+	TxAGCOffset_B = (ulTxAGCOffset & 0x000000ff);
+	TxAGCOffset_C = (ulTxAGCOffset & 0x0000ff00) >> 8;
+	TxAGCOffset_D = (ulTxAGCOffset & 0x00ff0000) >> 16;
+	tmpAGC = (TxAGCOffset_D << 8 | TxAGCOffset_C << 4 | TxAGCOffset_B);
 	set_bb_reg(pAdapter, rFPGA0_TxGainStage,
-			(bXBTxAGC|bXCTxAGC|bXDTxAGC), tmpAGC);
+			(bXBTxAGC | bXCTxAGC | bXDTxAGC), tmpAGC);
 }
 
 void r8712_SetDataRate(struct _adapter *pAdapter)
@@ -379,7 +380,7 @@ void r8712_SwitchBandwidth(struct _adapter *pAdapter)
 		 * Set Control channel to upper or lower. These settings are
 		 * required only for 40MHz */
 		set_bb_reg(pAdapter, rCCK0_System, bCCKSideBand,
-			   (HAL_PRIME_CHNL_OFFSET_DONT_CARE>>1));
+			   (HAL_PRIME_CHNL_OFFSET_DONT_CARE >> 1));
 		set_bb_reg(pAdapter, rOFDM1_LSTF, 0xC00,
 			   HAL_PRIME_CHNL_OFFSET_DONT_CARE);
 		set_bb_reg(pAdapter, rFPGA0_AnalogParameter2, bMaskDWord, 0x18);
drivers/staging/rtl8712/rtl871x_mp_ioctl.c +2 -2
index 26786ad..b98a596 100644
@@ -295,7 +295,7 @@ uint oid_rt_pro_start_test_hdl(struct oid_par_priv *poid_par_priv)
 	r8712_write8(Adapter, MSR, 1); /* Link in ad hoc network, 0x1025004C */
 	r8712_write8(Adapter, RCR, 0); /* RCR : disable all pkt, 0x10250048 */
 	/* RCR disable Check BSSID, 0x1025004a */
-	r8712_write8(Adapter, RCR+2, 0x57);
+	r8712_write8(Adapter, RCR + 2, 0x57);
 	/* disable RX filter map , mgt frames will put in RX FIFO 0 */
 	r8712_write16(Adapter, RXFLTMAP0, 0x0);
 	val8 = r8712_read8(Adapter, EE_9346CR);
@@ -885,7 +885,7 @@ uint oid_rt_set_rx_packet_type_hdl(struct oid_par_priv
 		rcr_val32 |= (RCR_AB | RCR_AM | RCR_APM | RCR_AAP | RCR_ACRC32);
 		break;
 	case RX_PKT_PHY_MATCH:
-		rcr_val32 |= (RCR_APM|RCR_ACRC32);
+		rcr_val32 |= (RCR_APM | RCR_ACRC32);
 		break;
 	default:
 		rcr_val32 &= ~(RCR_AAP |
drivers/staging/rtl8712/rtl871x_recv.c +4 -4
index e9dc1f4..4ff5301 100644
@@ -83,7 +83,7 @@ sint _r8712_init_recv_priv(struct recv_priv *precvpriv,
 	precvpriv->precv_frame_buf = precvpriv->pallocated_frame_buf +
 				    RXFRAME_ALIGN_SZ -
 				    ((addr_t)(precvpriv->pallocated_frame_buf) &
-				    (RXFRAME_ALIGN_SZ-1));
+				    (RXFRAME_ALIGN_SZ - 1));
 	precvframe = (union recv_frame *)precvpriv->precv_frame_buf;
 	for (i = 0; i < NR_RECVFRAME; i++) {
 		INIT_LIST_HEAD(&(precvframe->u.list));
@@ -301,7 +301,7 @@ static sint recv_decache(union recv_frame *precv_frame, u8 bretry,
 		  struct stainfo_rxcache *prxcache)
 {
 	sint tid = precv_frame->u.hdr.attrib.priority;
-	u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num&0xffff) << 4) |
+	u16 seq_ctrl = ((precv_frame->u.hdr.attrib.seq_num & 0xffff) << 4) |
 			(precv_frame->u.hdr.attrib.frag_num & 0xf);
 
 	if (tid > 15)
@@ -637,7 +637,7 @@ sint r8712_wlanhdr_to_ethhdr(union recv_frame *precvframe)
 	if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
 		ptr += rmv_len;
 		*ptr = 0x87;
-		*(ptr+1) = 0x12;
+		*(ptr + 1) = 0x12;
 		/* append rx status for mp test packets */
 		ptr = recvframe_pull(precvframe, (rmv_len -
 		      sizeof(struct ethhdr) + 2) - 24);
@@ -648,7 +648,7 @@ sint r8712_wlanhdr_to_ethhdr(union recv_frame *precvframe)
 		      sizeof(struct ethhdr) + (bsnaphdr ? 2 : 0)));
 
 	memcpy(ptr, pattrib->dst, ETH_ALEN);
-	memcpy(ptr+ETH_ALEN, pattrib->src, ETH_ALEN);
+	memcpy(ptr + ETH_ALEN, pattrib->src, ETH_ALEN);
 	if (!bsnaphdr) {
 		len = htons(len);
 		memcpy(ptr + 12, &len, 2);
drivers/staging/rtl8712/rtl871x_security.c +57 -51

260 lines not on this page · raw message

drivers/staging/rtl8712/rtl871x_xmit.c +10 -10
index eb41f76..68d65d2 100644
@@ -390,7 +390,7 @@ static sint xmitframe_addmic(struct _adapter *padapter,
 			if (pframe[1] & 1) {   /* ToDS==1 */
 				r8712_secmicappend(&micdata,
 						   &pframe[16], 6); /*DA*/
-				if (pframe[1]&2)  /* From Ds==1 */
+				if (pframe[1] & 2)  /* From Ds==1 */
 					r8712_secmicappend(&micdata,
 							   &pframe[24], 6);
 				else
@@ -399,7 +399,7 @@ static sint xmitframe_addmic(struct _adapter *padapter,
 			} else {	/* ToDS==0 */
 				r8712_secmicappend(&micdata,
 						   &pframe[4], 6); /* DA */
-				if (pframe[1]&2)  /* From Ds==1 */
+				if (pframe[1] & 2)  /* From Ds==1 */
 					r8712_secmicappend(&micdata,
 							   &pframe[16], 6);
 				else
@@ -414,8 +414,8 @@ static sint xmitframe_addmic(struct _adapter *padapter,
 			for (curfragnum = 0; curfragnum < pattrib->nr_frags;
 			     curfragnum++) {
 				payload = (u8 *)RND4((addr_t)(payload));
-				payload = payload+pattrib->
-					  hdrlen+pattrib->iv_len;
+				payload = payload + pattrib->
+					  hdrlen + pattrib->iv_len;
 				if ((curfragnum + 1) == pattrib->nr_frags) {
 					length = pattrib->last_txcmdsz -
 						  pattrib->hdrlen -
@@ -424,10 +424,10 @@ static sint xmitframe_addmic(struct _adapter *padapter,
 						  ? pattrib->icv_len : 0);
 					r8712_secmicappend(&micdata, payload,
 							   length);
-					payload = payload+length;
+					payload = payload + length;
 				} else{
 					length = pxmitpriv->frag_len -
-					    pattrib->hdrlen-pattrib->iv_len -
+					    pattrib->hdrlen - pattrib->iv_len -
 					    ((psecuritypriv->sw_encrypt) ?
 					    pattrib->icv_len : 0);
 					r8712_secmicappend(&micdata, payload,
@@ -441,7 +441,7 @@ static sint xmitframe_addmic(struct _adapter *padapter,
 			 * last_txcmdsz */
 			memcpy(payload, &(mic[0]), 8);
 			pattrib->last_txcmdsz += 8;
-			payload = payload-pattrib->last_txcmdsz + 8;
+			payload = payload - pattrib->last_txcmdsz + 8;
 		}
 	}
 	return _SUCCESS;
@@ -879,19 +879,19 @@ static inline struct tx_servq *get_sta_pending(struct _adapter *padapter,
 	case 2:
 		ptxservq = &(psta->sta_xmitpriv.bk_q);
 		*ppstapending = &padapter->xmitpriv.bk_pending;
-		(phwxmits+3)->accnt++;
+		(phwxmits + 3)->accnt++;
 		break;
 	case 4:
 	case 5:
 		ptxservq = &(psta->sta_xmitpriv.vi_q);
 		*ppstapending = &padapter->xmitpriv.vi_pending;
-		(phwxmits+1)->accnt++;
+		(phwxmits + 1)->accnt++;
 		break;
 	case 6:
 	case 7:
 		ptxservq = &(psta->sta_xmitpriv.vo_q);
 		*ppstapending = &padapter->xmitpriv.vo_pending;
-		(phwxmits+0)->accnt++;
+		(phwxmits + 0)->accnt++;
 		break;
 	case 0:
 	case 3:
drivers/staging/rtl8712/usb_halinit.c +5 -5
index 944df85..ad21df1 100644
@@ -167,12 +167,12 @@ u8 r8712_usb_hal_bus_init(struct _adapter *padapter)
 		r8712_write8(padapter, CR + 1, 0x37);
 		/* Fix the RX FIFO issue(usb error), */
 		val8 = r8712_read8(padapter, 0x1025FE5c);
-		r8712_write8(padapter, 0x1025FE5c, (val8|BIT(7)));
+		r8712_write8(padapter, 0x1025FE5c, (val8 | BIT(7)));
 		val8 = r8712_read8(padapter, 0x102500ab);
-		r8712_write8(padapter, 0x102500ab, (val8|BIT(6)|BIT(7)));
+		r8712_write8(padapter, 0x102500ab, (val8 | BIT(6) | BIT(7)));
 		/* For power save, used this in the bit file after 970621 */
 		val8 = r8712_read8(padapter, SYS_CLKR);
-		r8712_write8(padapter, SYS_CLKR, val8&(~CPU_CLKSEL));
+		r8712_write8(padapter, SYS_CLKR, val8 & (~CPU_CLKSEL));
 	} else if (pregistrypriv->chip_version == RTL8712_2ndCUT ||
 		  pregistrypriv->chip_version == RTL8712_3rdCUT) {
 		/* Initialization for power on sequence,
@@ -280,10 +280,10 @@ u8 r8712_usb_hal_bus_init(struct _adapter *padapter)
 
 		if (PollingCnt <= 0) {
 			val8 = r8712_read8(padapter, CR);
-			r8712_write8(padapter, CR, val8&(~_TXDMA_EN));
+			r8712_write8(padapter, CR, val8 & (~_TXDMA_EN));
 			udelay(2); /* PlatformStallExecution(2); */
 			/* Reset TxDMA */
-			r8712_write8(padapter, CR, val8|_TXDMA_EN);
+			r8712_write8(padapter, CR, val8 | _TXDMA_EN);
 		}
 	} else {
 		ret = _FAIL;
drivers/staging/rtl8712/usb_intf.c +2 -2
index 4366b12..bf42098 100644
@@ -338,7 +338,7 @@ static void disable_ht_for_spec_devid(const struct usb_device_id *pdid,
 		flags = specific_device_id_tbl[i].flags;
 
 		if ((pdid->idVendor == vid) && (pdid->idProduct == pid) &&
-		    (flags&SPEC_DEV_ID_DISABLE_HT)) {
+		    (flags & SPEC_DEV_ID_DISABLE_HT)) {
 			padapter->registrypriv.ht_enable = 0;
 			padapter->registrypriv.cbw40_enable = 0;
 			padapter->registrypriv.ampdu_enable = 0;
@@ -425,7 +425,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
 			/* The following operations prevent Efuse leakage by
 			 * turning on 2.5V.
 			 */
-			tmpU1b = r8712_read8(padapter, EFUSE_TEST+3);
+			tmpU1b = r8712_read8(padapter, EFUSE_TEST + 3);
 			r8712_write8(padapter, EFUSE_TEST + 3, tmpU1b | 0x80);
 			msleep(20);
 			r8712_write8(padapter, EFUSE_TEST + 3,
drivers/staging/rtl8712/usb_ops.c +10 -10
index c03508d..856f257 100644
@@ -47,11 +47,11 @@ static u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr)
 	request = 0x05;
 	requesttype = 0x01; /* read_in */
 	index = 0;
-	wvalue = (u16)(addr&0x0000ffff);
+	wvalue = (u16)(addr & 0x0000ffff);
 	len = 1;
 	r8712_usbctrl_vendorreq(pintfpriv, request, wvalue, index, &data, len,
 			  requesttype);
-	return (u8)(le32_to_cpu(data)&0x0ff);
+	return (u8)(le32_to_cpu(data) & 0x0ff);
 }
 
 static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
@@ -67,11 +67,11 @@ static u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr)
 	request = 0x05;
 	requesttype = 0x01; /* read_in */
 	index = 0;
-	wvalue = (u16)(addr&0x0000ffff);
+	wvalue = (u16)(addr & 0x0000ffff);
 	len = 2;
 	r8712_usbctrl_vendorreq(pintfpriv, request, wvalue, index, &data, len,
 			  requesttype);
-	return (u16)(le32_to_cpu(data)&0xffff);
+	return (u16)(le32_to_cpu(data) & 0xffff);
 }
 
 static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
@@ -87,7 +87,7 @@ static u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr)
 	request = 0x05;
 	requesttype = 0x01; /* read_in */
 	index = 0;
-	wvalue = (u16)(addr&0x0000ffff);
+	wvalue = (u16)(addr & 0x0000ffff);
 	len = 4;
 	r8712_usbctrl_vendorreq(pintfpriv, request, wvalue, index, &data, len,
 			  requesttype);
@@ -107,10 +107,10 @@ static void usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val)
 	request = 0x05;
 	requesttype = 0x00; /* write_out */
 	index = 0;
-	wvalue = (u16)(addr&0x0000ffff);
+	wvalue = (u16)(addr & 0x0000ffff);
 	len = 1;
 	data = val;
-	data = cpu_to_le32(data&0x000000ff);
+	data = cpu_to_le32(data & 0x000000ff);
 	r8712_usbctrl_vendorreq(pintfpriv, request, wvalue, index, &data, len,
 			  requesttype);
 }
@@ -128,10 +128,10 @@ static void usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
 	request = 0x05;
 	requesttype = 0x00; /* write_out */
 	index = 0;
-	wvalue = (u16)(addr&0x0000ffff);
+	wvalue = (u16)(addr & 0x0000ffff);
 	len = 2;
 	data = val;
-	data = cpu_to_le32(data&0x0000ffff);
+	data = cpu_to_le32(data & 0x0000ffff);
 	r8712_usbctrl_vendorreq(pintfpriv, request, wvalue, index, &data, len,
 			  requesttype);
 }
@@ -149,7 +149,7 @@ static void usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val)
 	request = 0x05;
 	requesttype = 0x00; /* write_out */
 	index = 0;
-	wvalue = (u16)(addr&0x0000ffff);
+	wvalue = (u16)(addr & 0x0000ffff);
 	len = 4;
 	data = cpu_to_le32(val);
 	r8712_usbctrl_vendorreq(pintfpriv, request, wvalue, index, &data, len,
drivers/staging/rtl8712/usb_ops_linux.c +2 -2
index f35b3b6..489a9e6 100644
@@ -281,7 +281,7 @@ u32 r8712_usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
 			if (!precvbuf->pskb)
 				return _FAIL;
 			tmpaddr = (addr_t)precvbuf->pskb->data;
-			alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
+			alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1);
 			skb_reserve(precvbuf->pskb,
 				    (RECVBUFF_ALIGN_SZ - alignment));
 			precvbuf->phead = precvbuf->pskb->head;
@@ -451,7 +451,7 @@ u32 r8712_usb_write_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
 	}
 	/* translate DMA FIFO addr to pipehandle */
 	pipe = ffaddr2pipehdl(pdvobj, addr);
-	if (pxmitpriv->free_xmitbuf_cnt%NR_XMITBUFF == 0)
+	if (pxmitpriv->free_xmitbuf_cnt % NR_XMITBUFF == 0)
 		purb->transfer_flags  &=  (~URB_NO_INTERRUPT);
 	else
 		purb->transfer_flags  |=  URB_NO_INTERRUPT;
Signature · 1 line
2.5.3