return pbuf + len + 2;
 }
 
-inline u8 *rtw_set_ie_ch_switch (u8 *buf, u32 *buf_len, u8 ch_switch_mode,
+inline u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode,
        u8 new_ch, u8 ch_switch_cnt)
 {
        u8 ie_data[3];
 
        ie_data[0] = ttl;
        ie_data[1] = flags;
-       *(u16 *)(ie_data+2) = cpu_to_le16(reason);
-       *(u16 *)(ie_data+4) = cpu_to_le16(precedence);
+       *(u16 *)(ie_data + 2) = cpu_to_le16(reason);
+       *(u16 *)(ie_data + 4) = cpu_to_le16(precedence);
 
        return rtw_set_ie(buf, 0x118,  6, ie_data, buf_len);
 }
        cnt = 0;
 
        while (cnt < in_len) {
-               if (eid == in_ie[cnt] && (!oui || !memcmp(&in_ie[cnt+2], oui, oui_len))) {
+               if (eid == in_ie[cnt] && (!oui || !memcmp(&in_ie[cnt + 2], oui, oui_len))) {
                        target_ie = &in_ie[cnt];
 
                        if (ie)
-                               memcpy(ie, &in_ie[cnt], in_ie[cnt+1]+2);
+                               memcpy(ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
 
                        if (ielen)
-                               *ielen = in_ie[cnt+1]+2;
+                               *ielen = in_ie[cnt + 1] + 2;
 
                        break;
                } else {
-                       cnt += in_ie[cnt+1]+2; /* goto next */
+                       cnt += in_ie[cnt + 1] + 2; /* goto next */
                }
        }
        return target_ie;
 
                if (pbuf) {
                        /* check if oui matches... */
-                       if (memcmp((pbuf + 2), wpa_oui_type, sizeof (wpa_oui_type)))
+                       if (memcmp((pbuf + 2), wpa_oui_type, sizeof(wpa_oui_type)))
                                goto check_next_ie;
 
                        /* check version... */
                return _FAIL;
        }
 
-       if ((*wpa_ie != _WPA_IE_ID_) || (*(wpa_ie+1) != (u8)(wpa_ie_len - 2)) ||
-           (memcmp(wpa_ie+2, RTW_WPA_OUI_TYPE, WPA_SELECTOR_LEN)))
+       if ((*wpa_ie != _WPA_IE_ID_) || (*(wpa_ie + 1) != (u8)(wpa_ie_len - 2)) ||
+           (memcmp(wpa_ie + 2, RTW_WPA_OUI_TYPE, WPA_SELECTOR_LEN)))
                return _FAIL;
 
        pos = wpa_ie;
                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;
        while (cnt < in_len) {
                authmode = in_ie[cnt];
 
-               if ((authmode == _WPA_IE_ID_) && (!memcmp(&in_ie[cnt+2], &wpa_oui[0], 4))) {
+               if ((authmode == _WPA_IE_ID_) && (!memcmp(&in_ie[cnt + 2], &wpa_oui[0], 4))) {
                                if (wpa_ie)
-                                       memcpy(wpa_ie, &in_ie[cnt], in_ie[cnt+1]+2);
+                                       memcpy(wpa_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
 
-                               *wpa_len = in_ie[cnt+1]+2;
-                               cnt += in_ie[cnt+1]+2;  /* get next */
+                               *wpa_len = in_ie[cnt + 1] + 2;
+                               cnt += in_ie[cnt + 1] + 2;  /* get next */
                } else {
                        if (authmode == _WPA2_IE_ID_) {
                                if (rsn_ie)
-                                       memcpy(rsn_ie, &in_ie[cnt], in_ie[cnt+1]+2);
+                                       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 */
                        }
                }
        }
        eid = ie_ptr[0];
 
        if ((eid == _WPA_IE_ID_) && (!memcmp(&ie_ptr[2], wps_oui, 4))) {
-               *wps_ielen = ie_ptr[1]+2;
+               *wps_ielen = ie_ptr[1] + 2;
                match = true;
        }
        return match;
        while (cnt < in_len) {
                eid = in_ie[cnt];
 
-               if ((eid == _WPA_IE_ID_) && (!memcmp(&in_ie[cnt+2], wps_oui, 4))) {
+               if ((eid == _WPA_IE_ID_) && (!memcmp(&in_ie[cnt + 2], wps_oui, 4))) {
                        wpsie_ptr = &in_ie[cnt];
 
                        if (wps_ie)
-                               memcpy(wps_ie, &in_ie[cnt], in_ie[cnt+1]+2);
+                               memcpy(wps_ie, &in_ie[cnt], in_ie[cnt + 1] + 2);
 
                        if (wps_ielen)
-                               *wps_ielen = in_ie[cnt+1]+2;
+                               *wps_ielen = in_ie[cnt + 1] + 2;
 
-                       cnt += in_ie[cnt+1]+2;
+                       cnt += in_ie[cnt + 1] + 2;
 
                        break;
                } else {
-                       cnt += in_ie[cnt+1]+2; /* goto next */
+                       cnt += in_ie[cnt + 1] + 2; /* goto next */
                }
        }
        return wpsie_ptr;
 
        if (attr_ptr && attr_len) {
                if (buf_content)
-                       memcpy(buf_content, attr_ptr+4, attr_len-4);
+                       memcpy(buf_content, attr_ptr + 4, attr_len - 4);
 
                if (len_content)
-                       *len_content = attr_len-4;
+                       *len_content = attr_len - 4;
 
-               return attr_ptr+4;
+               return attr_ptr + 4;
        }
 
        return NULL;
        if (elen < 4) {
                if (show_errors) {
                        DBG_88E("short vendor specific information element ignored (len=%lu)\n",
-                               (unsigned long) elen);
+                               (unsigned long)elen);
                }
                return -1;
        }
                case WME_OUI_TYPE: /* this is a Wi-Fi WME info. element */
                        if (elen < 5) {
                                DBG_88E("short WME information element ignored (len=%lu)\n",
-                                       (unsigned long) elen);
+                                       (unsigned long)elen);
                                return -1;
                        }
                        switch (pos[4]) {
                                break;
                        default:
                                DBG_88E("unknown WME information element ignored (subtype=%d len=%lu)\n",
-                                       pos[4], (unsigned long) elen);
+                                       pos[4], (unsigned long)elen);
                                return -1;
                        }
                        break;
                        break;
                default:
                        DBG_88E("Unknown Microsoft information element ignored (type=%d len=%lu)\n",
-                               pos[3], (unsigned long) elen);
+                               pos[3], (unsigned long)elen);
                        return -1;
                }
                break;
                        break;
                default:
                        DBG_88E("Unknown Broadcom information element ignored (type=%d len=%lu)\n",
-                               pos[3], (unsigned long) elen);
+                               pos[3], (unsigned long)elen);
                        return -1;
                }
                break;
        default:
                DBG_88E("unknown vendor specific information element ignored (vendor OUI %02x:%02x:%02x len=%lu)\n",
-                       pos[0], pos[1], pos[2], (unsigned long) elen);
+                       pos[0], pos[1], pos[2], (unsigned long)elen);
                return -1;
        }
        return 0;
                if (elen > left) {
                        if (show_errors) {
                                DBG_88E("IEEE 802.11 element parse failed (id=%d elen=%d left=%lu)\n",
-                                       id, elen, (unsigned long) left);
+                                       id, elen, (unsigned long)left);
                        }
                        return ParseFailed;
                }
        u8 *pos = (u8 *)buf;
        u8 id, len;
 
