From: Luis de Bethencourt Date: Mon, 19 Oct 2015 17:16:01 +0000 (+0100) Subject: staging: rtl8712: spaces preferred around operands X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=4ef2de5ae0377bc88c1f5021c3797db3c62bc384;p=linux-beck.git staging: rtl8712: spaces preferred around operands Clean up all instances of checkpatch.pl checks: CHECK: spaces preferred around that '+' (and other operands) Signed-off-by: Luis de Bethencourt Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8712/ieee80211.c b/drivers/staging/rtl8712/ieee80211.c index 3c38fcbc4364..974ca021ccef 100644 --- a/drivers/staging/rtl8712/ieee80211.c +++ b/drivers/staging/rtl8712/ieee80211.c @@ -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; } diff --git a/drivers/staging/rtl8712/mlme_linux.c b/drivers/staging/rtl8712/mlme_linux.c index 6d253bf6021e..e4e4bdee78be 100644 --- a/drivers/staging/rtl8712/mlme_linux.c +++ b/drivers/staging/rtl8712/mlme_linux.c @@ -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); diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c index 92ab59dcb5ec..b89e2d3c4fe1 100644 --- a/drivers/staging/rtl8712/os_intfs.c +++ b/drivers/staging/rtl8712/os_intfs.c @@ -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); diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c b/drivers/staging/rtl8712/rtl8712_cmd.c index ac6c22f98db8..9b9160947943 100644 --- a/drivers/staging/rtl8712/rtl8712_cmd.c +++ b/drivers/staging/rtl8712/rtl8712_cmd.c @@ -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 */ diff --git a/drivers/staging/rtl8712/rtl8712_efuse.c b/drivers/staging/rtl8712/rtl8712_efuse.c index 4dcc82632326..eaa93fbb95a3 100644 --- a/drivers/staging/rtl8712/rtl8712_efuse.c +++ b/drivers/staging/rtl8712/rtl8712_efuse.c @@ -80,12 +80,13 @@ static u8 efuse_one_byte_read(struct _adapter *padapter, u16 addr, u8 *data) u8 tmpidx = 0, bResult; /* -----------------e-fuse reg ctrl --------------------------------- */ - r8712_write8(padapter, EFUSE_CTRL+1, (u8)(addr&0xFF)); /* address */ - r8712_write8(padapter, EFUSE_CTRL+2, ((u8)((addr>>8)&0x03)) | - (r8712_read8(padapter, EFUSE_CTRL+2)&0xFC)); - r8712_write8(padapter, EFUSE_CTRL+3, 0x72); /* read cmd */ + r8712_write8(padapter, EFUSE_CTRL + 1, (u8)(addr & 0xFF)); /* address */ + r8712_write8(padapter, EFUSE_CTRL + 2, ((u8)((addr >> 8) & 0x03)) | + (r8712_read8(padapter, EFUSE_CTRL + 2) & 0xFC)); + r8712_write8(padapter, EFUSE_CTRL + 3, 0x72); /* read cmd */ /* wait for complete */ - while (!(0x80 & r8712_read8(padapter, EFUSE_CTRL+3)) && (tmpidx < 100)) + while (!(0x80 & r8712_read8(padapter, EFUSE_CTRL + 3)) && + (tmpidx < 100)) tmpidx++; if (tmpidx < 100) { *data = r8712_read8(padapter, EFUSE_CTRL); @@ -102,13 +103,14 @@ static u8 efuse_one_byte_write(struct _adapter *padapter, u16 addr, u8 data) u8 tmpidx = 0, bResult; /* -----------------e-fuse reg ctrl -------------------------------- */ - r8712_write8(padapter, EFUSE_CTRL+1, (u8)(addr&0xFF)); /* address */ - r8712_write8(padapter, EFUSE_CTRL+2, ((u8)((addr>>8)&0x03)) | - (r8712_read8(padapter, EFUSE_CTRL+2)&0xFC)); + r8712_write8(padapter, EFUSE_CTRL + 1, (u8)(addr & 0xFF)); /* address */ + r8712_write8(padapter, EFUSE_CTRL + 2, ((u8)((addr >> 8) & 0x03)) | + (r8712_read8(padapter, EFUSE_CTRL + 2) & 0xFC)); r8712_write8(padapter, EFUSE_CTRL, data); /* data */ - r8712_write8(padapter, EFUSE_CTRL+3, 0xF2); /* write cmd */ + r8712_write8(padapter, EFUSE_CTRL + 3, 0xF2); /* write cmd */ /* wait for complete */ - while ((0x80 & r8712_read8(padapter, EFUSE_CTRL+3)) && (tmpidx < 100)) + while ((0x80 & r8712_read8(padapter, EFUSE_CTRL + 3)) && + (tmpidx < 100)) tmpidx++; if (tmpidx < 100) bResult = true; @@ -123,13 +125,13 @@ static u8 efuse_one_byte_rw(struct _adapter *padapter, u8 bRead, u16 addr, u8 tmpidx = 0, tmpv8 = 0, bResult; /* -----------------e-fuse reg ctrl --------------------------------- */ - r8712_write8(padapter, EFUSE_CTRL+1, (u8)(addr&0xFF)); /* address */ + r8712_write8(padapter, EFUSE_CTRL + 1, (u8)(addr & 0xFF)); /* address */ tmpv8 = ((u8)((addr >> 8) & 0x03)) | (r8712_read8(padapter, EFUSE_CTRL + 2) & 0xFC); - r8712_write8(padapter, EFUSE_CTRL+2, tmpv8); + r8712_write8(padapter, EFUSE_CTRL + 2, tmpv8); if (bRead) { - r8712_write8(padapter, EFUSE_CTRL+3, 0x72); /* read cmd */ - while (!(0x80 & r8712_read8(padapter, EFUSE_CTRL+3)) && + r8712_write8(padapter, EFUSE_CTRL + 3, 0x72); /* read cmd */ + while (!(0x80 & r8712_read8(padapter, EFUSE_CTRL + 3)) && (tmpidx < 100)) tmpidx++; if (tmpidx < 100) { @@ -141,8 +143,8 @@ static u8 efuse_one_byte_rw(struct _adapter *padapter, u8 bRead, u16 addr, } } else { r8712_write8(padapter, EFUSE_CTRL, *data); /* data */ - r8712_write8(padapter, EFUSE_CTRL+3, 0xF2); /* write cmd */ - while ((0x80 & r8712_read8(padapter, EFUSE_CTRL+3)) && + r8712_write8(padapter, EFUSE_CTRL + 3, 0xF2); /* write cmd */ + while ((0x80 & r8712_read8(padapter, EFUSE_CTRL + 3)) && (tmpidx < 100)) tmpidx++; if (tmpidx < 100) @@ -208,7 +210,7 @@ static void pgpacket_copy_data(const u8 word_en, const u8 *sourdata, u8 word_idx, byte_idx; for (word_idx = 0; word_idx < PGPKG_MAX_WORDS; word_idx++) { - if (!(word_en&BIT(word_idx))) { + if (!(word_en & BIT(word_idx))) { byte_idx = word_idx * 2; targetdata[byte_idx] = sourdata[tmpindex++]; targetdata[byte_idx + 1] = sourdata[tmpindex++]; @@ -250,7 +252,7 @@ u8 r8712_efuse_pg_packet_read(struct _adapter *padapter, u8 offset, u8 *data) return false; if (offset > 0x0f) return false; - memset(data, 0xFF, sizeof(u8)*PGPKT_DATA_SIZE); + memset(data, 0xFF, sizeof(u8) * PGPKT_DATA_SIZE); while (efuse_addr < efuse_available_max_size) { if (efuse_one_byte_read(padapter, efuse_addr, &efuse_data)) { if (efuse_data == 0xFF) @@ -263,7 +265,8 @@ u8 r8712_efuse_pg_packet_read(struct _adapter *padapter, u8 offset, u8 *data) for (tmpidx = 0; tmpidx < word_cnts * 2; tmpidx++) { if (efuse_one_byte_read(padapter, - efuse_addr+1+tmpidx, &efuse_data)) { + efuse_addr + 1 + tmpidx, + &efuse_data)) { tmpdata[tmpidx] = efuse_data; } else { ret = false; @@ -271,7 +274,7 @@ u8 r8712_efuse_pg_packet_read(struct _adapter *padapter, u8 offset, u8 *data) } pgpacket_copy_data(hworden, tmpdata, data); } - efuse_addr += 1 + (word_cnts*2); + efuse_addr += 1 + (word_cnts * 2); } else { ret = false; break; @@ -303,7 +306,7 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr) offset = GET_EFUSE_OFFSET(value); word_en = GET_EFUSE_WORD_EN(value); if (pkt.offset != offset) { - addr += calculate_word_cnts(word_en)*2; + addr += calculate_word_cnts(word_en) * 2; continue; } for (i = 0; i < PGPKG_MAX_WORDS; i++) { @@ -312,14 +315,14 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr) if (efuse_one_byte_read( padapter, addr, &value)) - pkt.data[i*2] = value; + pkt.data[i * 2] = value; else return false; if (efuse_one_byte_read( padapter, addr + 1, &value)) - pkt.data[i*2 + 1] = + pkt.data[i * 2 + 1] = value; else return false; @@ -334,25 +337,26 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr) /* fill original data */ for (i = 0; i < PGPKG_MAX_WORDS; i++) { if (BIT(i) & pkt.word_en) { - efuse_one_byte_write(padapter, addr, pkt.data[i*2]); - efuse_one_byte_write(padapter, addr+1, - pkt.data[i*2 + 1]); + efuse_one_byte_write(padapter, addr, pkt.data[i * 2]); + efuse_one_byte_write(padapter, addr + 1, + pkt.data[i * 2 + 1]); /* additional check */ 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, - pkt.data[i*2 + 1]); + efuse_one_byte_write(padapter, addr + 1, + pkt.data[i * 2 + + 1]); } } addr += 2; @@ -401,7 +405,7 @@ u8 r8712_efuse_pg_packet_write(struct _adapter *padapter, const u8 offset, /* go to next address */ efuse_addr++; - for (i = 0; i < target_word_cnts*2; i++) { + for (i = 0; i < target_word_cnts * 2; i++) { efuse_one_byte_write(padapter, efuse_addr + i, *(data + i)); @@ -409,7 +413,7 @@ u8 r8712_efuse_pg_packet_write(struct _adapter *padapter, const u8 offset, efuse_addr + i, &efuse_data)) bResult = false; - else if (*(data+i) != efuse_data) /* fail */ + else if (*(data + i) != efuse_data) /* fail */ bResult = false; } break; @@ -541,8 +545,8 @@ u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr, u16 cnts, break; } - if ((data[idx] != pktdata[i]) || (data[idx+1] != - pktdata[i+1])) { + if ((data[idx] != pktdata[i]) || (data[idx + 1] != + pktdata[i + 1])) { word_en &= ~BIT(i >> 1); newdata[j++] = data[idx]; newdata[j++] = data[idx + 1]; diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c index 79981b591d91..9055827cccf8 100644 --- a/drivers/staging/rtl8712/rtl8712_led.c +++ b/drivers/staging/rtl8712/rtl8712_led.c @@ -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; diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c index b6b2b4201b1c..d187508dd1e0 100644 --- a/drivers/staging/rtl8712/rtl8712_recv.c +++ b/drivers/staging/rtl8712/rtl8712_recv.c @@ -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 */ diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c b/drivers/staging/rtl8712/rtl8712_xmit.c index 02140b0ebf7f..b21a60e9f8a9 100644 --- a/drivers/staging/rtl8712/rtl8712_xmit.c +++ b/drivers/staging/rtl8712/rtl8712_xmit.c @@ -264,13 +264,14 @@ u8 r8712_construct_txaggr_cmd_desc(struct xmit_buf *pxmitbuf) /* Fill up TxCmd Descriptor according as USB FW Tx Aaggregation info.*/ /* dw0 */ - ptx_desc->txdw0 = cpu_to_le32(CMD_HDR_SZ&0xffff); + ptx_desc->txdw0 = cpu_to_le32(CMD_HDR_SZ & 0xffff); ptx_desc->txdw0 |= - cpu_to_le32(((TXDESC_SIZE+OFFSET_SZ)<txdw0 |= cpu_to_le32(OWN | FSG | LSG); /* dw1 */ - ptx_desc->txdw1 |= cpu_to_le32((0x13<txdw1 |= cpu_to_le32((0x13 << QSEL_SHT) & 0x00001f00); return _SUCCESS; } @@ -322,12 +323,14 @@ u8 r8712_append_mpdu_unit(struct xmit_buf *pxmitbuf, int i; for (i = 0; i < padding_sz; i++) - *(pxmitframe->buf_addr+TXDESC_SIZE+last_txcmdsz+i) = 0; + *(pxmitframe->buf_addr + TXDESC_SIZE + last_txcmdsz + + i) = 0; } /* Add the new mpdu's length */ - ptx_desc->txdw0 = cpu_to_le32((ptx_desc->txdw0&0xffff0000) | - ((ptx_desc->txdw0&0x0000ffff)+ - ((TXDESC_SIZE+last_txcmdsz+padding_sz)&0x0000ffff))); + ptx_desc->txdw0 = cpu_to_le32((ptx_desc->txdw0 & 0xffff0000) | + ((ptx_desc->txdw0 & 0x0000ffff) + + ((TXDESC_SIZE + last_txcmdsz + padding_sz) & + 0x0000ffff))); return _SUCCESS; } @@ -341,7 +344,7 @@ u8 r8712_xmitframe_aggr_1st(struct xmit_buf *pxmitbuf, pxmitbuf->priv_data = pxmitframe; pxmitframe->pxmit_urb[0] = pxmitbuf->pxmit_urb[0]; /* buffer addr assoc */ - pxmitframe->buf_addr = pxmitbuf->pbuf+TXDESC_SIZE+CMD_HDR_SZ; + pxmitframe->buf_addr = pxmitbuf->pbuf + TXDESC_SIZE + CMD_HDR_SZ; /*RTL8712_DMA_H2CCMD */ r8712_construct_txaggr_cmd_desc(pxmitbuf); r8712_construct_txaggr_cmd_hdr(pxmitbuf); @@ -382,29 +385,32 @@ u8 r8712_dump_aggr_xframe(struct xmit_buf *pxmitbuf, /* use 1st xmitframe as media */ xmitframe_xmitbuf_attach(pxmitframe, pxmitbuf); - pcmd_hdr->cmd_dw0 = cpu_to_le32(((total_length-CMD_HDR_SZ)&0x0000ffff)| - (pcmd_hdr->cmd_dw0&0xffff0000)); + pcmd_hdr->cmd_dw0 = cpu_to_le32(((total_length - CMD_HDR_SZ) & + 0x0000ffff) | (pcmd_hdr->cmd_dw0 & + 0xffff0000)); /* urb length in cmd_dw1 */ pcmd_hdr->cmd_dw1 = cpu_to_le32((pxmitbuf->aggr_nr & 0xff)| - ((total_length+TXDESC_SIZE) << 16)); + ((total_length + TXDESC_SIZE) << 16)); pxmitframe->last[0] = 1; pxmitframe->bpending[0] = false; pxmitframe->mem_addr = pxmitbuf->pbuf; - if ((pdvobj->ishighspeed && ((total_length+TXDESC_SIZE)%0x200) == 0) || - ((!pdvobj->ishighspeed && - ((total_length+TXDESC_SIZE)%0x40) == 0))) { + if ((pdvobj->ishighspeed && ((total_length + TXDESC_SIZE) % 0x200) == + 0) || ((!pdvobj->ishighspeed && ((total_length + TXDESC_SIZE) % + 0x40) == 0))) { ptxdesc->txdw0 |= cpu_to_le32 - (((TXDESC_SIZE+OFFSET_SZ+8)<txdw0 |= cpu_to_le32 - (((TXDESC_SIZE+OFFSET_SZ)<padapter, RTL8712_DMA_H2CCMD, - total_length+TXDESC_SIZE, (u8 *)pxmitframe); + total_length + TXDESC_SIZE, (u8 *)pxmitframe); return _SUCCESS; } @@ -432,7 +438,7 @@ static void update_txdesc(struct xmit_frame *pxmitframe, uint *pmem, int sz) memcpy(&txdesc_mp, ptxdesc, sizeof(struct tx_desc)); memset(ptxdesc, 0, sizeof(struct tx_desc)); /* offset 0 */ - ptxdesc->txdw0 |= cpu_to_le32(sz&0x0000ffff); + ptxdesc->txdw0 |= cpu_to_le32(sz & 0x0000ffff); if (pdvobj->ishighspeed) { if (((sz + TXDESC_SIZE) % 512) == 0) blnSetTxDescOffset = 1; @@ -446,42 +452,42 @@ static void update_txdesc(struct xmit_frame *pxmitframe, uint *pmem, int sz) } if (blnSetTxDescOffset) { /* 32 bytes for TX Desc + 8 bytes pending */ - ptxdesc->txdw0 |= cpu_to_le32(((TXDESC_SIZE+OFFSET_SZ + 8) << + ptxdesc->txdw0 |= cpu_to_le32(((TXDESC_SIZE + OFFSET_SZ + 8) << OFFSET_SHT) & 0x00ff0000); } else { /* default = 32 bytes for TX Desc */ - ptxdesc->txdw0 |= cpu_to_le32(((TXDESC_SIZE+OFFSET_SZ) << + ptxdesc->txdw0 |= cpu_to_le32(((TXDESC_SIZE + OFFSET_SZ) << OFFSET_SHT) & 0x00ff0000); } ptxdesc->txdw0 |= cpu_to_le32(OWN | FSG | LSG); if (pxmitframe->frame_tag == DATA_FRAMETAG) { /* offset 4 */ - ptxdesc->txdw1 |= cpu_to_le32((pattrib->mac_id)&0x1f); + ptxdesc->txdw1 |= cpu_to_le32((pattrib->mac_id) & 0x1f); #ifdef CONFIG_R8712_TX_AGGR /* dirty workaround, need to check if it is aggr cmd. */ if ((u8 *)pmem != (u8 *)pxmitframe->pxmitbuf->pbuf) { ptxdesc->txdw0 |= cpu_to_le32 - ((0x3 << TYPE_SHT)&TYPE_MSK); + ((0x3 << TYPE_SHT) & TYPE_MSK); qsel = (uint)(pattrib->qsel & 0x0000001f); if (qsel == 2) qsel = 0; ptxdesc->txdw1 |= cpu_to_le32 ((qsel << QSEL_SHT) & 0x00001f00); ptxdesc->txdw2 = cpu_to_le32 - ((qsel << RTS_RC_SHT)&0x001f0000); + ((qsel << RTS_RC_SHT) & 0x001f0000); ptxdesc->txdw6 |= cpu_to_le32 - ((0x5 << RSVD6_SHT)&RSVD6_MSK); + ((0x5 << RSVD6_SHT) & RSVD6_MSK); } else { ptxdesc->txdw0 |= cpu_to_le32 - ((0x3 << TYPE_SHT)&TYPE_MSK); + ((0x3 << TYPE_SHT) & TYPE_MSK); ptxdesc->txdw1 |= cpu_to_le32 ((0x13 << QSEL_SHT) & 0x00001f00); qsel = (uint)(pattrib->qsel & 0x0000001f); if (qsel == 2) qsel = 0; ptxdesc->txdw2 = cpu_to_le32 - ((qsel << RTS_RC_SHT)&0x0001f000); + ((qsel << RTS_RC_SHT) & 0x0001f000); ptxdesc->txdw7 |= cpu_to_le32 (pcmdpriv->cmd_seq << 24); pcmdpriv->cmd_seq++; @@ -593,7 +599,7 @@ static void update_txdesc(struct xmit_frame *pxmitframe, uint *pmem, int sz) ptxdesc->txdw1 |= cpu_to_le32((qsel << QSEL_SHT) & 0x00001f00); } else { /* offset 4 */ - qsel = (uint)(pattrib->priority&0x0000001f); + qsel = (uint)(pattrib->priority & 0x0000001f); ptxdesc->txdw1 |= cpu_to_le32((qsel << QSEL_SHT) & 0x00001f00); /*offset 8*/ /*offset 12*/ diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index 1f6e69b1bba3..562a10203127 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -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 diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index e70513d06a35..edfc6805e012 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -118,12 +118,13 @@ static inline void handle_group_key(struct ieee_param *param, param->u.crypt.idx < 3) { /* group key idx is 1 or 2 */ memcpy(padapter->securitypriv.XGrpKey[param->u.crypt. - idx-1].skey, param->u.crypt.key, (param->u.crypt.key_len - > 16 ? 16 : param->u.crypt.key_len)); + idx - 1].skey, param->u.crypt.key, + (param->u.crypt.key_len > 16 ? 16 : + param->u.crypt.key_len)); memcpy(padapter->securitypriv.XGrptxmickey[param-> - u.crypt.idx-1].skey, &(param->u.crypt.key[16]), 8); + u.crypt.idx - 1].skey, &(param->u.crypt.key[16]), 8); memcpy(padapter->securitypriv. XGrprxmickey[param-> - u.crypt.idx-1].skey, &(param->u.crypt.key[24]), 8); + u.crypt.idx - 1].skey, &(param->u.crypt.key[24]), 8); padapter->securitypriv.binstallGrpkey = true; r8712_set_key(padapter, &padapter->securitypriv, param->u.crypt.idx); @@ -199,7 +200,7 @@ static inline char *translate_scan(struct _adapter *padapter, memcpy((u8 *)&cap, r8712_get_capability_from_ie(pnetwork->network.IEs), 2); cap = le16_to_cpu(cap); - if (cap & (WLAN_CAPABILITY_IBSS|WLAN_CAPABILITY_BSS)) { + if (cap & (WLAN_CAPABILITY_IBSS | WLAN_CAPABILITY_BSS)) { if (cap & WLAN_CAPABILITY_BSS) iwe.u.mode = (u32)IW_MODE_MASTER; else @@ -575,10 +576,10 @@ static int r871x_set_wpa_ie(struct _adapter *padapter, char *pie, eid = buf[cnt]; if ((eid == _VENDOR_SPECIFIC_IE_) && - (!memcmp(&buf[cnt+2], wps_oui, 4))) { + (!memcmp(&buf[cnt + 2], wps_oui, 4))) { netdev_info(padapter->pnetdev, "r8712u: SET WPS_IE\n"); padapter->securitypriv.wps_ie_len = - ((buf[cnt+1] + 2) < + ((buf[cnt + 1] + 2) < (MAX_WPA_IE_LEN << 2)) ? (buf[cnt + 1] + 2) : (MAX_WPA_IE_LEN << 2); @@ -588,7 +589,7 @@ static int r871x_set_wpa_ie(struct _adapter *padapter, char *pie, padapter->securitypriv.wps_phase = true; netdev_info(padapter->pnetdev, "r8712u: SET WPS_IE, wps_phase==true\n"); - cnt += buf[cnt+1]+2; + cnt += buf[cnt + 1] + 2; break; } else { cnt += buf[cnt + 1] + 2; @@ -613,7 +614,7 @@ static int r8711_wx_get_name(struct net_device *dev, struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; u8 *prates; - if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE) == + if (check_fwstate(pmlmepriv, _FW_LINKED | WIFI_ADHOC_MASTER_STATE) == true) { /* parsing HT_CAP_IE */ p = r8712_get_ie(&pcur_bss->IEs[12], _HT_CAPABILITY_IE_, @@ -704,7 +705,7 @@ static int r8711_wx_get_freq(struct net_device *dev, if (check_fwstate(pmlmepriv, _FW_LINKED)) { wrqu->freq.m = ieee80211_wlan_frequencies[ - pcur_bss->Configuration.DSConfig-1] * 100000; + pcur_bss->Configuration.DSConfig - 1] * 100000; wrqu->freq.e = 1; wrqu->freq.i = pcur_bss->Configuration.DSConfig; } else { @@ -949,7 +950,7 @@ static int r871x_wx_set_priv(struct net_device *dev, sprintf(ext, "%s rssi %d", pcur_network->network.Ssid.Ssid, /*(xxxx=xxxx+10) */ - ((padapter->recvpriv.fw_rssi)>>1)-95 + ((padapter->recvpriv.fw_rssi) >> 1) - 95 /*pcur_network->network.Rssi */ ); } else { @@ -1012,7 +1013,7 @@ static int r871x_wx_set_priv(struct net_device *dev, goto FREE_EXT; } if (copy_to_user(dwrq->pointer, ext, - min(dwrq->length, (__u16)(strlen(ext)+1)))) + min(dwrq->length, (__u16)(strlen(ext) + 1)))) ret = -EFAULT; FREE_EXT: @@ -1151,7 +1152,7 @@ static int r8711_wx_set_scan(struct net_device *dev, return -ENETDOWN; if (!padapter->hw_init_completed) return -1; - if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING)) || + if ((check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING)) || (pmlmepriv->sitesurveyctrl.traffic_busy)) return 0; if (wrqu->data.length == sizeof(struct iw_scan_req)) { @@ -1201,7 +1202,8 @@ static int r8711_wx_get_scan(struct net_device *dev, if (padapter->bDriverStopped) return -EINVAL; - while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING)) { + while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | + _FW_UNDER_LINKING)) { msleep(30); cnt++; if (cnt > 100) @@ -1311,7 +1313,7 @@ static int r8711_wx_get_essid(struct net_device *dev, struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; u32 len, ret = 0; - if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) { + if (check_fwstate(pmlmepriv, _FW_LINKED | WIFI_ADHOC_MASTER_STATE)) { len = pcur_bss->Ssid.SsidLength; wrqu->essid.length = len; memcpy(extra, pcur_bss->Ssid.Ssid, len); @@ -1412,7 +1414,7 @@ static int r8711_wx_get_rate(struct net_device *dev, u16 mcs_rate = 0; i = 0; - if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) { + if (check_fwstate(pmlmepriv, _FW_LINKED | WIFI_ADHOC_MASTER_STATE)) { p = r8712_get_ie(&pcur_bss->IEs[12], _HT_CAPABILITY_IE_, &ht_ielen, pcur_bss->IELength - 12); @@ -1432,7 +1434,7 @@ static int r8711_wx_get_rate(struct net_device *dev, if (rate > max_rate) max_rate = rate; wrqu->bitrate.fixed = 0; /* no auto select */ - wrqu->bitrate.value = rate*500000; + wrqu->bitrate.value = rate * 500000; i++; } if (ht_cap) { @@ -1853,7 +1855,7 @@ static int r8711_wx_write32(struct net_device *dev, u32 data32; get_user(addr, (u32 __user *)wrqu->data.pointer); - data32 = ((u32)wrqu->data.length<<16) | (u32)wrqu->data.flags; + data32 = ((u32)wrqu->data.length << 16) | (u32)wrqu->data.flags; r8712_write32(padapter, addr, data32); return 0; } @@ -1966,7 +1968,8 @@ static int r871x_get_ap_info(struct net_device *dev, if (padapter->bDriverStopped || (pdata == NULL)) return -EINVAL; - while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY|_FW_UNDER_LINKING)) { + while (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | + _FW_UNDER_LINKING)) { msleep(30); cnt++; if (cnt > 100) @@ -1997,13 +2000,13 @@ static int r871x_get_ap_info(struct net_device *dev, if (ether_addr_equal(bssid, pnetwork->network.MacAddress)) { /* BSSID match, then check if supporting wpa/wpa2 */ pbuf = r8712_get_wpa_ie(&pnetwork->network.IEs[12], - &wpa_ielen, pnetwork->network.IELength-12); + &wpa_ielen, pnetwork->network.IELength - 12); if (pbuf && (wpa_ielen > 0)) { pdata->flags = 1; break; } pbuf = r8712_get_wpa2_ie(&pnetwork->network.IEs[12], - &wpa_ielen, pnetwork->network.IELength-12); + &wpa_ielen, pnetwork->network.IELength - 12); if (pbuf && (wpa_ielen > 0)) { pdata->flags = 2; break; @@ -2088,7 +2091,7 @@ static int wpa_set_param(struct net_device *dev, u8 name, u32 value) switch (name) { case IEEE_PARAM_WPA_ENABLED: padapter->securitypriv.AuthAlgrthm = 2; /* 802.1x */ - switch ((value)&0xff) { + switch ((value) & 0xff) { case 1: /* WPA */ padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK; /* WPA_PSK */ diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c index b10b3e82994e..7c346a405a20 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c @@ -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 { diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c b/drivers/staging/rtl8712/rtl871x_ioctl_set.c index ab84a4032fe4..f772675ae9cd 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c @@ -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))) { diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index 98113c4e699e..b22dbd5311e7 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -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) diff --git a/drivers/staging/rtl8712/rtl871x_mp.c b/drivers/staging/rtl8712/rtl871x_mp.c index 678305501d63..e1cb149253b8 100644 --- a/drivers/staging/rtl8712/rtl871x_mp.c +++ b/drivers/staging/rtl8712/rtl871x_mp.c @@ -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); diff --git a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c index 26786ad19b71..b98a596757f5 100644 --- a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c +++ b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c @@ -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 | diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c index e9dc1f472756..4ff530155187 100644 --- a/drivers/staging/rtl8712/rtl871x_recv.c +++ b/drivers/staging/rtl8712/rtl871x_recv.c @@ -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); diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c index 1d7888a19387..09242425dad4 100644 --- a/drivers/staging/rtl8712/rtl871x_security.c +++ b/drivers/staging/rtl8712/rtl871x_security.c @@ -175,22 +175,22 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe) if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL) return; - pframe = ((struct xmit_frame *)pxmitframe)->buf_addr+TXDESC_OFFSET; + pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET; /*start to encrypt each fragment*/ if ((pattrib->encrypt == _WEP40_) || (pattrib->encrypt == _WEP104_)) { keylength = psecuritypriv->DefKeylen[psecuritypriv-> PrivacyKeyIndex]; for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) { - iv = pframe+pattrib->hdrlen; + iv = pframe + pattrib->hdrlen; memcpy(&wepkey[0], iv, 3); memcpy(&wepkey[3], &psecuritypriv->DefKey[ psecuritypriv->PrivacyKeyIndex].skey[0], keylength); - payload = pframe+pattrib->iv_len+pattrib->hdrlen; + payload = pframe + pattrib->iv_len + pattrib->hdrlen; if ((curfragnum + 1) == pattrib->nr_frags) { - length = pattrib->last_txcmdsz-pattrib-> - hdrlen-pattrib->iv_len - + length = pattrib->last_txcmdsz - pattrib-> + hdrlen - pattrib->iv_len - pattrib->icv_len; *((u32 *)crc) = cpu_to_le32(getcrc32( payload, length)); @@ -200,14 +200,15 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe) arcfour_encrypt(&mycontext, payload + length, crc, 4); } else { - length = pxmitpriv->frag_len-pattrib->hdrlen - - pattrib->iv_len-pattrib->icv_len; + length = pxmitpriv->frag_len - + pattrib->hdrlen - pattrib->iv_len - + pattrib->icv_len; *((u32 *)crc) = cpu_to_le32(getcrc32( payload, length)); arcfour_init(&mycontext, wepkey, 3 + keylength); arcfour_encrypt(&mycontext, payload, payload, length); - arcfour_encrypt(&mycontext, payload+length, + arcfour_encrypt(&mycontext, payload + length, crc, 4); pframe += pxmitpriv->frag_len; pframe = (u8 *)RND4((addr_t)(pframe)); @@ -241,8 +242,8 @@ void r8712_wep_decrypt(struct _adapter *padapter, u8 *precvframe) psecuritypriv->PrivacyKeyIndex].skey[0], keylength); length = ((union recv_frame *)precvframe)-> - u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len; - payload = pframe+prxattrib->iv_len+prxattrib->hdrlen; + u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len; + payload = pframe + prxattrib->iv_len + prxattrib->hdrlen; /* decrypt payload include icv */ arcfour_init(&mycontext, wepkey, 3 + keylength); arcfour_encrypt(&mycontext, payload, payload, length); @@ -495,11 +496,11 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32) /* Now compute an unbalanced Feistel cipher with 80-bit block */ /* size on the 80-bit block P1K[], using the 128-bit key TK[] */ for (i = 0; i < PHASE1_LOOP_CNT; i++) { /* Each add is mod 2**16 */ - p1k[0] += _S_(p1k[4] ^ TK16((i&1) + 0)); - p1k[1] += _S_(p1k[0] ^ TK16((i&1) + 2)); - p1k[2] += _S_(p1k[1] ^ TK16((i&1) + 4)); - p1k[3] += _S_(p1k[2] ^ TK16((i&1) + 6)); - p1k[4] += _S_(p1k[3] ^ TK16((i&1) + 0)); + p1k[0] += _S_(p1k[4] ^ TK16((i & 1) + 0)); + p1k[1] += _S_(p1k[0] ^ TK16((i & 1) + 2)); + p1k[2] += _S_(p1k[1] ^ TK16((i & 1) + 4)); + p1k[3] += _S_(p1k[2] ^ TK16((i & 1) + 6)); + p1k[4] += _S_(p1k[3] ^ TK16((i & 1) + 0)); p1k[4] += (unsigned short)i; /* avoid "slide attacks" */ } } @@ -587,7 +588,7 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe) if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL) return _FAIL; - pframe = ((struct xmit_frame *)pxmitframe)->buf_addr+TXDESC_OFFSET; + pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET; /* 4 start to encrypt each fragment */ if (pattrib->encrypt == _TKIP_) { if (pattrib->psta) @@ -600,7 +601,7 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe) for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) { iv = pframe + pattrib->hdrlen; - payload = pframe+pattrib->iv_len + + payload = pframe + pattrib->iv_len + pattrib->hdrlen; GET_TKIP_PN(iv, txpn); pnl = (u16)(txpn.val); @@ -612,7 +613,8 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe) if ((curfragnum + 1) == pattrib->nr_frags) { /* 4 the last fragment */ length = pattrib->last_txcmdsz - - pattrib->hdrlen-pattrib->iv_len - + pattrib->hdrlen - + pattrib->iv_len - pattrib->icv_len; *((u32 *)crc) = cpu_to_le32( getcrc32(payload, length)); @@ -622,16 +624,18 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe) arcfour_encrypt(&mycontext, payload + length, crc, 4); } else { - length = pxmitpriv->frag_len-pattrib-> - hdrlen-pattrib-> - iv_len-pattrib->icv_len; + length = pxmitpriv->frag_len - + pattrib->hdrlen - + pattrib->iv_len - + pattrib->icv_len; *((u32 *)crc) = cpu_to_le32(getcrc32( payload, length)); arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, - payload+length, crc, 4); + payload + length, crc, + 4); pframe += pxmitpriv->frag_len; pframe = (u8 *)RND4((addr_t)(pframe)); } @@ -667,8 +671,9 @@ u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe) stainfo = r8712_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]); if (stainfo != NULL) { - iv = pframe+prxattrib->hdrlen; - payload = pframe+prxattrib->iv_len + prxattrib->hdrlen; + iv = pframe + prxattrib->hdrlen; + payload = pframe + prxattrib->iv_len + + prxattrib->hdrlen; length = ((union recv_frame *)precvframe)-> u.hdr.len - prxattrib->hdrlen - prxattrib->iv_len; @@ -854,7 +859,7 @@ static void mix_column(u8 *in, u8 *out) andf7[3] = in[3] & 0x7f; for (i = 3; i > 0; i--) { /* logical shift left 1 bit */ andf7[i] = andf7[i] << 1; - if ((andf7[i-1] & 0x80) == 0x80) + if ((andf7[i - 1] & 0x80) == 0x80) andf7[i] = (andf7[i] | 0x01); } andf7[0] = andf7[0] << 1; @@ -1076,11 +1081,11 @@ static sint aes_cipher(u8 *key, uint hdrlen, qc_exists = 0; } pn_vector[0] = pframe[hdrlen]; - pn_vector[1] = pframe[hdrlen+1]; - pn_vector[2] = pframe[hdrlen+4]; - pn_vector[3] = pframe[hdrlen+5]; - pn_vector[4] = pframe[hdrlen+6]; - pn_vector[5] = pframe[hdrlen+7]; + pn_vector[1] = pframe[hdrlen + 1]; + pn_vector[2] = pframe[hdrlen + 4]; + pn_vector[3] = pframe[hdrlen + 5]; + pn_vector[4] = pframe[hdrlen + 6]; + pn_vector[5] = pframe[hdrlen + 7]; construct_mic_iv(mic_iv, qc_exists, a4_exists, pframe, plen, pn_vector); construct_mic_header1(mic_header1, hdrlen, pframe); construct_mic_header2(mic_header2, pframe, a4_exists, qc_exists); @@ -1112,7 +1117,7 @@ static sint aes_cipher(u8 *key, uint hdrlen, mic[j] = aes_out[j]; /* Insert MIC into payload */ for (j = 0; j < 8; j++) - pframe[payload_index+j] = mic[j]; + pframe[payload_index + j] = mic[j]; payload_index = hdrlen + 8; for (i = 0; i < num_blocks; i++) { construct_ctr_preload(ctr_preload, a4_exists, qc_exists, @@ -1125,11 +1130,11 @@ static sint aes_cipher(u8 *key, uint hdrlen, if (payload_remainder > 0) { /* If short final block, then pad it,*/ /* encrypt and copy unpadded part back */ construct_ctr_preload(ctr_preload, a4_exists, qc_exists, - pframe, pn_vector, num_blocks+1); + pframe, pn_vector, num_blocks + 1); for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) - padded_buffer[j] = pframe[payload_index+j]; + padded_buffer[j] = pframe[payload_index + j]; aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j = 0; j < payload_remainder; j++) @@ -1141,7 +1146,7 @@ static sint aes_cipher(u8 *key, uint hdrlen, for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < 8; j++) - padded_buffer[j] = pframe[j+hdrlen+8+plen]; + padded_buffer[j] = pframe[j + hdrlen + 8 + plen]; aes128k128d(key, ctr_preload, aes_out); bitwise_xor(aes_out, padded_buffer, chain_buffer); for (j = 0; j < 8; j++) @@ -1229,13 +1234,13 @@ static sint aes_decipher(u8 *key, uint hdrlen, /* start to decrypt the payload */ /*(plen including llc, payload and mic) */ num_blocks = (plen - 8) / 16; - payload_remainder = (plen-8) % 16; + payload_remainder = (plen - 8) % 16; pn_vector[0] = pframe[hdrlen]; - pn_vector[1] = pframe[hdrlen+1]; - pn_vector[2] = pframe[hdrlen+4]; - pn_vector[3] = pframe[hdrlen+5]; - pn_vector[4] = pframe[hdrlen+6]; - pn_vector[5] = pframe[hdrlen+7]; + pn_vector[1] = pframe[hdrlen + 1]; + pn_vector[2] = pframe[hdrlen + 4]; + pn_vector[3] = pframe[hdrlen + 5]; + pn_vector[4] = pframe[hdrlen + 6]; + pn_vector[5] = pframe[hdrlen + 7]; if ((hdrlen == WLAN_HDR_A3_LEN) || (hdrlen == WLAN_HDR_A3_QOS_LEN)) a4_exists = 0; else @@ -1269,7 +1274,7 @@ static sint aes_decipher(u8 *key, uint hdrlen, if (payload_remainder > 0) { /* If short final block, pad it,*/ /* encrypt it and copy the unpadded part back */ construct_ctr_preload(ctr_preload, a4_exists, qc_exists, - pframe, pn_vector, num_blocks+1); + pframe, pn_vector, num_blocks + 1); for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) @@ -1282,12 +1287,12 @@ static sint aes_decipher(u8 *key, uint hdrlen, /* start to calculate the mic */ memcpy((void *)message, pframe, (hdrlen + plen + 8)); pn_vector[0] = pframe[hdrlen]; - pn_vector[1] = pframe[hdrlen+1]; - pn_vector[2] = pframe[hdrlen+4]; - pn_vector[3] = pframe[hdrlen+5]; - pn_vector[4] = pframe[hdrlen+6]; - pn_vector[5] = pframe[hdrlen+7]; - construct_mic_iv(mic_iv, qc_exists, a4_exists, message, plen-8, + pn_vector[1] = pframe[hdrlen + 1]; + pn_vector[2] = pframe[hdrlen + 4]; + pn_vector[3] = pframe[hdrlen + 5]; + pn_vector[4] = pframe[hdrlen + 6]; + pn_vector[5] = pframe[hdrlen + 7]; + construct_mic_iv(mic_iv, qc_exists, a4_exists, message, plen - 8, pn_vector); construct_mic_header1(mic_header1, hdrlen, message); construct_mic_header2(mic_header2, message, a4_exists, qc_exists); @@ -1319,7 +1324,7 @@ static sint aes_decipher(u8 *key, uint hdrlen, mic[j] = aes_out[j]; /* Insert MIC into payload */ for (j = 0; j < 8; j++) - message[payload_index+j] = mic[j]; + message[payload_index + j] = mic[j]; payload_index = hdrlen + 8; for (i = 0; i < num_blocks; i++) { construct_ctr_preload(ctr_preload, a4_exists, qc_exists, @@ -1332,7 +1337,7 @@ static sint aes_decipher(u8 *key, uint hdrlen, if (payload_remainder > 0) { /* If short final block, pad it,*/ /* encrypt and copy unpadded part back */ construct_ctr_preload(ctr_preload, a4_exists, qc_exists, - message, pn_vector, num_blocks+1); + message, pn_vector, num_blocks + 1); for (j = 0; j < 16; j++) padded_buffer[j] = 0x00; for (j = 0; j < payload_remainder; j++) @@ -1375,7 +1380,7 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe) &prxattrib->ta[0]); if (stainfo != NULL) { if (IS_MCAST(prxattrib->ra)) { - iv = pframe+prxattrib->hdrlen; + iv = pframe + prxattrib->hdrlen; idx = iv[3]; prwskey = &psecuritypriv->XGrpKey[ ((idx >> 6) & 0x3) - 1].skey[0]; @@ -1386,7 +1391,8 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe) prwskey = &stainfo->x_UncstKey.skey[0]; } length = ((union recv_frame *)precvframe)-> - u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len; + u.hdr.len - prxattrib->hdrlen - + prxattrib->iv_len; aes_decipher(prwskey, prxattrib->hdrlen, pframe, length); } else { diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c index eb41f7635d13..68d65d230fe3 100644 --- a/drivers/staging/rtl8712/rtl871x_xmit.c +++ b/drivers/staging/rtl8712/rtl871x_xmit.c @@ -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: diff --git a/drivers/staging/rtl8712/usb_halinit.c b/drivers/staging/rtl8712/usb_halinit.c index 944df8543941..ad21df16c2bd 100644 --- a/drivers/staging/rtl8712/usb_halinit.c +++ b/drivers/staging/rtl8712/usb_halinit.c @@ -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; diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c index de447da02cdb..c71333fbe823 100644 --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c @@ -339,7 +339,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; @@ -426,7 +426,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, diff --git a/drivers/staging/rtl8712/usb_ops.c b/drivers/staging/rtl8712/usb_ops.c index c03508d935f2..856f257bb77e 100644 --- a/drivers/staging/rtl8712/usb_ops.c +++ b/drivers/staging/rtl8712/usb_ops.c @@ -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, diff --git a/drivers/staging/rtl8712/usb_ops_linux.c b/drivers/staging/rtl8712/usb_ops_linux.c index f35b3b6a4b8b..489a9e6d52fc 100644 --- a/drivers/staging/rtl8712/usb_ops_linux.c +++ b/drivers/staging/rtl8712/usb_ops_linux.c @@ -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;