-       while (pos-buf <= buf_len) {
+       while (pos - buf <= buf_len) {
                id = *pos;
-               len = *(pos+1);
+               len = *(pos + 1);
 
                DBG_88E("%s ID:%u, LEN:%u\n", __func__, id, len);
                #ifdef CONFIG_88EU_P2P
                return;
 
        pos += 6;
-       while (pos-ie < ie_len) {
+       while (pos - ie < ie_len) {
                id = RTW_GET_BE16(pos);
                len = RTW_GET_BE16(pos + 2);
                DBG_88E("%s ID:0x%04x, LEN:%u\n", __func__, id, len);
-               pos += (4+len);
+               pos += (4 + len);
        }
 }
 
                return;
 
        pos += 6;
-       while (pos-ie < ie_len) {
+       while (pos - ie < ie_len) {
                id = *pos;
-               len = get_unaligned_le16(pos+1);
+               len = get_unaligned_le16(pos + 1);
                DBG_88E("%s ID:%u, LEN:%u\n", __func__, id, len);
-               pos += (3+len);
+               pos += (3 + len);
        }
 }
 
                        dump_stack();
                        return NULL;
                }
-               if ((eid == _VENDOR_SPECIFIC_IE_) && !memcmp(&in_ie[cnt+2], p2p_oui, 4)) {
+               if ((eid == _VENDOR_SPECIFIC_IE_) && !memcmp(&in_ie[cnt + 2], p2p_oui, 4)) {
                        p2p_ie_ptr = in_ie + cnt;
 
                        if (p2p_ie)
 
        if (attr_ptr && attr_len) {
                if (buf_content)
-                       memcpy(buf_content, attr_ptr+3, attr_len-3);
+                       memcpy(buf_content, attr_ptr + 3, attr_len - 3);
 
                if (len_content)
-                       *len_content = attr_len-3;
+                       *len_content = attr_len - 3;
 
-               return attr_ptr+3;
+               return attr_ptr + 3;
        }
 
        return NULL;
        while (1) {
                target_attr = rtw_get_p2p_attr(ie, ielen, attr_id, NULL, &target_attr_len);
                if (target_attr && target_attr_len) {
-                       u8 *next_attr = target_attr+target_attr_len;
-                       uint remain_len = ielen-(next_attr-ie);
+                       u8 *next_attr = target_attr + target_attr_len;
+                       uint remain_len = ielen - (next_attr - ie);
 
                        memset(target_attr, 0, target_attr_len);
                        memcpy(target_attr, next_attr, remain_len);
-                       memset(target_attr+remain_len, 0, target_attr_len);
-                       *(ie+1) -= target_attr_len;
+                       memset(target_attr + remain_len, 0, target_attr_len);
+                       *(ie + 1) -= target_attr_len;
                        ielen -= target_attr_len;
                } else {
                        break;
        u8 *p2p_ie;
        uint p2p_ielen, p2p_ielen_ori;
 
-       p2p_ie = rtw_get_p2p_ie(bss_ex->IEs+_FIXED_IE_LENGTH_, bss_ex->IELength-_FIXED_IE_LENGTH_, NULL, &p2p_ielen_ori);
+       p2p_ie = rtw_get_p2p_ie(bss_ex->IEs + _FIXED_IE_LENGTH_, bss_ex->IELength - _FIXED_IE_LENGTH_, NULL, &p2p_ielen_ori);
        if (p2p_ie) {
                p2p_ielen = rtw_p2p_attr_remove(p2p_ie, p2p_ielen_ori, attr_id);
                if (p2p_ielen != p2p_ielen_ori) {
-                       u8 *next_ie_ori = p2p_ie+p2p_ielen_ori;
-                       u8 *next_ie = p2p_ie+p2p_ielen;
-                       uint remain_len = bss_ex->IELength-(next_ie_ori-bss_ex->IEs);
+                       u8 *next_ie_ori = p2p_ie + p2p_ielen_ori;
+                       u8 *next_ie = p2p_ie + p2p_ielen;
+                       uint remain_len = bss_ex->IELength - (next_ie_ori - bss_ex->IEs);
 
                        memcpy(next_ie, next_ie_ori, remain_len);
-                       memset(next_ie+remain_len, 0, p2p_ielen_ori-p2p_ielen);
-                       bss_ex->IELength -= p2p_ielen_ori-p2p_ielen;
+                       memset(next_ie + remain_len, 0, p2p_ielen_ori - p2p_ielen);
+                       bss_ex->IELength -= p2p_ielen_ori - p2p_ielen;
                }
        }
 }
        unsigned char *pbuf;
        int group_cipher = 0, pairwise_cipher = 0, is8021x = 0;
        int ret = _FAIL;
-       pbuf = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength-12);
+       pbuf = rtw_get_wpa_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength - 12);
 
        if (pbuf && (wpa_ielen > 0)) {
-               if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) {
+               if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen + 2, &group_cipher, &pairwise_cipher, &is8021x)) {
                        pnetwork->BcnInfo.pairwise_cipher = pairwise_cipher;
                        pnetwork->BcnInfo.group_cipher = group_cipher;
                        pnetwork->BcnInfo.is_8021x = is8021x;
                        ret = _SUCCESS;
                }
        } else {
-               pbuf = rtw_get_wpa2_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength-12);
+               pbuf = rtw_get_wpa2_ie(&pnetwork->network.IEs[12], &wpa_ielen, pnetwork->network.IELength - 12);
 
                if (pbuf && (wpa_ielen > 0)) {
-                       if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) {
+                       if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, wpa_ielen + 2, &group_cipher, &pairwise_cipher, &is8021x)) {
                                pnetwork->BcnInfo.pairwise_cipher = pairwise_cipher;
                                pnetwork->BcnInfo.group_cipher = group_cipher;
                                pnetwork->BcnInfo.is_8021x = is8021x;
 
        fc = le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)frame)->frame_ctl);
 
-       if ((fc & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE)) !=
-           (RTW_IEEE80211_FTYPE_MGMT|RTW_IEEE80211_STYPE_ACTION))
+       if ((fc & (RTW_IEEE80211_FCTL_FTYPE | RTW_IEEE80211_FCTL_STYPE)) !=
+           (RTW_IEEE80211_FTYPE_MGMT | RTW_IEEE80211_STYPE_ACTION))
                return false;
 
        c = frame_body[0];