Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: r8723au: Additional source patches

These changes are fixes that were discovered late in the testing
cycle.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Larry Finger and committed by
Greg Kroah-Hartman
c17416ef 364e30eb

+343 -700
+2 -2
drivers/staging/rtl8723au/core/rtw_ap.c
··· 842 842 /* beacon interval */ 843 843 /* ie + 8; 8: TimeStamp, 2: Beacon Interval 2:Capability */ 844 844 p = rtw_get_beacon_interval23a_from_ie(ie); 845 - pbss_network->Configuration.BeaconPeriod = RTW_GET_LE16(p); 845 + pbss_network->Configuration.BeaconPeriod = get_unaligned_le16(p); 846 846 847 847 /* capability */ 848 - cap = RTW_GET_LE16(ie); 848 + cap = get_unaligned_le16(ie); 849 849 850 850 /* SSID */ 851 851 p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, _SSID_IE_, &ie_len,
+5 -3
drivers/staging/rtl8723au/core/rtw_cmd.c
··· 447 447 448 448 pcmdpriv->cmd_issued_cnt++; 449 449 450 - pcmd->cmdsz = _RND4(pcmd->cmdsz);/* _RND4 */ 450 + pcmd->cmdsz = ALIGN(pcmd->cmdsz, 4); 451 451 452 452 memcpy(pcmdbuf, pcmd->parmbuf, pcmd->cmdsz); 453 453 ··· 1141 1141 u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false; 1142 1142 u8 bHigherBusyTxTraffic = false; 1143 1143 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1144 - 1144 + #ifndef CONFIG_8723AU_BT_COEXIST 1145 + int BusyThreshold = 100; 1146 + #endif 1145 1147 /* */ 1146 1148 /* Determine if our traffic is busy now */ 1147 1149 /* */ ··· 1640 1638 case P2P_PS_WK_CID: 1641 1639 p2p_ps_wk_hdl23a(padapter, pdrvextra_cmd->type_size); 1642 1640 break; 1643 - #endif /* CONFIG_8723AU_P2P */ 1644 1641 case P2P_PROTO_WK_CID: 1645 1642 /* Commented by Albert 2011/07/01 */ 1646 1643 /* I used the type_size as the type command */ 1647 1644 p2p_protocol_wk_hdl23a(padapter, pdrvextra_cmd->type_size); 1648 1645 break; 1646 + #endif /* CONFIG_8723AU_P2P */ 1649 1647 #ifdef CONFIG_8723AU_AP_MODE 1650 1648 case CHECK_HIQ_WK_CID: 1651 1649 rtw_chk_hi_queue_hdl(padapter);
-2
drivers/staging/rtl8723au/core/rtw_efuse.c
··· 108 108 u32 value32; 109 109 u8 readbyte; 110 110 u16 retry; 111 - /* u32 start = rtw_get_current_time(); */ 112 111 113 112 /* Write Address */ 114 113 rtw_write8(Adapter, EFUSE_CTRL+1, (_offset & 0xff)); ··· 136 137 value32 = rtw_read32(Adapter, EFUSE_CTRL); 137 138 138 139 *pbuf = (u8)(value32 & 0xff); 139 - /* DBG_8723A("ReadEFuseByte23a _offset:%08u, in %d ms\n", _offset , rtw_get_passing_time_ms23a(start)); */ 140 140 } 141 141 142 142 /* */
+12 -12
drivers/staging/rtl8723au/core/rtw_ieee80211.c
··· 196 196 197 197 ie_data[0] = ttl; 198 198 ie_data[1] = flags; 199 - RTW_PUT_LE16((u8*)&ie_data[2], reason); 200 - RTW_PUT_LE16((u8*)&ie_data[4], precedence); 199 + put_unaligned_le16(reason, (u8*)&ie_data[2]); 200 + put_unaligned_le16(precedence, (u8*)&ie_data[4]); 201 201 202 202 return rtw_set_ie23a(buf, 0x118, 6, ie_data, buf_len); 203 203 } ··· 585 585 /* pairwise_cipher */ 586 586 if (left >= 2) { 587 587 /* count = le16_to_cpu(*(u16*)pos); */ 588 - count = RTW_GET_LE16(pos); 588 + count = get_unaligned_le16(pos); 589 589 pos += 2; 590 590 left -= 2; 591 591 ··· 661 661 /* pairwise_cipher */ 662 662 if (left >= 2) { 663 663 /* count = le16_to_cpu(*(u16*)pos); */ 664 - count = RTW_GET_LE16(pos); 664 + count = get_unaligned_le16(pos); 665 665 pos += 2; 666 666 left -= 2; 667 667 ··· 876 876 877 877 while (attr_ptr - wps_ie < wps_ielen) { 878 878 /* 4 = 2(Attribute ID) + 2(Length) */ 879 - u16 attr_id = RTW_GET_BE16(attr_ptr); 880 - u16 attr_data_len = RTW_GET_BE16(attr_ptr + 2); 879 + u16 attr_id = get_unaligned_be16(attr_ptr); 880 + u16 attr_data_len = get_unaligned_be16(attr_ptr + 2); 881 881 u16 attr_len = attr_data_len + 4; 882 882 883 883 /* DBG_8723A("%s attr_ptr:%p, id:%u, length:%u\n", __func__, attr_ptr, attr_id, attr_data_len); */ ··· 1246 1246 1247 1247 pos+= 6; 1248 1248 while (pos-ie < ie_len) { 1249 - id = RTW_GET_BE16(pos); 1250 - len = RTW_GET_BE16(pos + 2); 1249 + id = get_unaligned_be16(pos); 1250 + len = get_unaligned_be16(pos + 2); 1251 1251 1252 1252 DBG_8723A("%s ID:0x%04x, LEN:%u\n", __func__, id, len); 1253 1253 ··· 1271 1271 pos += 6; 1272 1272 while (pos-ie < ie_len) { 1273 1273 id = *pos; 1274 - len = RTW_GET_LE16(pos+1); 1274 + len = get_unaligned_le16(pos+1); 1275 1275 1276 1276 DBG_8723A("%s ID:%u, LEN:%u\n", __func__, id, len); 1277 1277 ··· 1362 1362 while (attr_ptr - p2p_ie < p2p_ielen) { 1363 1363 /* 3 = 1(Attribute ID) + 2(Length) */ 1364 1364 u8 attr_id = *attr_ptr; 1365 - u16 attr_data_len = RTW_GET_LE16(attr_ptr + 1); 1365 + u16 attr_data_len = get_unaligned_le16(attr_ptr + 1); 1366 1366 u16 attr_len = attr_data_len + 3; 1367 1367 1368 1368 /* DBG_8723A("%s attr_ptr:%p, id:%u, length:%u\n", __func__, attr_ptr, attr_id, attr_data_len); */ ··· 1429 1429 *pbuf = attr_id; 1430 1430 1431 1431 /* u16*)(pbuf + 1) = cpu_to_le16(attr_len); */ 1432 - RTW_PUT_LE16(pbuf + 1, attr_len); 1432 + put_unaligned_le16(attr_len, pbuf + 1); 1433 1433 1434 1434 if (pdata_attr) 1435 1435 memcpy(pbuf + 3, pdata_attr, attr_len); ··· 1561 1561 /* 1 (WFD IE) + 1 (Length) + 3 (OUI) + 1 (OUI Type) */ 1562 1562 cnt = 6; 1563 1563 while (cnt < wfd_ielen) { 1564 - u16 attrlen = RTW_GET_BE16(wfd_ie + cnt + 1); 1564 + u16 attrlen = get_unaligned_be16(wfd_ie + cnt + 1); 1565 1565 1566 1566 attr_id = wfd_ie[cnt]; 1567 1567 if (attr_id == target_attr_id) {
+7 -6
drivers/staging/rtl8723au/core/rtw_mlme.c
··· 69 69 return res; 70 70 } 71 71 72 + #ifdef CONFIG_8723AU_AP_MODE 72 73 static void rtw_free_mlme_ie_data(u8 **ppie, u32 *plen) 73 74 { 74 75 if(*ppie) ··· 79 78 *ppie=NULL; 80 79 } 81 80 } 81 + #endif 82 82 83 83 void rtw23a_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv) 84 84 { ··· 96 94 rtw_free_mlme_ie_data(&pmlmepriv->p2p_probe_resp_ie, &pmlmepriv->p2p_probe_resp_ie_len); 97 95 rtw_free_mlme_ie_data(&pmlmepriv->p2p_go_probe_resp_ie, &pmlmepriv->p2p_go_probe_resp_ie_len); 98 96 rtw_free_mlme_ie_data(&pmlmepriv->p2p_assoc_req_ie, &pmlmepriv->p2p_assoc_req_ie_len); 99 - #endif 100 97 101 - #if defined(CONFIG_8723AU_P2P) 102 98 rtw_free_mlme_ie_data(&pmlmepriv->wfd_beacon_ie, &pmlmepriv->wfd_beacon_ie_len); 103 99 rtw_free_mlme_ie_data(&pmlmepriv->wfd_probe_req_ie, &pmlmepriv->wfd_probe_req_ie_len); 104 100 rtw_free_mlme_ie_data(&pmlmepriv->wfd_probe_resp_ie, &pmlmepriv->wfd_probe_resp_ie_len); ··· 941 941 942 942 /* set ips_deny_time to avoid enter IPS before LPS leave */ 943 943 padapter->pwrctrlpriv.ips_deny_time = 944 - rtw_get_current_time() + rtw_ms_to_systime23a(3000); 944 + jiffies + msecs_to_jiffies(3000); 945 945 946 946 _clr_fwstate_(pmlmepriv, _FW_LINKED); 947 947 ··· 1675 1675 } 1676 1676 1677 1677 /* check ssid, if needed */ 1678 - if (pmlmepriv->assoc_ssid.ssid && pmlmepriv->assoc_ssid.ssid_len) { 1678 + if (pmlmepriv->assoc_ssid.ssid_len) { 1679 1679 if (competitor->network.Ssid.ssid_len != 1680 1680 pmlmepriv->assoc_ssid.ssid_len || 1681 1681 memcmp(competitor->network.Ssid.ssid, ··· 1839 1839 res = _FAIL; /* try again */ 1840 1840 goto exit; 1841 1841 } 1842 - psetkeyparm = (struct setkey_parm *) 1843 - kzalloc(sizeof(struct setkey_parm), GFP_KERNEL); 1842 + psetkeyparm = kzalloc(sizeof(struct setkey_parm), GFP_KERNEL); 1844 1843 if (!psetkeyparm) { 1845 1844 kfree(pcmd); 1846 1845 res = _FAIL; ··· 1901 1902 "%x (must be 1 or 2 or 4 or 5)\n", 1902 1903 psecuritypriv->dot11PrivacyAlgrthm)); 1903 1904 res = _FAIL; 1905 + kfree(pcmd); 1906 + kfree(psetkeyparm); 1904 1907 goto exit; 1905 1908 } 1906 1909
+20 -18
drivers/staging/rtl8723au/core/rtw_mlme_ext.c
··· 762 762 struct recv_frame *precv_frame) 763 763 { 764 764 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 765 + #ifdef CONFIG_8723AU_P2P 765 766 struct sk_buff *skb = precv_frame->pkt; 766 767 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 767 - #ifdef CONFIG_8723AU_P2P 768 768 struct wifidirect_info *pwdinfo = &padapter->wdinfo; 769 769 #endif 770 770 ··· 1309 1309 goto asoc_class2_error; 1310 1310 } 1311 1311 1312 - capab_info = RTW_GET_LE16(pframe + sizeof(struct ieee80211_hdr_3addr)); 1312 + capab_info = get_unaligned_le16(pframe + sizeof(struct ieee80211_hdr_3addr)); 1313 1313 /* capab_info = le16_to_cpu(*(unsigned short *)(pframe + sizeof(struct ieee80211_hdr_3addr))); */ 1314 1314 /* listen_interval = le16_to_cpu(*(unsigned short *)(pframe + sizeof(struct ieee80211_hdr_3addr)+2)); */ 1315 - listen_interval = RTW_GET_LE16(pframe + sizeof(struct ieee80211_hdr_3addr)+2); 1315 + listen_interval = get_unaligned_le16(pframe + sizeof(struct ieee80211_hdr_3addr)+2); 1316 1316 1317 1317 left = pkt_len - (sizeof(struct ieee80211_hdr_3addr) + ie_offset); 1318 1318 pos = pframe + (sizeof(struct ieee80211_hdr_3addr) + ie_offset); ··· 1665 1665 rtw_get_wfd_attr_content(wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen); 1666 1666 if (attr_contentlen) 1667 1667 { 1668 - pwdinfo->wfd_info->peer_rtsp_ctrlport = RTW_GET_BE16(attr_content + 2); 1668 + pwdinfo->wfd_info->peer_rtsp_ctrlport = get_unaligned_be16(attr_content + 2); 1669 1669 DBG_8723A("[%s] Peer PORT NUM = %d\n", __func__, pwdinfo->wfd_info->peer_rtsp_ctrlport); 1670 1670 } 1671 1671 } ··· 2091 2091 } 2092 2092 break; 2093 2093 case WLAN_ACTION_ADDBA_RESP: /* ADDBA response */ 2094 - status = RTW_GET_LE16(&frame_body[3]); 2094 + status = get_unaligned_le16(&frame_body[3]); 2095 2095 tid = ((frame_body[5] >> 2) & 0x7); 2096 2096 if (status == 0) { /* successful */ 2097 2097 DBG_8723A("agg_enable for TID =%d\n", tid); ··· 2110 2110 ~(1 << ((frame_body[3] >> 4) & 0xf)); 2111 2111 2112 2112 /* reason_code = frame_body[4] | (frame_body[5] << 8); */ 2113 - reason_code = RTW_GET_LE16(&frame_body[4]); 2113 + reason_code = get_unaligned_le16(&frame_body[4]); 2114 2114 } else if ((frame_body[3] & BIT(3)) == BIT(3)) { 2115 2115 tid = (frame_body[3] >> 4) & 0x0F; 2116 2116 ··· 4531 4531 4532 4532 static unsigned int on_action_public23a_p2p(struct recv_frame *precv_frame) 4533 4533 { 4534 - struct rtw_adapter *padapter = precv_frame->adapter; 4535 4534 struct sk_buff *skb = precv_frame->pkt; 4536 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 4537 4535 u8 *pframe = skb->data; 4538 - uint len = skb->len; 4539 4536 u8 *frame_body; 4540 4537 u8 dialogToken = 0; 4541 4538 #ifdef CONFIG_8723AU_P2P 4539 + struct rtw_adapter *padapter = precv_frame->adapter; 4540 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 4541 + uint len = skb->len; 4542 4542 u8 *p2p_ie; 4543 4543 u32 p2p_ielen; 4544 4544 struct wifidirect_info *pwdinfo = &padapter->wdinfo; ··· 5262 5262 unsigned short *fctrl; 5263 5263 unsigned int rate_len; 5264 5264 struct xmit_priv *pxmitpriv = &padapter->xmitpriv; 5265 - #ifdef CONFIG_8723AU_AP_MODE 5266 5265 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 5267 - #endif 5268 5266 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 5269 5267 struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; 5270 5268 struct wlan_bssid_ex *cur_network = &pmlmeinfo->network; ··· 5577 5579 #ifdef CONFIG_8723AU_AP_MODE 5578 5580 u8 *pwps_ie; 5579 5581 uint wps_ielen; 5582 + u8 *ssid_ie; 5583 + int ssid_ielen; 5584 + int ssid_ielen_diff; 5585 + u8 buf[MAX_IE_SZ]; 5586 + u8 *ies; 5587 + #endif 5588 + #if defined(CONFIG_8723AU_AP_MODE) || defined(CONFIG_8723AU_P2P) 5580 5589 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 5581 5590 #endif 5582 5591 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; ··· 5593 5588 #ifdef CONFIG_8723AU_P2P 5594 5589 struct wifidirect_info *pwdinfo = &padapter->wdinfo; 5595 5590 #endif /* CONFIG_8723AU_P2P */ 5596 - u8 *ssid_ie; 5597 - int ssid_ielen; 5598 - int ssid_ielen_diff; 5599 - u8 buf[MAX_IE_SZ]; 5600 - u8 *ies; 5601 5591 5602 5592 /* DBG_8723A("%s\n", __func__); */ 5603 5593 ··· 7559 7559 int issue = 0; 7560 7560 int poll = 0; 7561 7561 unsigned long start = jiffies; 7562 + unsigned int passing_time; 7562 7563 7563 7564 rtw_hal_set_hwreg23a(padapter, HW_VAR_BCN_VALID, NULL); 7564 7565 do { ··· 7579 7578 if (padapter->bSurpriseRemoved || padapter->bDriverStopped) 7580 7579 return _FAIL; 7581 7580 7581 + passing_time = jiffies_to_msecs(jiffies - start); 7582 + 7582 7583 if (!bxmitok) { 7583 - DBG_8723A("%s fail! %u ms\n", __func__, rtw_get_passing_time_ms23a(start)); 7584 + DBG_8723A("%s fail! %u ms\n", __func__, passing_time); 7584 7585 return _FAIL; 7585 7586 } else { 7586 - unsigned int passing_time = jiffies_to_msecs(jiffies - start); 7587 7587 7588 7588 if (passing_time > 100 || issue > 3) 7589 7589 DBG_8723A("%s success, issue:%d, poll:%d, %u ms\n",
+159 -121
drivers/staging/rtl8723au/core/rtw_p2p.c
··· 81 81 pcur++; 82 82 83 83 /* u16*)(pcur) = cpu_to_be16(psta->config_methods); */ 84 - RTW_PUT_BE16(pcur, psta->config_methods); 84 + put_unaligned_be16(psta->config_methods, pcur); 85 85 pcur += 2; 86 86 87 87 memcpy(pcur, psta->primary_dev_type, 8); ··· 96 96 if (psta->dev_name_len>0) 97 97 { 98 98 /* u16*)(pcur) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); */ 99 - RTW_PUT_BE16(pcur, WPS_ATTR_DEVICE_NAME); 99 + put_unaligned_be16(WPS_ATTR_DEVICE_NAME, pcur); 100 100 pcur += 2; 101 101 102 102 /* u16*)(pcur) = cpu_to_be16(psta->dev_name_len); */ 103 - RTW_PUT_BE16(pcur, psta->dev_name_len); 103 + put_unaligned_be16(psta->dev_name_len, pcur); 104 104 pcur += 2; 105 105 106 106 memcpy(pcur, psta->dev_name, psta->dev_name_len); ··· 320 320 wpsielen = 0; 321 321 /* WPS OUI */ 322 322 /* u32*) (wpsie) = cpu_to_be32(WPSOUI); */ 323 - RTW_PUT_BE32(wpsie, WPSOUI); 323 + put_unaligned_be32(WPSOUI, wpsie); 324 324 wpsielen += 4; 325 325 326 326 /* Config Method */ 327 327 /* Type: */ 328 328 /* u16*) (wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_CONF_METHOD); */ 329 - RTW_PUT_BE16(wpsie + wpsielen, WPS_ATTR_CONF_METHOD); 329 + put_unaligned_be16(WPS_ATTR_CONF_METHOD, wpsie + wpsielen); 330 330 wpsielen += 2; 331 331 332 332 /* Length: */ 333 333 /* u16*) (wpsie + wpsielen) = cpu_to_be16(0x0002); */ 334 - RTW_PUT_BE16(wpsie + wpsielen, 0x0002); 334 + put_unaligned_be16(0x0002, wpsie + wpsielen); 335 335 wpsielen += 2; 336 336 337 337 /* Value: */ 338 338 /* u16*) (wpsie + wpsielen) = cpu_to_be16(config_method); */ 339 - RTW_PUT_BE16(wpsie + wpsielen, config_method); 339 + put_unaligned_be16(config_method, wpsie + wpsielen); 340 340 wpsielen += 2; 341 341 342 342 pframe = rtw_set_ie23a(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen); ··· 513 513 514 514 /* Length: */ 515 515 /* Note: In the WFD specification, the size of length field is 2. */ 516 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 516 + put_unaligned_be16(0x0006, wfdie + wfdielen); 517 517 wfdielen += 2; 518 518 519 519 /* Value1: */ ··· 524 524 if (is_any_client_associated(pwdinfo->padapter)) 525 525 { 526 526 /* WFD primary sink + WiFi Direct mode + WSD (WFD Service Discovery) */ 527 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_WSD); 527 + put_unaligned_be16(pwfd_info->wfd_device_type | 528 + WFD_DEVINFO_WSD, wfdie + wfdielen); 528 529 } 529 530 else 530 531 { 531 532 /* WFD primary sink + available for WFD session + WiFi Direct mode + WSD (WFD Service Discovery) */ 532 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD); 533 + put_unaligned_be16(pwfd_info->wfd_device_type | 534 + WFD_DEVINFO_SESSION_AVAIL | 535 + WFD_DEVINFO_WSD, wfdie + wfdielen); 533 536 } 534 537 535 538 } 536 539 else 537 540 { 538 541 /* WFD primary sink + available for WFD session + WiFi Direct mode + WSD (WFD Service Discovery) */ 539 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD); 542 + put_unaligned_be16(pwfd_info->wfd_device_type | 543 + WFD_DEVINFO_SESSION_AVAIL | 544 + WFD_DEVINFO_WSD, wfdie + wfdielen); 540 545 } 541 546 542 547 wfdielen += 2; ··· 549 544 /* Value2: */ 550 545 /* Session Management Control Port */ 551 546 /* Default TCP port for RTSP messages is 554 */ 552 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport); 547 + put_unaligned_be16(pwfd_info->rtsp_ctrlport, wfdie + wfdielen); 553 548 wfdielen += 2; 554 549 555 550 /* Value3: */ 556 551 /* WFD Device Maximum Throughput */ 557 552 /* 300Mbps is the maximum throughput */ 558 - RTW_PUT_BE16(wfdie + wfdielen, 300); 553 + put_unaligned_be16(300, wfdie + wfdielen); 559 554 wfdielen += 2; 560 555 561 556 /* Associated BSSID ATTR */ ··· 564 559 565 560 /* Length: */ 566 561 /* Note: In the WFD specification, the size of length field is 2. */ 567 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 562 + put_unaligned_be16(0x0006, wfdie + wfdielen); 568 563 wfdielen += 2; 569 564 570 565 /* Value: */ ··· 586 581 587 582 /* Length: */ 588 583 /* Note: In the WFD specification, the size of length field is 2. */ 589 - RTW_PUT_BE16(wfdie + wfdielen, 0x0007); 584 + put_unaligned_be16(0x0007, wfdie + wfdielen); 590 585 wfdielen += 2; 591 586 592 587 /* Value: */ ··· 633 628 634 629 /* Length: */ 635 630 /* Note: In the WFD specification, the size of length field is 2. */ 636 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 631 + put_unaligned_be16(0x0006, wfdie + wfdielen); 637 632 wfdielen += 2; 638 633 639 634 /* Value1: */ ··· 642 637 if (1 == pwdinfo->wfd_tdls_enable) 643 638 { 644 639 /* WFD primary sink + available for WFD session + WiFi TDLS mode + WSC (WFD Service Discovery) */ 645 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | 646 - WFD_DEVINFO_SESSION_AVAIL | 647 - WFD_DEVINFO_WSD | 648 - WFD_DEVINFO_PC_TDLS); 640 + put_unaligned_be16(pwfd_info->wfd_device_type | 641 + WFD_DEVINFO_SESSION_AVAIL | 642 + WFD_DEVINFO_WSD | 643 + WFD_DEVINFO_PC_TDLS, wfdie + wfdielen); 649 644 } 650 645 else 651 646 { 652 647 /* WFD primary sink + available for WFD session + WiFi Direct mode + WSC (WFD Service Discovery) */ 653 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | 654 - WFD_DEVINFO_SESSION_AVAIL | 655 - WFD_DEVINFO_WSD); 648 + put_unaligned_be16(pwfd_info->wfd_device_type | 649 + WFD_DEVINFO_SESSION_AVAIL | 650 + WFD_DEVINFO_WSD, wfdie + wfdielen); 656 651 } 657 652 658 653 wfdielen += 2; ··· 660 655 /* Value2: */ 661 656 /* Session Management Control Port */ 662 657 /* Default TCP port for RTSP messages is 554 */ 663 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport); 658 + put_unaligned_be16(pwfd_info->rtsp_ctrlport, wfdie + wfdielen); 664 659 wfdielen += 2; 665 660 666 661 /* Value3: */ 667 662 /* WFD Device Maximum Throughput */ 668 663 /* 300Mbps is the maximum throughput */ 669 - RTW_PUT_BE16(wfdie + wfdielen, 300); 664 + put_unaligned_be16(300, wfdie + wfdielen); 670 665 wfdielen += 2; 671 666 672 667 /* Associated BSSID ATTR */ ··· 675 670 676 671 /* Length: */ 677 672 /* Note: In the WFD specification, the size of length field is 2. */ 678 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 673 + put_unaligned_be16(0x0006, wfdie + wfdielen); 679 674 wfdielen += 2; 680 675 681 676 /* Value: */ ··· 697 692 698 693 /* Length: */ 699 694 /* Note: In the WFD specification, the size of length field is 2. */ 700 - RTW_PUT_BE16(wfdie + wfdielen, 0x0007); 695 + put_unaligned_be16(0x0007, wfdie + wfdielen); 701 696 wfdielen += 2; 702 697 703 698 /* Value: */ ··· 745 740 746 741 /* Length: */ 747 742 /* Note: In the WFD specification, the size of length field is 2. */ 748 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 743 + put_unaligned_be16(0x0006, wfdie + wfdielen); 749 744 wfdielen += 2; 750 745 751 746 /* Value1: */ ··· 761 756 if (pwdinfo->wfd_tdls_enable) 762 757 { 763 758 /* TDLS mode + WSD (WFD Service Discovery) */ 764 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_WSD | WFD_DEVINFO_PC_TDLS | WFD_DEVINFO_HDCP_SUPPORT); 759 + put_unaligned_be16(pwfd_info->wfd_device_type | WFD_DEVINFO_WSD | WFD_DEVINFO_PC_TDLS | WFD_DEVINFO_HDCP_SUPPORT, wfdie + wfdielen); 765 760 } 766 761 else 767 762 { 768 763 /* WiFi Direct mode + WSD (WFD Service Discovery) */ 769 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_WSD | WFD_DEVINFO_HDCP_SUPPORT); 764 + put_unaligned_be16(pwfd_info->wfd_device_type | WFD_DEVINFO_WSD | WFD_DEVINFO_HDCP_SUPPORT, wfdie + wfdielen); 770 765 } 771 766 } 772 767 else ··· 774 769 if (pwdinfo->wfd_tdls_enable) 775 770 { 776 771 /* available for WFD session + TDLS mode + WSD (WFD Service Discovery) */ 777 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD | WFD_DEVINFO_PC_TDLS | WFD_DEVINFO_HDCP_SUPPORT); 772 + put_unaligned_be16(pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD | WFD_DEVINFO_PC_TDLS | WFD_DEVINFO_HDCP_SUPPORT, wfdie + wfdielen); 778 773 } 779 774 else 780 775 { 781 776 /* available for WFD session + WiFi Direct mode + WSD (WFD Service Discovery) */ 782 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD | WFD_DEVINFO_HDCP_SUPPORT); 777 + put_unaligned_be16(pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD | WFD_DEVINFO_HDCP_SUPPORT, wfdie + wfdielen); 783 778 } 784 779 } 785 780 } ··· 788 783 if (pwdinfo->wfd_tdls_enable) 789 784 { 790 785 /* available for WFD session + WiFi Direct mode + WSD (WFD Service Discovery) */ 791 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD | WFD_DEVINFO_PC_TDLS | WFD_DEVINFO_HDCP_SUPPORT); 786 + put_unaligned_be16(pwfd_info->wfd_device_type | 787 + WFD_DEVINFO_SESSION_AVAIL | 788 + WFD_DEVINFO_WSD | 789 + WFD_DEVINFO_PC_TDLS | 790 + WFD_DEVINFO_HDCP_SUPPORT, 791 + wfdie + wfdielen); 792 792 } 793 793 else 794 794 { 795 795 796 796 /* available for WFD session + WiFi Direct mode + WSD (WFD Service Discovery) */ 797 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD | WFD_DEVINFO_HDCP_SUPPORT); 797 + put_unaligned_be16(pwfd_info->wfd_device_type | 798 + WFD_DEVINFO_SESSION_AVAIL | 799 + WFD_DEVINFO_WSD | 800 + WFD_DEVINFO_HDCP_SUPPORT, 801 + wfdie + wfdielen); 798 802 } 799 803 } 800 804 } ··· 811 797 { 812 798 if (pwdinfo->wfd_tdls_enable) 813 799 { 814 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_WSD |WFD_DEVINFO_PC_TDLS | WFD_DEVINFO_HDCP_SUPPORT); 800 + put_unaligned_be16(pwfd_info->wfd_device_type | 801 + WFD_DEVINFO_WSD | 802 + WFD_DEVINFO_PC_TDLS | 803 + WFD_DEVINFO_HDCP_SUPPORT, 804 + wfdie + wfdielen); 815 805 } 816 806 else 817 807 { 818 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_WSD | WFD_DEVINFO_HDCP_SUPPORT); 808 + put_unaligned_be16(pwfd_info->wfd_device_type | 809 + WFD_DEVINFO_WSD | 810 + WFD_DEVINFO_HDCP_SUPPORT, 811 + wfdie + wfdielen); 819 812 } 820 813 821 814 } ··· 832 811 /* Value2: */ 833 812 /* Session Management Control Port */ 834 813 /* Default TCP port for RTSP messages is 554 */ 835 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport); 814 + put_unaligned_be16(pwfd_info->rtsp_ctrlport, wfdie + wfdielen); 836 815 wfdielen += 2; 837 816 838 817 /* Value3: */ 839 818 /* WFD Device Maximum Throughput */ 840 819 /* 300Mbps is the maximum throughput */ 841 - RTW_PUT_BE16(wfdie + wfdielen, 300); 820 + put_unaligned_be16(300, wfdie + wfdielen); 842 821 wfdielen += 2; 843 822 844 823 /* Associated BSSID ATTR */ ··· 847 826 848 827 /* Length: */ 849 828 /* Note: In the WFD specification, the size of length field is 2. */ 850 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 829 + put_unaligned_be16(0x0006, wfdie + wfdielen); 851 830 wfdielen += 2; 852 831 853 832 /* Value: */ ··· 869 848 870 849 /* Length: */ 871 850 /* Note: In the WFD specification, the size of length field is 2. */ 872 - RTW_PUT_BE16(wfdie + wfdielen, 0x0007); 851 + put_unaligned_be16(0x0007, wfdie + wfdielen); 873 852 wfdielen += 2; 874 853 875 854 /* Value: */ ··· 892 871 893 872 /* Length: */ 894 873 /* Note: In the WFD specification, the size of length field is 2. */ 895 - RTW_PUT_BE16(wfdie + wfdielen, 0x0000); 874 + put_unaligned_be16(0x0000, wfdie + wfdielen); 896 875 wfdielen += 2; 897 876 898 877 /* Todo: to add the list of WFD device info descriptor in WFD group. */ ··· 940 919 941 920 /* Length: */ 942 921 /* Note: In the WFD specification, the size of length field is 2. */ 943 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 922 + put_unaligned_be16(0x0006, wfdie + wfdielen); 944 923 wfdielen += 2; 945 924 946 925 /* Value1: */ 947 926 /* WFD device information */ 948 927 /* WFD primary sink + available for WFD session + WiFi Direct mode + WSD (WFD Service Discovery) */ 949 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD); 928 + put_unaligned_be16(pwfd_info->wfd_device_type | 929 + WFD_DEVINFO_SESSION_AVAIL | 930 + WFD_DEVINFO_WSD, wfdie + wfdielen); 950 931 wfdielen += 2; 951 932 952 933 /* Value2: */ 953 934 /* Session Management Control Port */ 954 935 /* Default TCP port for RTSP messages is 554 */ 955 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport); 936 + put_unaligned_be16(pwfd_info->rtsp_ctrlport, wfdie + wfdielen); 956 937 wfdielen += 2; 957 938 958 939 /* Value3: */ 959 940 /* WFD Device Maximum Throughput */ 960 941 /* 300Mbps is the maximum throughput */ 961 - RTW_PUT_BE16(wfdie + wfdielen, 300); 942 + put_unaligned_be16(300, wfdie + wfdielen); 962 943 wfdielen += 2; 963 944 964 945 /* Associated BSSID ATTR */ ··· 969 946 970 947 /* Length: */ 971 948 /* Note: In the WFD specification, the size of length field is 2. */ 972 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 949 + put_unaligned_be16(0x0006, wfdie + wfdielen); 973 950 wfdielen += 2; 974 951 975 952 /* Value: */ ··· 991 968 992 969 /* Length: */ 993 970 /* Note: In the WFD specification, the size of length field is 2. */ 994 - RTW_PUT_BE16(wfdie + wfdielen, 0x0007); 971 + put_unaligned_be16(0x0007, wfdie + wfdielen); 995 972 wfdielen += 2; 996 973 997 974 /* Value: */ ··· 1038 1015 1039 1016 /* Length: */ 1040 1017 /* Note: In the WFD specification, the size of length field is 2. */ 1041 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1018 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1042 1019 wfdielen += 2; 1043 1020 1044 1021 /* Value1: */ 1045 1022 /* WFD device information */ 1046 1023 /* WFD primary sink + available for WFD session + WiFi Direct mode + WSD (WFD Service Discovery) */ 1047 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD); 1024 + put_unaligned_be16(pwfd_info->wfd_device_type | 1025 + WFD_DEVINFO_SESSION_AVAIL | 1026 + WFD_DEVINFO_WSD, wfdie + wfdielen); 1048 1027 wfdielen += 2; 1049 1028 1050 1029 /* Value2: */ 1051 1030 /* Session Management Control Port */ 1052 1031 /* Default TCP port for RTSP messages is 554 */ 1053 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport); 1032 + put_unaligned_be16(pwfd_info->rtsp_ctrlport, wfdie + wfdielen); 1054 1033 wfdielen += 2; 1055 1034 1056 1035 /* Value3: */ 1057 1036 /* WFD Device Maximum Throughput */ 1058 1037 /* 300Mbps is the maximum throughput */ 1059 - RTW_PUT_BE16(wfdie + wfdielen, 300); 1038 + put_unaligned_be16(300, wfdie + wfdielen); 1060 1039 wfdielen += 2; 1061 1040 1062 1041 /* Associated BSSID ATTR */ ··· 1067 1042 1068 1043 /* Length: */ 1069 1044 /* Note: In the WFD specification, the size of length field is 2. */ 1070 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1045 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1071 1046 wfdielen += 2; 1072 1047 1073 1048 /* Value: */ ··· 1089 1064 1090 1065 /* Length: */ 1091 1066 /* Note: In the WFD specification, the size of length field is 2. */ 1092 - RTW_PUT_BE16(wfdie + wfdielen, 0x0007); 1067 + put_unaligned_be16(0x0007, wfdie + wfdielen); 1093 1068 wfdielen += 2; 1094 1069 1095 1070 /* Value: */ ··· 1136 1111 1137 1112 /* Length: */ 1138 1113 /* Note: In the WFD specification, the size of length field is 2. */ 1139 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1114 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1140 1115 wfdielen += 2; 1141 1116 1142 1117 /* Value1: */ 1143 1118 /* WFD device information */ 1144 1119 /* WFD primary sink + WiFi Direct mode + WSD (WFD Service Discovery) + WFD Session Available */ 1145 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_WSD | WFD_DEVINFO_SESSION_AVAIL); 1120 + put_unaligned_be16(pwfd_info->wfd_device_type | 1121 + WFD_DEVINFO_WSD | WFD_DEVINFO_SESSION_AVAIL, 1122 + wfdie + wfdielen); 1146 1123 wfdielen += 2; 1147 1124 1148 1125 /* Value2: */ 1149 1126 /* Session Management Control Port */ 1150 1127 /* Default TCP port for RTSP messages is 554 */ 1151 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport); 1128 + put_unaligned_be16(pwfd_info->rtsp_ctrlport, wfdie + wfdielen); 1152 1129 wfdielen += 2; 1153 1130 1154 1131 /* Value3: */ 1155 1132 /* WFD Device Maximum Throughput */ 1156 1133 /* 300Mbps is the maximum throughput */ 1157 - RTW_PUT_BE16(wfdie + wfdielen, 300); 1134 + put_unaligned_be16(300, wfdie + wfdielen); 1158 1135 wfdielen += 2; 1159 1136 1160 1137 /* Associated BSSID ATTR */ ··· 1165 1138 1166 1139 /* Length: */ 1167 1140 /* Note: In the WFD specification, the size of length field is 2. */ 1168 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1141 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1169 1142 wfdielen += 2; 1170 1143 1171 1144 /* Value: */ ··· 1187 1160 1188 1161 /* Length: */ 1189 1162 /* Note: In the WFD specification, the size of length field is 2. */ 1190 - RTW_PUT_BE16(wfdie + wfdielen, 0x0007); 1163 + put_unaligned_be16(0x0007, wfdie + wfdielen); 1191 1164 wfdielen += 2; 1192 1165 1193 1166 /* Value: */ ··· 1234 1207 1235 1208 /* Length: */ 1236 1209 /* Note: In the WFD specification, the size of length field is 2. */ 1237 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1210 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1238 1211 wfdielen += 2; 1239 1212 1240 1213 /* Value1: */ 1241 1214 /* WFD device information */ 1242 1215 /* WFD primary sink + WiFi Direct mode + WSD (WFD Service Discovery) + WFD Session Available */ 1243 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_WSD | WFD_DEVINFO_SESSION_AVAIL); 1216 + put_unaligned_be16(pwfd_info->wfd_device_type | 1217 + WFD_DEVINFO_WSD | WFD_DEVINFO_SESSION_AVAIL, 1218 + wfdie + wfdielen); 1244 1219 wfdielen += 2; 1245 1220 1246 1221 /* Value2: */ 1247 1222 /* Session Management Control Port */ 1248 1223 /* Default TCP port for RTSP messages is 554 */ 1249 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport); 1224 + put_unaligned_be16(pwfd_info->rtsp_ctrlport, wfdie + wfdielen); 1250 1225 wfdielen += 2; 1251 1226 1252 1227 /* Value3: */ 1253 1228 /* WFD Device Maximum Throughput */ 1254 1229 /* 300Mbps is the maximum throughput */ 1255 - RTW_PUT_BE16(wfdie + wfdielen, 300); 1230 + put_unaligned_be16(300, wfdie + wfdielen); 1256 1231 wfdielen += 2; 1257 1232 1258 1233 /* Associated BSSID ATTR */ ··· 1263 1234 1264 1235 /* Length: */ 1265 1236 /* Note: In the WFD specification, the size of length field is 2. */ 1266 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1237 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1267 1238 wfdielen += 2; 1268 1239 1269 1240 /* Value: */ ··· 1285 1256 1286 1257 /* Length: */ 1287 1258 /* Note: In the WFD specification, the size of length field is 2. */ 1288 - RTW_PUT_BE16(wfdie + wfdielen, 0x0007); 1259 + put_unaligned_be16(0x0007, wfdie + wfdielen); 1289 1260 wfdielen += 2; 1290 1261 1291 1262 /* Value: */ ··· 1332 1303 1333 1304 /* Length: */ 1334 1305 /* Note: In the WFD specification, the size of length field is 2. */ 1335 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1306 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1336 1307 wfdielen += 2; 1337 1308 1338 1309 /* Value1: */ 1339 1310 /* WFD device information */ 1340 1311 /* WFD primary sink + WiFi Direct mode + WSD (WFD Service Discovery) + WFD Session Available */ 1341 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_WSD | WFD_DEVINFO_SESSION_AVAIL); 1312 + put_unaligned_be16(pwfd_info->wfd_device_type | WFD_DEVINFO_WSD | 1313 + WFD_DEVINFO_SESSION_AVAIL, wfdie + wfdielen); 1342 1314 wfdielen += 2; 1343 1315 1344 1316 /* Value2: */ 1345 1317 /* Session Management Control Port */ 1346 1318 /* Default TCP port for RTSP messages is 554 */ 1347 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport); 1319 + put_unaligned_be16(pwfd_info->rtsp_ctrlport, wfdie + wfdielen); 1348 1320 wfdielen += 2; 1349 1321 1350 1322 /* Value3: */ 1351 1323 /* WFD Device Maximum Throughput */ 1352 1324 /* 300Mbps is the maximum throughput */ 1353 - RTW_PUT_BE16(wfdie + wfdielen, 300); 1325 + put_unaligned_be16(300, wfdie + wfdielen); 1354 1326 wfdielen += 2; 1355 1327 1356 1328 /* Associated BSSID ATTR */ ··· 1360 1330 1361 1331 /* Length: */ 1362 1332 /* Note: In the WFD specification, the size of length field is 2. */ 1363 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1333 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1364 1334 wfdielen += 2; 1365 1335 1366 1336 /* Value: */ ··· 1382 1352 1383 1353 /* Length: */ 1384 1354 /* Note: In the WFD specification, the size of length field is 2. */ 1385 - RTW_PUT_BE16(wfdie + wfdielen, 0x0007); 1355 + put_unaligned_be16(0x0007, wfdie + wfdielen); 1386 1356 wfdielen += 2; 1387 1357 1388 1358 /* Value: */ ··· 1429 1399 1430 1400 /* Length: */ 1431 1401 /* Note: In the WFD specification, the size of length field is 2. */ 1432 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1402 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1433 1403 wfdielen += 2; 1434 1404 1435 1405 /* Value1: */ 1436 1406 /* WFD device information */ 1437 1407 /* WFD primary sink + available for WFD session + WiFi Direct mode + WSD (WFD Service Discovery) */ 1438 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD); 1408 + put_unaligned_be16(pwfd_info->wfd_device_type | 1409 + WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD, 1410 + wfdie + wfdielen); 1439 1411 wfdielen += 2; 1440 1412 1441 1413 /* Value2: */ 1442 1414 /* Session Management Control Port */ 1443 1415 /* Default TCP port for RTSP messages is 554 */ 1444 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport); 1416 + put_unaligned_be16(pwfd_info->rtsp_ctrlport, wfdie + wfdielen); 1445 1417 wfdielen += 2; 1446 1418 1447 1419 /* Value3: */ 1448 1420 /* WFD Device Maximum Throughput */ 1449 1421 /* 300Mbps is the maximum throughput */ 1450 - RTW_PUT_BE16(wfdie + wfdielen, 300); 1422 + put_unaligned_be16(300, wfdie + wfdielen); 1451 1423 wfdielen += 2; 1452 1424 1453 1425 /* Associated BSSID ATTR */ ··· 1458 1426 1459 1427 /* Length: */ 1460 1428 /* Note: In the WFD specification, the size of length field is 2. */ 1461 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1429 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1462 1430 wfdielen += 2; 1463 1431 1464 1432 /* Value: */ ··· 1480 1448 1481 1449 /* Length: */ 1482 1450 /* Note: In the WFD specification, the size of length field is 2. */ 1483 - RTW_PUT_BE16(wfdie + wfdielen, 0x0007); 1451 + put_unaligned_be16(0x0007, wfdie + wfdielen); 1484 1452 wfdielen += 2; 1485 1453 1486 1454 /* Value: */ ··· 1503 1471 1504 1472 /* Length: */ 1505 1473 /* Note: In the WFD specification, the size of length field is 2. */ 1506 - RTW_PUT_BE16(wfdie + wfdielen, 0x0000); 1474 + put_unaligned_be16(0x0000, wfdie + wfdielen); 1507 1475 wfdielen += 2; 1508 1476 1509 1477 /* Todo: to add the list of WFD device info descriptor in WFD group. */ ··· 1542 1510 1543 1511 /* Length: */ 1544 1512 /* Note: In the WFD specification, the size of length field is 2. */ 1545 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1513 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1546 1514 wfdielen += 2; 1547 1515 1548 1516 /* Value1: */ 1549 1517 /* WFD device information */ 1550 1518 /* WFD primary sink + available for WFD session + WiFi Direct mode + WSD (WFD Service Discovery) */ 1551 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD); 1519 + put_unaligned_be16(pwfd_info->wfd_device_type | 1520 + WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD, 1521 + wfdie + wfdielen); 1552 1522 wfdielen += 2; 1553 1523 1554 1524 /* Value2: */ 1555 1525 /* Session Management Control Port */ 1556 1526 /* Default TCP port for RTSP messages is 554 */ 1557 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport); 1527 + put_unaligned_be16(pwfd_info->rtsp_ctrlport, wfdie + wfdielen); 1558 1528 wfdielen += 2; 1559 1529 1560 1530 /* Value3: */ 1561 1531 /* WFD Device Maximum Throughput */ 1562 1532 /* 300Mbps is the maximum throughput */ 1563 - RTW_PUT_BE16(wfdie + wfdielen, 300); 1533 + put_unaligned_be16(300, wfdie + wfdielen); 1564 1534 wfdielen += 2; 1565 1535 1566 1536 /* Associated BSSID ATTR */ ··· 1571 1537 1572 1538 /* Length: */ 1573 1539 /* Note: In the WFD specification, the size of length field is 2. */ 1574 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1540 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1575 1541 wfdielen += 2; 1576 1542 1577 1543 /* Value: */ ··· 1593 1559 1594 1560 /* Length: */ 1595 1561 /* Note: In the WFD specification, the size of length field is 2. */ 1596 - RTW_PUT_BE16(wfdie + wfdielen, 0x0007); 1562 + put_unaligned_be16(0x0007, wfdie + wfdielen); 1597 1563 wfdielen += 2; 1598 1564 1599 1565 /* Value: */ ··· 1616 1582 1617 1583 /* Length: */ 1618 1584 /* Note: In the WFD specification, the size of length field is 2. */ 1619 - RTW_PUT_BE16(wfdie + wfdielen, 0x0000); 1585 + put_unaligned_be16(0x0000, wfdie + wfdielen); 1620 1586 wfdielen += 2; 1621 1587 1622 1588 /* Todo: to add the list of WFD device info descriptor in WFD group. */ ··· 1655 1621 1656 1622 /* Length: */ 1657 1623 /* Note: In the WFD specification, the size of length field is 2. */ 1658 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1624 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1659 1625 wfdielen += 2; 1660 1626 1661 1627 /* Value1: */ 1662 1628 /* WFD device information */ 1663 1629 /* WFD primary sink + available for WFD session + WiFi Direct mode + WSD (WFD Service Discovery) */ 1664 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD); 1630 + put_unaligned_be16(pwfd_info->wfd_device_type | 1631 + WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD, 1632 + wfdie + wfdielen); 1665 1633 wfdielen += 2; 1666 1634 1667 1635 /* Value2: */ 1668 1636 /* Session Management Control Port */ 1669 1637 /* Default TCP port for RTSP messages is 554 */ 1670 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport); 1638 + put_unaligned_be16(pwfd_info->rtsp_ctrlport, wfdie + wfdielen); 1671 1639 wfdielen += 2; 1672 1640 1673 1641 /* Value3: */ 1674 1642 /* WFD Device Maximum Throughput */ 1675 1643 /* 300Mbps is the maximum throughput */ 1676 - RTW_PUT_BE16(wfdie + wfdielen, 300); 1644 + put_unaligned_be16(300, wfdie + wfdielen); 1677 1645 wfdielen += 2; 1678 1646 1679 1647 /* Associated BSSID ATTR */ ··· 1684 1648 1685 1649 /* Length: */ 1686 1650 /* Note: In the WFD specification, the size of length field is 2. */ 1687 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1651 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1688 1652 wfdielen += 2; 1689 1653 1690 1654 /* Value: */ ··· 1706 1670 1707 1671 /* Length: */ 1708 1672 /* Note: In the WFD specification, the size of length field is 2. */ 1709 - RTW_PUT_BE16(wfdie + wfdielen, 0x0007); 1673 + put_unaligned_be16(0x0007, wfdie + wfdielen); 1710 1674 wfdielen += 2; 1711 1675 1712 1676 /* Value: */ ··· 1753 1717 1754 1718 /* Length: */ 1755 1719 /* Note: In the WFD specification, the size of length field is 2. */ 1756 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1720 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1757 1721 wfdielen += 2; 1758 1722 1759 1723 /* Value1: */ 1760 1724 /* WFD device information */ 1761 1725 /* WFD primary sink + available for WFD session + WiFi Direct mode + WSD (WFD Service Discovery) */ 1762 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->wfd_device_type | WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD); 1726 + put_unaligned_be16(pwfd_info->wfd_device_type | 1727 + WFD_DEVINFO_SESSION_AVAIL | WFD_DEVINFO_WSD, 1728 + wfdie + wfdielen); 1763 1729 wfdielen += 2; 1764 1730 1765 1731 /* Value2: */ 1766 1732 /* Session Management Control Port */ 1767 1733 /* Default TCP port for RTSP messages is 554 */ 1768 - RTW_PUT_BE16(wfdie + wfdielen, pwfd_info->rtsp_ctrlport); 1734 + put_unaligned_be16(pwfd_info->rtsp_ctrlport, wfdie + wfdielen); 1769 1735 wfdielen += 2; 1770 1736 1771 1737 /* Value3: */ 1772 1738 /* WFD Device Maximum Throughput */ 1773 1739 /* 300Mbps is the maximum throughput */ 1774 - RTW_PUT_BE16(wfdie + wfdielen, 300); 1740 + put_unaligned_be16(300, wfdie + wfdielen); 1775 1741 wfdielen += 2; 1776 1742 1777 1743 /* Associated BSSID ATTR */ ··· 1782 1744 1783 1745 /* Length: */ 1784 1746 /* Note: In the WFD specification, the size of length field is 2. */ 1785 - RTW_PUT_BE16(wfdie + wfdielen, 0x0006); 1747 + put_unaligned_be16(0x0006, wfdie + wfdielen); 1786 1748 wfdielen += 2; 1787 1749 1788 1750 /* Value: */ ··· 1804 1766 1805 1767 /* Length: */ 1806 1768 /* Note: In the WFD specification, the size of length field is 2. */ 1807 - RTW_PUT_BE16(wfdie + wfdielen, 0x0007); 1769 + put_unaligned_be16(0x0007, wfdie + wfdielen); 1808 1770 wfdielen += 2; 1809 1771 1810 1772 /* Value: */ ··· 1852 1814 1853 1815 /* Length: */ 1854 1816 /* u16*) (p2pie + p2pielen) = cpu_to_le16(0x0002); */ 1855 - RTW_PUT_LE16(p2pie + p2pielen, 0x0002); 1817 + put_unaligned_le16(0x0002, p2pie + p2pielen); 1856 1818 p2pielen += 2; 1857 1819 1858 1820 /* Value: */ ··· 1884 1846 1885 1847 /* Length: */ 1886 1848 /* u16*) (p2pie + p2pielen) = cpu_to_le16(0x0004); */ 1887 - RTW_PUT_LE16(p2pie + p2pielen, 0x0004); 1849 + put_unaligned_le16(0x0004, p2pie + p2pielen); 1888 1850 p2pielen += 2; 1889 1851 1890 1852 /* Value: */ 1891 1853 /* Availability Period */ 1892 1854 /* u16*) (p2pie + p2pielen) = cpu_to_le16(0xFFFF); */ 1893 - RTW_PUT_LE16(p2pie + p2pielen, 0xFFFF); 1855 + put_unaligned_le16(0xFFFF, p2pie + p2pielen); 1894 1856 p2pielen += 2; 1895 1857 1896 1858 /* Availability Interval */ 1897 1859 /* u16*) (p2pie + p2pielen) = cpu_to_le16(0xFFFF); */ 1898 - RTW_PUT_LE16(p2pie + p2pielen, 0xFFFF); 1860 + put_unaligned_le16(0xFFFF, p2pie + p2pielen); 1899 1861 p2pielen += 2; 1900 1862 1901 1863 /* Notice of Absence ATTR */ ··· 1915 1877 /* 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) */ 1916 1878 /* + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) */ 1917 1879 /* u16*) (p2pie + p2pielen) = cpu_to_le16(21 + pwdinfo->device_name_len); */ 1918 - RTW_PUT_LE16(p2pie + p2pielen, 21 + pwdinfo->device_name_len); 1880 + put_unaligned_le16(21 + pwdinfo->device_name_len, p2pie + p2pielen); 1919 1881 p2pielen += 2; 1920 1882 1921 1883 /* Value: */ ··· 1926 1888 /* Config Method */ 1927 1889 /* This field should be big endian. Noted by P2P specification. */ 1928 1890 /* u16*) (p2pie + p2pielen) = cpu_to_be16(pwdinfo->supported_wps_cm); */ 1929 - RTW_PUT_BE16(p2pie + p2pielen, pwdinfo->supported_wps_cm); 1891 + put_unaligned_be16(pwdinfo->supported_wps_cm, p2pie + p2pielen); 1930 1892 p2pielen += 2; 1931 1893 1932 1894 /* Primary Device Type */ 1933 1895 /* Category ID */ 1934 1896 /* u16*) (p2pie + p2pielen) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); */ 1935 - RTW_PUT_BE16(p2pie + p2pielen, WPS_PDT_CID_MULIT_MEDIA); 1897 + put_unaligned_be16(WPS_PDT_CID_MULIT_MEDIA, p2pie + p2pielen); 1936 1898 p2pielen += 2; 1937 1899 1938 1900 /* OUI */ 1939 1901 /* u32*) (p2pie + p2pielen) = cpu_to_be32(WPSOUI); */ 1940 - RTW_PUT_BE32(p2pie + p2pielen, WPSOUI); 1902 + put_unaligned_be32(WPSOUI, p2pie + p2pielen); 1941 1903 p2pielen += 4; 1942 1904 1943 1905 /* Sub Category ID */ 1944 1906 /* u16*) (p2pie + p2pielen) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); */ 1945 - RTW_PUT_BE16(p2pie + p2pielen, WPS_PDT_SCID_MEDIA_SERVER); 1907 + put_unaligned_be16(WPS_PDT_SCID_MEDIA_SERVER, p2pie + p2pielen); 1946 1908 p2pielen += 2; 1947 1909 1948 1910 /* Number of Secondary Device Types */ ··· 1951 1913 /* Device Name */ 1952 1914 /* Type: */ 1953 1915 /* u16*) (p2pie + p2pielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); */ 1954 - RTW_PUT_BE16(p2pie + p2pielen, WPS_ATTR_DEVICE_NAME); 1916 + put_unaligned_be16(WPS_ATTR_DEVICE_NAME, p2pie + p2pielen); 1955 1917 p2pielen += 2; 1956 1918 1957 1919 /* Length: */ 1958 1920 /* u16*) (p2pie + p2pielen) = cpu_to_be16(pwdinfo->device_name_len); */ 1959 - RTW_PUT_BE16(p2pie + p2pielen, pwdinfo->device_name_len); 1921 + put_unaligned_be16(pwdinfo->device_name_len, p2pie + p2pielen); 1960 1922 p2pielen += 2; 1961 1923 1962 1924 /* Value: */ ··· 2001 1963 2002 1964 /* Length: */ 2003 1965 /* u16*) (p2pie + p2pielen) = cpu_to_le16(0x0002); */ 2004 - RTW_PUT_LE16(p2pie + p2pielen, 0x0002); 1966 + put_unaligned_le16(0x0002, p2pie + p2pielen); 2005 1967 p2pielen += 2; 2006 1968 2007 1969 /* Value: */ ··· 2022 1984 /* 21 -> P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) */ 2023 1985 /* + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) */ 2024 1986 /* u16*) (p2pie + p2pielen) = cpu_to_le16(21 + pwdinfo->device_name_len); */ 2025 - RTW_PUT_LE16(p2pie + p2pielen, 21 + pwdinfo->device_name_len); 1987 + put_unaligned_le16(21 + pwdinfo->device_name_len, p2pie + p2pielen); 2026 1988 p2pielen += 2; 2027 1989 2028 1990 /* Value: */ ··· 2035 1997 if (pwdinfo->ui_got_wps_info == P2P_GOT_WPSINFO_PBC) 2036 1998 { 2037 1999 /* u16*) (p2pie + p2pielen) = cpu_to_be16(WPS_CONFIG_METHOD_PBC); */ 2038 - RTW_PUT_BE16(p2pie + p2pielen, WPS_CONFIG_METHOD_PBC); 2000 + put_unaligned_be16(WPS_CONFIG_METHOD_PBC, p2pie + p2pielen); 2039 2001 } 2040 2002 else 2041 2003 { 2042 2004 /* u16*) (p2pie + p2pielen) = cpu_to_be16(WPS_CONFIG_METHOD_DISPLAY); */ 2043 - RTW_PUT_BE16(p2pie + p2pielen, WPS_CONFIG_METHOD_DISPLAY); 2005 + put_unaligned_be16(WPS_CONFIG_METHOD_DISPLAY, p2pie + p2pielen); 2044 2006 } 2045 2007 2046 2008 p2pielen += 2; ··· 2048 2010 /* Primary Device Type */ 2049 2011 /* Category ID */ 2050 2012 /* u16*) (p2pie + p2pielen) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); */ 2051 - RTW_PUT_BE16(p2pie + p2pielen, WPS_PDT_CID_MULIT_MEDIA); 2013 + put_unaligned_be16(WPS_PDT_CID_MULIT_MEDIA, p2pie + p2pielen); 2052 2014 p2pielen += 2; 2053 2015 2054 2016 /* OUI */ 2055 2017 /* u32*) (p2pie + p2pielen) = cpu_to_be32(WPSOUI); */ 2056 - RTW_PUT_BE32(p2pie + p2pielen, WPSOUI); 2018 + put_unaligned_be32(WPSOUI, p2pie + p2pielen); 2057 2019 p2pielen += 4; 2058 2020 2059 2021 /* Sub Category ID */ 2060 2022 /* u16*) (p2pie + p2pielen) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); */ 2061 - RTW_PUT_BE16(p2pie + p2pielen, WPS_PDT_SCID_MEDIA_SERVER); 2023 + put_unaligned_be16(WPS_PDT_SCID_MEDIA_SERVER, p2pie + p2pielen); 2062 2024 p2pielen += 2; 2063 2025 2064 2026 /* Number of Secondary Device Types */ ··· 2067 2029 /* Device Name */ 2068 2030 /* Type: */ 2069 2031 /* u16*) (p2pie + p2pielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); */ 2070 - RTW_PUT_BE16(p2pie + p2pielen, WPS_ATTR_DEVICE_NAME); 2032 + put_unaligned_be16(WPS_ATTR_DEVICE_NAME, p2pie + p2pielen); 2071 2033 p2pielen += 2; 2072 2034 2073 2035 /* Length: */ 2074 2036 /* u16*) (p2pie + p2pielen) = cpu_to_be16(pwdinfo->device_name_len); */ 2075 - RTW_PUT_BE16(p2pie + p2pielen, pwdinfo->device_name_len); 2037 + put_unaligned_be16(pwdinfo->device_name_len, p2pie + p2pielen); 2076 2038 p2pielen += 2; 2077 2039 2078 2040 /* Value: */ ··· 2090 2052 2091 2053 /* Length: */ 2092 2054 /* u16*) (p2pie + p2pielen) = cpu_to_le16(ETH_ALEN + ussidlen); */ 2093 - RTW_PUT_LE16(p2pie + p2pielen, ETH_ALEN + ussidlen); 2055 + put_unaligned_le16(ETH_ALEN + ussidlen, p2pie + p2pielen); 2094 2056 p2pielen += 2; 2095 2057 2096 2058 /* Value: */ ··· 2723 2685 rtw_get_wfd_attr_content(wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen); 2724 2686 if (attr_contentlen) 2725 2687 { 2726 - pwdinfo->wfd_info->peer_rtsp_ctrlport = RTW_GET_BE16(attr_content + 2); 2688 + pwdinfo->wfd_info->peer_rtsp_ctrlport = get_unaligned_be16(attr_content + 2); 2727 2689 DBG_8723A("[%s] Peer PORT NUM = %d\n", __func__, pwdinfo->wfd_info->peer_rtsp_ctrlport); 2728 2690 } 2729 2691 } ··· 2964 2926 rtw_get_wfd_attr_content(wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen); 2965 2927 if (attr_contentlen) 2966 2928 { 2967 - pwdinfo->wfd_info->peer_rtsp_ctrlport = RTW_GET_BE16(attr_content + 2); 2929 + pwdinfo->wfd_info->peer_rtsp_ctrlport = get_unaligned_be16(attr_content + 2); 2968 2930 DBG_8723A("[%s] Peer PORT NUM = %d\n", __func__, pwdinfo->wfd_info->peer_rtsp_ctrlport); 2969 2931 } 2970 2932 } ··· 3897 3859 3898 3860 rtw_p2p_findphase_ex_set(pwdinfo, P2P_FINDPHASE_EX_NONE); 3899 3861 3900 - pwdinfo->listen_dwell = (u8) ((rtw_get_current_time() % 3) + 1); 3862 + pwdinfo->listen_dwell = (u8) ((jiffies % 3) + 1); 3901 3863 /* DBG_8723A("[%s] listen_dwell time is %d00ms\n", __func__, pwdinfo->listen_dwell); */ 3902 3864 3903 3865 memset(&pwdinfo->tx_prov_disc_info, 0x00, sizeof(struct tx_provdisc_req_info));
+21 -18
drivers/staging/rtl8723au/core/rtw_pwrctrl.c
··· 108 108 struct rtw_adapter *buddy = adapter->pbuddy_adapter; 109 109 struct mlme_priv *pmlmepriv = &adapter->mlmepriv; 110 110 struct xmit_priv *pxmit_priv = &adapter->xmitpriv; 111 - #ifdef CONFIG_8723AU_P2P 112 111 struct wifidirect_info *pwdinfo = &adapter->wdinfo; 113 - #endif 114 112 115 113 bool ret = false; 116 114 117 - if (adapter->pwrctrlpriv.ips_deny_time >= rtw_get_current_time()) 115 + if (time_after_eq(adapter->pwrctrlpriv.ips_deny_time, jiffies)) 118 116 goto exit; 119 117 120 118 if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE|WIFI_SITE_MONITOR) ··· 127 129 /* consider buddy, if exist */ 128 130 if (buddy) { 129 131 struct mlme_priv *b_pmlmepriv = &buddy->mlmepriv; 130 - #ifdef CONFIG_8723AU_P2P 131 132 struct wifidirect_info *b_pwdinfo = &buddy->wdinfo; 132 - #endif 133 133 134 134 if (check_fwstate(b_pmlmepriv, WIFI_ASOC_STATE|WIFI_SITE_MONITOR) 135 135 || check_fwstate(b_pmlmepriv, WIFI_UNDER_LINKING|WIFI_UNDER_WPS) ··· 382 386 */ 383 387 s32 LPS_RF_ON_check23a(struct rtw_adapter *padapter, u32 delay_ms) 384 388 { 385 - u32 start_time; 389 + unsigned long start_time, end_time; 386 390 u8 bAwake = false; 387 391 s32 err = 0; 388 392 389 - start_time = rtw_get_current_time(); 393 + start_time = jiffies; 394 + end_time = start_time + msecs_to_jiffies(delay_ms); 395 + 390 396 while (1) 391 397 { 392 398 rtw23a_hal_get_hwreg(padapter, HW_VAR_FWLPS_RF_ON, &bAwake); ··· 402 404 break; 403 405 } 404 406 405 - if (rtw_get_passing_time_ms23a(start_time) > delay_ms) 406 - { 407 + if (time_after(jiffies, end_time)) { 407 408 err = -1; 408 409 DBG_8723A("%s: Wait for FW LPS leave more than %u ms!!!\n", __func__, delay_ms); 409 410 break; ··· 536 539 inline void rtw_set_ips_deny23a(struct rtw_adapter *padapter, u32 ms) 537 540 { 538 541 struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; 539 - pwrpriv->ips_deny_time = rtw_get_current_time() + rtw_ms_to_systime23a(ms); 542 + pwrpriv->ips_deny_time = jiffies + msecs_to_jiffies(ms); 540 543 } 541 544 542 545 /* ··· 551 554 struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; 552 555 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 553 556 int ret = _SUCCESS; 554 - u32 start = rtw_get_current_time(); 557 + unsigned long start = jiffies; 558 + unsigned long new_deny_time; 555 559 556 - if (pwrpriv->ips_deny_time < rtw_get_current_time() + rtw_ms_to_systime23a(ips_deffer_ms)) 557 - pwrpriv->ips_deny_time = rtw_get_current_time() + rtw_ms_to_systime23a(ips_deffer_ms); 560 + new_deny_time = jiffies + msecs_to_jiffies(ips_deffer_ms); 561 + 562 + if (time_before(pwrpriv->ips_deny_time, new_deny_time)) 563 + pwrpriv->ips_deny_time = new_deny_time; 558 564 559 565 if (pwrpriv->ps_processing) { 560 566 DBG_8723A("%s wait ps_processing...\n", __func__); 561 - while (pwrpriv->ps_processing && rtw_get_passing_time_ms23a(start) <= 3000) 567 + while (pwrpriv->ps_processing && 568 + jiffies_to_msecs(jiffies - start) <= 3000) 562 569 msleep(10); 563 570 if (pwrpriv->ps_processing) 564 571 DBG_8723A("%s wait ps_processing timeout\n", __func__); ··· 572 571 573 572 if (rtw_hal_sreset_inprogress(padapter)) { 574 573 DBG_8723A("%s wait sreset_inprogress...\n", __func__); 575 - while (rtw_hal_sreset_inprogress(padapter) && rtw_get_passing_time_ms23a(start) <= 4000) 574 + while (rtw_hal_sreset_inprogress(padapter) && 575 + jiffies_to_msecs(jiffies - start) <= 4000) 576 576 msleep(10); 577 577 if (rtw_hal_sreset_inprogress(padapter)) 578 578 DBG_8723A("%s wait sreset_inprogress timeout\n", __func__); ··· 584 582 if (pwrpriv->bInternalAutoSuspend == false && pwrpriv->bInSuspend) { 585 583 DBG_8723A("%s wait bInSuspend...\n", __func__); 586 584 while (pwrpriv->bInSuspend && 587 - (rtw_get_passing_time_ms23a(start) <= 3000)) { 585 + (jiffies_to_msecs(jiffies - start) <= 3000)) { 588 586 msleep(10); 589 587 } 590 588 if (pwrpriv->bInSuspend) ··· 632 630 } 633 631 634 632 exit: 635 - if (pwrpriv->ips_deny_time < rtw_get_current_time() + rtw_ms_to_systime23a(ips_deffer_ms)) 636 - pwrpriv->ips_deny_time = rtw_get_current_time() + rtw_ms_to_systime23a(ips_deffer_ms); 633 + new_deny_time = jiffies + msecs_to_jiffies(ips_deffer_ms); 634 + if (time_before(pwrpriv->ips_deny_time, new_deny_time)) 635 + pwrpriv->ips_deny_time = new_deny_time; 637 636 return ret; 638 637 } 639 638
+5 -6
drivers/staging/rtl8723au/core/rtw_security.c
··· 202 202 arcfour_encrypt(&mycontext, payload + length, crc, 4); 203 203 204 204 pframe += pxmitpriv->frag_len; 205 - pframe = (u8 *)RND4((unsigned long)(pframe)); 205 + pframe = PTR_ALIGN(pframe, 4); 206 206 } 207 207 } 208 208 ··· 225 225 pframe = skb->data; 226 226 227 227 /* start to decrypt recvframe */ 228 - if ((prxattrib->encrypt =! _WEP40_) && (prxattrib->encrypt != _WEP104_)) 228 + if ((prxattrib->encrypt != _WEP40_) && (prxattrib->encrypt != _WEP104_)) 229 229 return; 230 230 231 231 iv = pframe + prxattrib->hdrlen; ··· 699 699 arcfour_encrypt(&mycontext, payload+length, crc, 4); 700 700 701 701 pframe+= pxmitpriv->frag_len; 702 - pframe = (u8 *)RND4((unsigned long)(pframe)); 703 - 702 + pframe = PTR_ALIGN(pframe, 4); 704 703 } 705 704 } 706 705 ··· 1370 1371 1371 1372 aes_cipher(prwskey, pattrib->hdrlen, pframe, length); 1372 1373 pframe += pxmitpriv->frag_len; 1373 - pframe = (u8*)RND4((unsigned long)pframe); 1374 + pframe = PTR_ALIGN(pframe, 4); 1374 1375 } 1375 1376 } 1376 1377 out: ··· 1598 1599 1599 1600 pframe = skb->data; 1600 1601 /* 4 start to encrypt each fragment */ 1601 - if (!prxattrib->encrypt != _AES_) 1602 + if (prxattrib->encrypt != _AES_) 1602 1603 return _FAIL; 1603 1604 1604 1605 stainfo = rtw_get_stainfo23a(&padapter->stapriv, &prxattrib->ta[0]);
+2
drivers/staging/rtl8723au/core/rtw_sreset.c
··· 165 165 if (check_fwstate(mlmepriv, WIFI_STATION_STATE)) { 166 166 DBG_8723A(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); 167 167 sreset_restore_network_station(padapter); 168 + #ifdef CONFIG_8723AU_AP_MODE 168 169 } else if (check_fwstate(mlmepriv, WIFI_AP_STATE)) { 169 170 DBG_8723A(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); 170 171 rtw_ap_restore_network(padapter); 172 + #endif 171 173 } else if (check_fwstate(mlmepriv, WIFI_ADHOC_STATE)) { 172 174 DBG_8723A(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_ADHOC_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(mlmepriv)); 173 175 } else {
+1 -1
drivers/staging/rtl8723au/core/rtw_wlan_util.c
··· 581 581 DBG_8723A("[%s] Found WFD IE\n", __func__); 582 582 rtw_get_wfd_attr_content(wfd_ie, wfd_ielen, WFD_ATTR_DEVICE_INFO, attr_content, &attr_contentlen); 583 583 if (attr_contentlen) { 584 - pwdinfo->wfd_info->peer_rtsp_ctrlport = RTW_GET_BE16(attr_content + 2); 584 + pwdinfo->wfd_info->peer_rtsp_ctrlport = get_unaligned_be16(attr_content + 2); 585 585 DBG_8723A("[%s] Peer PORT NUM = %d\n", __func__, pwdinfo->wfd_info->peer_rtsp_ctrlport); 586 586 return true; 587 587 }
+2 -5
drivers/staging/rtl8723au/core/rtw_xmit.c
··· 785 785 786 786 for (curfragnum = 0; curfragnum < pattrib->nr_frags; 787 787 curfragnum++) { 788 - payload = (u8 *)RND4((unsigned long)payload); 788 + payload = PTR_ALIGN(payload, 4); 789 789 RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, 790 790 ("=== curfragnum =%d, pframe = 0x%.2x, " 791 791 "0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, 0x" ··· 1124 1124 struct xmit_priv *pxmitpriv = &padapter->xmitpriv; 1125 1125 struct pkt_attrib *pattrib = &pxmitframe->attrib; 1126 1126 s32 frg_inx, frg_len, mpdu_len, llc_sz, mem_sz; 1127 - unsigned long addr; 1128 1127 u8 *pframe, *mem_start; 1129 1128 u8 hw_hdr_offset; 1130 1129 u8 *pbuf_start; ··· 1260 1261 RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("%s: There're still something in packet!\n", __func__)); 1261 1262 } 1262 1263 1263 - addr = (unsigned long)pframe; 1264 - 1265 - mem_start = (unsigned char *)RND4(addr) + hw_hdr_offset; 1264 + mem_start = PTR_ALIGN(pframe, 4) + hw_hdr_offset; 1266 1265 memcpy(mem_start, pbuf_start + hw_hdr_offset, pattrib->hdrlen); 1267 1266 1268 1267 }
+2
drivers/staging/rtl8723au/hal/hal_intf.c
··· 259 259 pmlmepriv = &padapter->mlmepriv; 260 260 261 261 if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { 262 + #ifdef CONFIG_8723AU_AP_MODE 262 263 add_RATid23a(padapter, psta, rssi_level); 264 + #endif 263 265 } else { 264 266 if (padapter->HalFunc.UpdateRAMaskHandler) 265 267 padapter->HalFunc.UpdateRAMaskHandler(padapter, psta->mac_id, rssi_level);
+5 -5
drivers/staging/rtl8723au/hal/rtl8723a_bt-coexist.c
··· 4620 4620 /*PMGNT_INFO pMgntInfo = &padapter->MgntInfo; */ 4621 4621 struct bt_30info *pBTInfo = GET_BT_INFO(padapter); 4622 4622 struct bt_mgnt *pBtMgnt = &pBTInfo->BtMgnt; 4623 + u8 i; 4624 + u16 logicHandle = 0; 4623 4625 4624 4626 RTPRINT(FIOCTL, IOCTL_STATE, ("[BT state], [Connected], ")); 4625 4627 switch (StateCmd) { 4626 - u8 i; 4627 - u16 logicHandle = 0; 4628 4628 case STATE_CMD_DISCONNECT_PHY_LINK: 4629 4629 RTPRINT(FIOCTL, IOCTL_STATE, ("STATE_CMD_DISCONNECT_PHY_LINK\n")); 4630 4630 ··· 7076 7076 static u8 btdm_HoldForBtInqPage(struct rtw_adapter *padapter) 7077 7077 { 7078 7078 struct hal_data_8723a *pHalData = GET_HAL_DATA(padapter); 7079 - u32 curTime = rtw_get_current_time(); 7079 + u32 curTime = jiffies; 7080 7080 7081 7081 if (pHalData->bt_coexist.halCoex8723.bC2hBtInquiryPage) { 7082 7082 /* bt inquiry or page is started. */ 7083 7083 if (pHalData->bt_coexist.halCoex8723.btInqPageStartTime == 0) { 7084 7084 pHalData->bt_coexist.halCoex8723.btInqPageStartTime = curTime; 7085 - RTPRINT(FBT, BT_TRACE, ("[BTCoex], BT Inquiry/page is started at time : 0x%"i64fmt"x \n", 7085 + RTPRINT(FBT, BT_TRACE, ("[BTCoex], BT Inquiry/page is started at time : 0x%lx \n", 7086 7086 pHalData->bt_coexist.halCoex8723.btInqPageStartTime)); 7087 7087 } 7088 7088 } 7089 - RTPRINT(FBT, BT_TRACE, ("[BTCoex], BT Inquiry/page started time : 0x%"i64fmt"x, curTime : 0x%x \n", 7089 + RTPRINT(FBT, BT_TRACE, ("[BTCoex], BT Inquiry/page started time : 0x%lx, curTime : 0x%x \n", 7090 7090 pHalData->bt_coexist.halCoex8723.btInqPageStartTime, curTime)); 7091 7091 7092 7092 if (pHalData->bt_coexist.halCoex8723.btInqPageStartTime) {
+1 -1
drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c
··· 388 388 rtStatus = _WriteFW(padapter, buf, fw_size); 389 389 390 390 if (rtStatus == _SUCCESS || 391 - (rtw_get_passing_time_ms23a(fwdl_start_time) > 500 && 391 + (jiffies_to_msecs(jiffies - fwdl_start_time) > 500 && 392 392 writeFW_retry++ >= 3)) 393 393 break; 394 394
+1 -1
drivers/staging/rtl8723au/hal/rtl8723au_xmit.c
··· 366 366 367 367 mem_addr += w_sz; 368 368 369 - mem_addr = (u8 *)RND4(((unsigned long)(mem_addr))); 369 + mem_addr = PTR_ALIGN(mem_addr, 4); 370 370 } 371 371 372 372 rtw_free_xmitframe23a(pxmitpriv, pxmitframe);
-2
drivers/staging/rtl8723au/include/Hal8723APhyCfg.h
··· 65 65 RF_PATH_MAX /* Max RF number 90 support */ 66 66 }; 67 67 68 - #define RF_PATH_MAX 3 69 - 70 68 #define CHANNEL_MAX_NUMBER 14 /* 14 is the max channel number */ 71 69 #define CHANNEL_GROUP_MAX 3 /* ch1~3, ch4~9, ch10~14 total three groups */ 72 70
-4
drivers/staging/rtl8723au/include/drv_types.h
··· 258 258 struct hostapd_priv *phostapdpriv; 259 259 #endif 260 260 261 - #ifdef CONFIG_8723AU_P2P 262 261 struct cfg80211_wifidirect_info cfg80211_wdinfo; 263 - #endif /* CONFIG_8723AU_P2P */ 264 262 u32 setband; 265 - #ifdef CONFIG_8723AU_P2P 266 263 struct wifidirect_info wdinfo; 267 - #endif /* CONFIG_8723AU_P2P */ 268 264 269 265 #ifdef CONFIG_8723AU_P2P 270 266 struct wifi_display_info wfd_info;
+6 -11
drivers/staging/rtl8723au/include/odm.h
··· 265 265 #define DM_Type_ByFW 0 266 266 #define DM_Type_ByDriver 1 267 267 268 - /* */ 269 268 /* Declare for common info */ 270 - /* */ 271 - /* Declare for common info */ 272 - /* */ 273 - #define MAX_PATH_NUM_92CS 2 274 269 275 270 struct odm_phy_info { 276 271 u8 RxPWDBAll; 277 272 u8 SignalQuality; /* in 0-100 index. */ 278 - u8 RxMIMOSignalQuality[MAX_PATH_NUM_92CS]; /* EVM */ 279 - u8 RxMIMOSignalStrength[MAX_PATH_NUM_92CS];/* in 0~100 index */ 273 + u8 RxMIMOSignalQuality[RF_PATH_MAX]; /* EVM */ 274 + u8 RxMIMOSignalStrength[RF_PATH_MAX];/* in 0~100 index */ 280 275 s8 RxPower; /* in dBm Translate from PWdB */ 281 276 s8 RecvSignalPower;/* Real power in dBm for this packet, no beautification and aggregation. Keep this raw info to be used for the other procedures. */ 282 277 u8 BTRxRSSIPercentage; 283 278 u8 SignalStrength; /* in 0-100 index. */ 284 - u8 RxPwr[MAX_PATH_NUM_92CS];/* per-path's pwdb */ 285 - u8 RxSNR[MAX_PATH_NUM_92CS];/* per-path's SNR */ 279 + u8 RxPwr[RF_PATH_MAX];/* per-path's pwdb */ 280 + u8 RxSNR[RF_PATH_MAX];/* per-path's SNR */ 286 281 }; 287 282 288 283 289 284 struct odm_phy_dbg_info { 290 285 /* ODM Write,debug info */ 291 - s8 RxSNRdB[MAX_PATH_NUM_92CS]; 286 + s8 RxSNRdB[RF_PATH_MAX]; 292 287 u64 NumQryPhyStatus; 293 288 u64 NumQryPhyStatusCCK; 294 289 u64 NumQryPhyStatusOFDM; 295 290 /* Others */ 296 - s32 RxEVM[MAX_PATH_NUM_92CS]; 291 + s32 RxEVM[RF_PATH_MAX]; 297 292 298 293 }; 299 294
+8 -8
drivers/staging/rtl8723au/include/odm_HWConfig.h
··· 74 74 }; 75 75 76 76 struct phy_status_rpt { 77 - struct phy_rx_agc_info path_agc[2]; 78 - u8 ch_corr[2]; 77 + struct phy_rx_agc_info path_agc[RF_PATH_MAX]; 78 + u8 ch_corr[RF_PATH_MAX]; 79 79 u8 cck_sig_qual_ofdm_pwdb_all; 80 80 u8 cck_agc_rpt_ofdm_cfosho_a; 81 81 u8 cck_rpt_b_ofdm_cfosho_b; 82 82 u8 rsvd_1;/* ch_corr_msb; */ 83 83 u8 noise_power_db_msb; 84 - u8 path_cfotail[2]; 85 - u8 pcts_mask[2]; 86 - s8 stream_rxevm[2]; 87 - u8 path_rxsnr[2]; 84 + u8 path_cfotail[RF_PATH_MAX]; 85 + u8 pcts_mask[RF_PATH_MAX]; 86 + s8 stream_rxevm[RF_PATH_MAX]; 87 + u8 path_rxsnr[RF_PATH_MAX]; 88 88 u8 noise_power_db_lsb; 89 89 u8 rsvd_2[3]; 90 - u8 stream_csi[2]; 91 - u8 stream_target_csi[2]; 90 + u8 stream_csi[RF_PATH_MAX]; 91 + u8 stream_target_csi[RF_PATH_MAX]; 92 92 s8 sig_evm; 93 93 u8 rsvd_3; 94 94
-133
drivers/staging/rtl8723au/include/osdep_service.h
··· 149 149 void _rtw_init_queue23a(struct rtw_queue *pqueue); 150 150 u32 _rtw_queue_empty23a(struct rtw_queue *pqueue); 151 151 152 - u32 rtw_get_current_time(void); 153 - u32 rtw_systime_to_ms23a(u32 systime); 154 - u32 rtw_ms_to_systime23a(u32 ms); 155 - s32 rtw_get_passing_time_ms23a(u32 start); 156 - s32 rtw_get_time_interval_ms23a(u32 start, u32 end); 157 - 158 - #define _RND(sz, r) ((((sz)+((r)-1))/(r))*(r)) 159 - #define RND4(x) (((x >> 2) + (((x & 3) == 0) ? 0: 1)) << 2) 160 - 161 - static inline u32 _RND4(u32 sz) 162 - { 163 - 164 - u32 val; 165 - 166 - val = ((sz >> 2) + ((sz & 3) ? 1: 0)) << 2; 167 - 168 - return val; 169 - 170 - } 171 - 172 - static inline u32 _RND8(u32 sz) 173 - { 174 - 175 - u32 val; 176 - 177 - val = ((sz >> 3) + ((sz & 7) ? 1: 0)) << 3; 178 - 179 - return val; 180 - 181 - } 182 - 183 - static inline u32 _RND128(u32 sz) 184 - { 185 - 186 - u32 val; 187 - 188 - val = ((sz >> 7) + ((sz & 127) ? 1: 0)) << 7; 189 - 190 - return val; 191 - 192 - } 193 - 194 - static inline u32 _RND256(u32 sz) 195 - { 196 - 197 - u32 val; 198 - 199 - val = ((sz >> 8) + ((sz & 255) ? 1: 0)) << 8; 200 - 201 - return val; 202 - 203 - } 204 - 205 - static inline u32 _RND512(u32 sz) 206 - { 207 - 208 - u32 val; 209 - 210 - val = ((sz >> 9) + ((sz & 511) ? 1: 0)) << 9; 211 - 212 - return val; 213 - 214 - } 215 - 216 152 static inline u32 bitshift(u32 bitmask) 217 153 { 218 154 u32 i; ··· 159 223 return i; 160 224 } 161 225 162 - #define STRUCT_PACKED __attribute__ ((packed)) 163 - 164 - /* limitation of path length */ 165 - #define PATH_LENGTH_MAX PATH_MAX 166 - 167 226 void rtw_suspend_lock_init(void); 168 227 void rtw_suspend_lock_uninit(void); 169 228 void rtw_lock_suspend(void); 170 229 void rtw_unlock_suspend(void); 171 230 172 - /* File operation APIs, just for linux now */ 173 - int rtw_is_file_readable(char *path); 174 - int rtw_retrive_from_file(char *path, u8* buf, u32 sz); 175 - int rtw_store_to_file(char *path, u8* buf, u32 sz); 176 231 177 232 #define NDEV_FMT "%s" 178 233 #define NDEV_ARG(ndev) ndev->name ··· 182 255 183 256 /* Macros for handling unaligned memory accesses */ 184 257 185 - #define RTW_GET_BE16(a) ((u16) (((a)[0] << 8) | (a)[1])) 186 - #define RTW_PUT_BE16(a, val) \ 187 - do { \ 188 - (a)[0] = ((u16) (val)) >> 8; \ 189 - (a)[1] = ((u16) (val)) & 0xff; \ 190 - } while (0) 191 - 192 - #define RTW_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0])) 193 - #define RTW_PUT_LE16(a, val) \ 194 - do { \ 195 - (a)[1] = ((u16) (val)) >> 8; \ 196 - (a)[0] = ((u16) (val)) & 0xff; \ 197 - } while (0) 198 - 199 258 #define RTW_GET_BE24(a) ((((u32) (a)[0]) << 16) | (((u32) (a)[1]) << 8) | \ 200 259 ((u32) (a)[2])) 201 - #define RTW_PUT_BE24(a, val) \ 202 - do { \ 203 - (a)[0] = (u8) ((((u32) (val)) >> 16) & 0xff); \ 204 - (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \ 205 - (a)[2] = (u8) (((u32) (val)) & 0xff); \ 206 - } while (0) 207 260 208 - #define RTW_GET_BE32(a) ((((u32) (a)[0]) << 24) | (((u32) (a)[1]) << 16) | \ 209 - (((u32) (a)[2]) << 8) | ((u32) (a)[3])) 210 - #define RTW_PUT_BE32(a, val) \ 211 - do { \ 212 - (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \ 213 - (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \ 214 - (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \ 215 - (a)[3] = (u8) (((u32) (val)) & 0xff); \ 216 - } while (0) 217 - 218 - #define RTW_GET_LE32(a) ((((u32) (a)[3]) << 24) | (((u32) (a)[2]) << 16) | \ 219 - (((u32) (a)[1]) << 8) | ((u32) (a)[0])) 220 - #define RTW_PUT_LE32(a, val) \ 221 - do { \ 222 - (a)[3] = (u8) ((((u32) (val)) >> 24) & 0xff); \ 223 - (a)[2] = (u8) ((((u32) (val)) >> 16) & 0xff); \ 224 - (a)[1] = (u8) ((((u32) (val)) >> 8) & 0xff); \ 225 - (a)[0] = (u8) (((u32) (val)) & 0xff); \ 226 - } while (0) 227 - 228 - #define RTW_GET_BE64(a) ((((u64) (a)[0]) << 56) | (((u64) (a)[1]) << 48) | \ 229 - (((u64) (a)[2]) << 40) | (((u64) (a)[3]) << 32) | \ 230 - (((u64) (a)[4]) << 24) | (((u64) (a)[5]) << 16) | \ 231 - (((u64) (a)[6]) << 8) | ((u64) (a)[7])) 232 - #define RTW_PUT_BE64(a, val) \ 233 - do { \ 234 - (a)[0] = (u8) (((u64) (val)) >> 56); \ 235 - (a)[1] = (u8) (((u64) (val)) >> 48); \ 236 - (a)[2] = (u8) (((u64) (val)) >> 40); \ 237 - (a)[3] = (u8) (((u64) (val)) >> 32); \ 238 - (a)[4] = (u8) (((u64) (val)) >> 24); \ 239 - (a)[5] = (u8) (((u64) (val)) >> 16); \ 240 - (a)[6] = (u8) (((u64) (val)) >> 8); \ 241 - (a)[7] = (u8) (((u64) (val)) & 0xff); \ 242 - } while (0) 243 - 244 - #define RTW_GET_LE64(a) ((((u64) (a)[7]) << 56) | (((u64) (a)[6]) << 48) | \ 245 - (((u64) (a)[5]) << 40) | (((u64) (a)[4]) << 32) | \ 246 - (((u64) (a)[3]) << 24) | (((u64) (a)[2]) << 16) | \ 247 - (((u64) (a)[1]) << 8) | ((u64) (a)[0])) 248 261 249 262 struct rtw_cbuf { 250 263 u32 write;
+2 -2
drivers/staging/rtl8723au/include/rtl8723a_bt-coexist.h
··· 1074 1074 struct packet_irp_hcievent_data { 1075 1075 u8 EventCode; 1076 1076 u8 Length; 1077 - u8 Data[5]; 1077 + u8 Data[20]; 1078 1078 }; 1079 1079 1080 1080 struct common_triple { ··· 1332 1332 u8 c2hBtInfoOriginal; 1333 1333 u8 prec2hBtInfo; /* for 1Ant */ 1334 1334 u8 bC2hBtInquiryPage; 1335 - u64 btInqPageStartTime; /* for 2Ant */ 1335 + unsigned long btInqPageStartTime; /* for 2Ant */ 1336 1336 u8 c2hBtProfile; /* for 1Ant */ 1337 1337 u8 btRetryCnt; 1338 1338 u8 btInfoExt;
+7 -16
drivers/staging/rtl8723au/include/rtl8723a_pg.h
··· 15 15 #ifndef __RTL8723A_PG_H__ 16 16 #define __RTL8723A_PG_H__ 17 17 18 - /* */ 19 18 /* EEPROM/Efuse PG Offset for 8723E/8723U/8723S */ 20 - /* */ 21 19 #define EEPROM_CCK_TX_PWR_INX_8723A 0x10 22 20 #define EEPROM_HT40_1S_TX_PWR_INX_8723A 0x16 23 21 #define EEPROM_HT20_TX_PWR_INX_DIFF_8723A 0x1C ··· 51 53 /* RTL8723AS */ 52 54 #define EEPROM_MAC_ADDR_8723AS 0xAA 53 55 54 - /* */ 55 56 /* EEPROM/Efuse Value Type */ 56 - /* */ 57 57 #define EETYPE_TX_PWR 0x0 58 58 59 - /* */ 60 59 /* EEPROM/Efuse Default Value */ 61 - /* */ 62 60 #define EEPROM_Default_CrystalCap_8723A 0x20 63 61 64 62 65 - /* */ 66 63 /* EEPROM/EFUSE data structure definition. */ 67 - /* */ 68 - #define MAX_RF_PATH_NUM 2 69 64 #define MAX_CHNL_GROUP 3+9 70 65 71 66 struct txpowerinfo { 72 - u8 CCKIndex[MAX_RF_PATH_NUM][MAX_CHNL_GROUP]; 73 - u8 HT40_1SIndex[MAX_RF_PATH_NUM][MAX_CHNL_GROUP]; 74 - u8 HT40_2SIndexDiff[MAX_RF_PATH_NUM][MAX_CHNL_GROUP]; 75 - u8 HT20IndexDiff[MAX_RF_PATH_NUM][MAX_CHNL_GROUP]; 76 - u8 OFDMIndexDiff[MAX_RF_PATH_NUM][MAX_CHNL_GROUP]; 77 - u8 HT40MaxOffset[MAX_RF_PATH_NUM][MAX_CHNL_GROUP]; 78 - u8 HT20MaxOffset[MAX_RF_PATH_NUM][MAX_CHNL_GROUP]; 67 + u8 CCKIndex[RF_PATH_MAX][MAX_CHNL_GROUP]; 68 + u8 HT40_1SIndex[RF_PATH_MAX][MAX_CHNL_GROUP]; 69 + u8 HT40_2SIndexDiff[RF_PATH_MAX][MAX_CHNL_GROUP]; 70 + u8 HT20IndexDiff[RF_PATH_MAX][MAX_CHNL_GROUP]; 71 + u8 OFDMIndexDiff[RF_PATH_MAX][MAX_CHNL_GROUP]; 72 + u8 HT40MaxOffset[RF_PATH_MAX][MAX_CHNL_GROUP]; 73 + u8 HT20MaxOffset[RF_PATH_MAX][MAX_CHNL_GROUP]; 79 74 u8 TSSI_A[3]; 80 75 u8 TSSI_B[3]; 81 76 u8 TSSI_A_5G[3]; /* 5GL/5GM/5GH */
+22 -30
drivers/staging/rtl8723au/include/rtw_mlme.h
··· 379 379 380 380 u8 *wps_probe_req_ie; 381 381 u32 wps_probe_req_ie_len; 382 + u8 *assoc_req; 383 + u32 assoc_req_len; 384 + u32 assoc_rsp_len; 385 + u8 *assoc_rsp; 386 + u32 wps_assoc_resp_ie_len; 387 + u8 *wps_assoc_resp_ie; 388 + u8 *wps_probe_resp_ie; 389 + u32 wps_probe_resp_ie_len; 390 + u8 *wps_beacon_ie; 391 + u32 wps_beacon_ie_len; 392 + u32 p2p_go_probe_resp_ie_len; /* for GO */ 393 + u32 p2p_assoc_req_ie_len; 394 + u8 *p2p_beacon_ie; 395 + u8 *p2p_probe_req_ie; 396 + u8 *p2p_probe_resp_ie; 397 + u8 *p2p_go_probe_resp_ie; /* for GO */ 398 + u8 *p2p_assoc_req_ie; 399 + u32 p2p_beacon_ie_len; 400 + u32 p2p_probe_req_ie_len; 401 + u32 p2p_probe_resp_ie_len; 402 + u8 *wfd_assoc_req_ie; 403 + u32 wfd_assoc_req_ie_len; 382 404 383 405 #ifdef CONFIG_8723AU_AP_MODE 384 406 /* Number of associated Non-ERP stations (i.e., stations using 802.11b ··· 429 407 430 408 u16 ht_op_mode; 431 409 432 - u8 *assoc_req; 433 - u32 assoc_req_len; 434 - u8 *assoc_rsp; 435 - u32 assoc_rsp_len; 436 - 437 - u8 *wps_beacon_ie; 438 - /* u8 *wps_probe_req_ie; */ 439 - u8 *wps_probe_resp_ie; 440 - u8 *wps_assoc_resp_ie; 441 - 442 - u32 wps_beacon_ie_len; 443 - /* u32 wps_probe_req_ie_len; */ 444 - u32 wps_probe_resp_ie_len; 445 - u32 wps_assoc_resp_ie_len; 446 - 447 - u8 *p2p_beacon_ie; 448 - u8 *p2p_probe_req_ie; 449 - u8 *p2p_probe_resp_ie; 450 - u8 *p2p_go_probe_resp_ie; /* for GO */ 451 - u8 *p2p_assoc_req_ie; 452 - 453 - u32 p2p_beacon_ie_len; 454 - u32 p2p_probe_req_ie_len; 455 - u32 p2p_probe_resp_ie_len; 456 - u32 p2p_go_probe_resp_ie_len; /* for GO */ 457 - u32 p2p_assoc_req_ie_len; 458 410 spinlock_t bcn_update_lock; 459 411 u8 update_bcn; 460 412 461 413 #endif /* ifdef CONFIG_8723AU_AP_MODE */ 462 414 463 - #if defined(CONFIG_8723AU_P2P) 464 415 u8 *wfd_beacon_ie; 465 416 u8 *wfd_probe_req_ie; 466 417 u8 *wfd_probe_resp_ie; 467 418 u8 *wfd_go_probe_resp_ie; /* for GO */ 468 - u8 *wfd_assoc_req_ie; 469 419 470 420 u32 wfd_beacon_ie_len; 471 421 u32 wfd_probe_req_ie_len; 472 422 u32 wfd_probe_resp_ie_len; 473 423 u32 wfd_go_probe_resp_ie_len; /* for GO */ 474 - u32 wfd_assoc_req_ie_len; 475 - #endif 476 424 }; 477 425 478 426 #ifdef CONFIG_8723AU_AP_MODE
-2
drivers/staging/rtl8723au/include/rtw_mlme_ext.h
··· 451 451 452 452 u64 TSFValue; 453 453 454 - #ifdef CONFIG_8723AU_AP_MODE 455 454 unsigned char bstart_bss; 456 - #endif 457 455 u8 update_channel_plan_by_ap_done; 458 456 /* recv_decache check for Action_public frame */ 459 457 u8 action_public_dialog_token;
+1 -1
drivers/staging/rtl8723au/include/rtw_pwrctrl.h
··· 180 180 u8 ips_mode; 181 181 u8 ips_mode_req; /* used to accept the mode setting request */ 182 182 uint bips_processing; 183 - u32 ips_deny_time; /* will deny IPS when system time is smaller */ 183 + unsigned long ips_deny_time; /* deny IPS when system time is smaller */ 184 184 u8 ps_processing; /* used to mark whether in rtw_ps_processor23a */ 185 185 186 186 u8 bLeisurePs;
+5 -6
drivers/staging/rtl8723au/include/rtw_recv.h
··· 17 17 18 18 #include <osdep_service.h> 19 19 #include <drv_types.h> 20 + #include <Hal8723APhyCfg.h> 20 21 21 22 #define NR_RECVFRAME 256 22 23 ··· 76 75 u32 total_val; /* sum of valid elements */ 77 76 }; 78 77 79 - #define MAX_PATH_NUM_92CS 2 80 - 81 78 struct phy_info { 82 79 u8 RxPWDBAll; 83 80 u8 SignalQuality; /* in 0-100 index. */ 84 - u8 RxMIMOSignalQuality[MAX_PATH_NUM_92CS]; /* EVM */ 85 - u8 RxMIMOSignalStrength[MAX_PATH_NUM_92CS];/* 0~100 */ 81 + u8 RxMIMOSignalQuality[RF_PATH_MAX]; /* EVM */ 82 + u8 RxMIMOSignalStrength[RF_PATH_MAX];/* 0~100 */ 86 83 s8 RxPower; /* in dBm Translate from PWdB */ 87 84 /* Real power in dBm for this packet, no beautification and aggregation. 88 85 * Keep this raw info to be used for the other procedures. ··· 88 89 s8 RecvSignalPower; 89 90 u8 BTRxRSSIPercentage; 90 91 u8 SignalStrength; /* in 0-100 index. */ 91 - u8 RxPwr[MAX_PATH_NUM_92CS];/* per-path's pwdb */ 92 - u8 RxSNR[MAX_PATH_NUM_92CS];/* per-path's SNR */ 92 + u8 RxPwr[RF_PATH_MAX];/* per-path's pwdb */ 93 + u8 RxSNR[RF_PATH_MAX];/* per-path's SNR */ 93 94 }; 94 95 95 96
+2 -13
drivers/staging/rtl8723au/include/sta_info.h
··· 140 140 /* curr_network(mlme_priv/security_priv/qos/ht) : AP CAP/INFO */ 141 141 /* sta_info: (AP & STA) CAP/INFO */ 142 142 143 - #ifdef CONFIG_8723AU_AP_MODE 144 - 145 143 struct list_head asoc_list; 146 144 struct list_head auth_list; 147 145 ··· 181 183 u8 has_legacy_ac; 182 184 unsigned int sleepq_ac_len; 183 185 184 - #ifdef CONFIG_8723AU_P2P 185 186 /* p2p priv data */ 186 187 u8 is_p2p_device; 187 188 u8 p2p_status_code; 189 + 190 + u8 keep_alive_trycnt; 188 191 189 192 /* p2p client info */ 190 193 u8 dev_addr[ETH_ALEN]; ··· 196 197 u8 secdev_types_list[32];/* 32/8 == 4; */ 197 198 u16 dev_name_len; 198 199 u8 dev_name[32]; 199 - #endif /* CONFIG_8723AU_P2P */ 200 - 201 - u8 keep_alive_trycnt; 202 - 203 - #endif /* CONFIG_8723AU_AP_MODE */ 204 - 205 200 u8 *passoc_req; 206 201 u32 assoc_req_len; 207 202 ··· 322 329 struct rtw_queue wakeup_q; 323 330 324 331 struct rtw_adapter *padapter; 325 - 326 - 327 - #ifdef CONFIG_8723AU_AP_MODE 328 332 struct list_head asoc_list; 329 333 struct list_head auth_list; 330 334 spinlock_t asoc_list_lock; ··· 347 357 u16 max_num_sta; 348 358 349 359 struct wlan_acl_pool acl_list; 350 - #endif 351 360 }; 352 361 353 362 static inline u32 wifi_mac_hash(u8 *mac)
+43 -12
drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c
··· 1495 1495 int ret = 0; 1496 1496 uint wps_ielen = 0; 1497 1497 u8 *wps_ie; 1498 + #ifdef CONFIG_8723AU_P2P 1498 1499 u32 p2p_ielen = 0; 1499 1500 u8 *p2p_ie; 1500 1501 u32 wfd_ielen = 0; 1502 + #endif 1501 1503 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1502 1504 1503 1505 #ifdef CONFIG_DEBUG_CFG80211 ··· 1597 1595 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 1598 1596 struct cfg80211_ssid ssid[RTW_SSID_SCAN_AMOUNT]; 1599 1597 struct rtw_ieee80211_channel ch[RTW_CHANNEL_SCAN_AMOUNT]; 1600 - #ifdef CONFIG_8723AU_P2P 1601 - struct wifidirect_info *pwdinfo = &padapter->wdinfo; 1602 - #endif /* CONFIG_8723AU_P2P */ 1603 1598 struct rtw_wdev_priv *pwdev_priv = wdev_to_priv(padapter->rtw_wdev); 1604 1599 struct cfg80211_ssid *ssids = request->ssids; 1600 + #ifdef CONFIG_8723AU_P2P 1601 + struct wifidirect_info *pwdinfo = &padapter->wdinfo; 1605 1602 int social_channel = 0; 1603 + #endif /* CONFIG_8723AU_P2P */ 1606 1604 bool need_indicate_scan_done = false; 1607 1605 1608 1606 #ifdef CONFIG_DEBUG_CFG80211 ··· 1627 1625 goto check_need_indicate_scan_done; 1628 1626 } 1629 1627 #ifdef CONFIG_8723AU_P2P 1630 - if (ssids->ssid != NULL && 1631 - !memcmp(ssids->ssid, "DIRECT-", 7) && 1628 + if (!memcmp(ssids->ssid, "DIRECT-", 7) && 1632 1629 rtw_get_p2p_ie23a((u8 *) request->ie, request->ie_len, NULL, NULL)) { 1633 1630 if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { 1634 1631 rtw_p2p_enable23a(padapter, P2P_ROLE_DEVICE); ··· 2739 2738 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; 2740 2739 u32 len = skb->len; 2741 2740 u8 category, action; 2741 + #ifdef CONFIG_8723AU_P2P 2742 2742 int type = -1; 2743 + #endif 2743 2744 2744 2745 if (rtw_action_frame_parse23a(skb->data, len, &category, 2745 2746 &action) == false) { ··· 2763 2760 else 2764 2761 DBG_8723A("RTW_Tx:category(%u), action(%u)\n", category, 2765 2762 action); 2763 + #ifdef CONFIG_8723AU_P2P 2766 2764 dump: 2765 + #endif 2767 2766 /* starting alloc mgmt frame to dump it */ 2768 2767 pmgntframe = alloc_mgtxmitframe23a(pxmitpriv); 2769 2768 if (pmgntframe == NULL) ··· 2976 2971 int ret = 0; 2977 2972 u8 *pbuf = NULL; 2978 2973 uint len, wps_ielen = 0; 2974 + #ifdef CONFIG_8723AU_P2P 2979 2975 uint p2p_ielen = 0; 2980 2976 u8 got_p2p_ie = false; 2977 + #endif 2981 2978 struct mlme_priv *pmlmepriv = &adapter->mlmepriv; 2982 2979 /* struct sta_priv *pstapriv = &padapter->stapriv; */ 2983 2980 ··· 3252 3245 void rtw_cfg80211_rx_action_p2p(struct rtw_adapter *padapter, u8 *pmgmt_frame, 3253 3246 uint frame_len) 3254 3247 { 3248 + #ifdef CONFIG_8723AU_P2P 3255 3249 int type; 3250 + #endif 3256 3251 s32 freq; 3257 3252 int channel; 3258 3253 u8 category, action; ··· 3270 3261 rtw_action_frame_parse23a(pmgmt_frame, frame_len, &category, &action); 3271 3262 DBG_8723A("RTW_Rx:category(%u), action(%u)\n", category, action); 3272 3263 3264 + #ifdef CONFIG_8723AU_P2P 3273 3265 indicate: 3266 + #endif 3274 3267 if (channel <= RTW_CH_MAX_2G_CHANNEL) 3275 3268 freq = ieee80211_channel_to_frequency(channel, 3276 3269 IEEE80211_BAND_2GHZ); ··· 3287 3276 void rtw_cfg80211_rx_p2p_action_public(struct rtw_adapter *padapter, 3288 3277 u8 *pmgmt_frame, uint frame_len) 3289 3278 { 3279 + #ifdef CONFIG_8723AU_P2P 3290 3280 int type; 3281 + #endif 3291 3282 s32 freq; 3292 3283 int channel; 3293 3284 u8 category, action; ··· 3311 3298 rtw_action_frame_parse23a(pmgmt_frame, frame_len, &category, &action); 3312 3299 DBG_8723A("RTW_Rx:category(%u), action(%u)\n", category, action); 3313 3300 3301 + #ifdef CONFIG_8723AU_P2P 3314 3302 indicate: 3303 + #endif 3315 3304 if (channel <= RTW_CH_MAX_2G_CHANNEL) 3316 3305 freq = ieee80211_channel_to_frequency(channel, 3317 3306 IEEE80211_BAND_2GHZ); ··· 3500 3485 p2p_ie[p2pielen++] = P2P_ATTR_CAPABILITY; 3501 3486 3502 3487 /* Length: */ 3503 - RTW_PUT_LE16(p2p_ie + p2pielen, 0x0002); 3488 + put_unaligned_le16(0x0002, p2p_ie + p2pielen); 3504 3489 p2pielen += 2; 3505 3490 3506 3491 /* Value: */ ··· 3514 3499 p2p_ie[p2pielen++] = P2P_ATTR_DEVICE_INFO; 3515 3500 3516 3501 /* Length: */ 3517 - RTW_PUT_LE16(p2p_ie + p2pielen, devinfo_contentlen); 3502 + put_unaligned_le16(devinfo_contentlen, p2p_ie + p2pielen); 3518 3503 p2pielen += 2; 3519 3504 3520 3505 /* Value: */ ··· 3595 3580 3596 3581 del_timer_sync(&padapter->cfg80211_wdinfo.remain_on_ch_timer); 3597 3582 3583 + #ifdef CONFIG_8723AU_P2P 3598 3584 p2p_protocol_wk_hdl23a(padapter, P2P_RO_CH_WK); 3585 + #endif 3599 3586 } 3600 3587 3601 3588 pcfg80211_wdinfo->is_ro_ch = true; ··· 3680 3663 if (pcfg80211_wdinfo->is_ro_ch == true) { 3681 3664 DBG_8723A("%s, cancel ro ch timer\n", __func__); 3682 3665 del_timer_sync(&padapter->cfg80211_wdinfo.remain_on_ch_timer); 3666 + #ifdef CONFIG_8723AU_P2P 3683 3667 p2p_protocol_wk_hdl23a(padapter, P2P_RO_CH_WK); 3668 + #endif 3684 3669 } 3685 3670 3686 3671 rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo)); ··· 3853 3834 DBG_8723A("RTW_Tx:category(%u), action(%u)\n", 3854 3835 category, action); 3855 3836 3837 + #ifdef CONFIG_8723AU_P2P 3856 3838 dump: 3839 + #endif 3857 3840 do { 3858 3841 dump_cnt++; 3859 3842 tx_ret = _cfg80211_rtw_mgmt_tx(padapter, tx_ch, buf, len); ··· 3911 3890 int ret = 0; 3912 3891 uint wps_ielen = 0; 3913 3892 u8 *wps_ie; 3893 + #ifdef CONFIG_8723AU_P2P 3914 3894 u32 p2p_ielen = 0; 3915 - u8 wps_oui[8] = { 0x0, 0x50, 0xf2, 0x04 }; 3916 - u8 *p2p_ie; 3917 3895 u32 wfd_ielen = 0; 3896 + u8 *p2p_ie; 3897 + #endif 3898 + #ifdef CONFIG_8723AU_AP_MODE 3899 + u8 wps_oui[8] = { 0x0, 0x50, 0xf2, 0x04 }; 3900 + #endif 3918 3901 struct rtw_adapter *padapter = netdev_priv(ndev); 3919 3902 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 3920 3903 struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; ··· 3948 3923 memcpy(pmlmepriv->wps_beacon_ie, wps_ie, wps_ielen); 3949 3924 pmlmepriv->wps_beacon_ie_len = wps_ielen; 3950 3925 3926 + #ifdef CONFIG_8723AU_AP_MODE 3951 3927 update_beacon23a(padapter, _VENDOR_SPECIFIC_IE_, wps_oui, 3952 3928 true); 3929 + #endif 3953 3930 } 3954 3931 #ifdef CONFIG_8723AU_P2P 3955 3932 p2p_ie = rtw_get_p2p_ie23a(buf, len, NULL, &p2p_ielen); ··· 4019 3992 { 4020 3993 struct rtw_adapter *padapter = netdev_priv(net); 4021 3994 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 4022 - int ret = 0; 4023 - uint wps_ielen = 0; 4024 - u8 *wps_ie; 3995 + #ifdef CONFIG_8723AU_P2P 4025 3996 u32 p2p_ielen = 0; 4026 3997 u8 *p2p_ie; 4027 3998 u32 wfd_ielen = 0; 3999 + #endif 4000 + int ret = 0; 4001 + uint wps_ielen = 0; 4002 + u8 *wps_ie; 4028 4003 4029 4004 if (len > 0) { 4030 4005 wps_ie = rtw_get_wps_ie23a(buf, len, NULL, &wps_ielen); ··· 4205 4176 { 4206 4177 int ret = 0; 4207 4178 uint wps_ielen = 0; 4179 + #ifdef CONFIG_8723AU_P2P 4208 4180 u32 p2p_ielen = 0; 4181 + #endif 4209 4182 4210 4183 #ifdef CONFIG_DEBUG_CFG80211 4211 4184 DBG_8723A("%s, ielen =%d\n", __func__, len);
-254
drivers/staging/rtl8723au/os_dep/osdep_service.c
··· 71 71 return false; 72 72 } 73 73 74 - u32 rtw_get_current_time(void) 75 - { 76 - return jiffies; 77 - } 78 - 79 - inline u32 rtw_systime_to_ms23a(u32 systime) 80 - { 81 - return systime * 1000 / HZ; 82 - } 83 - 84 - inline u32 rtw_ms_to_systime23a(u32 ms) 85 - { 86 - return ms * HZ / 1000; 87 - } 88 - 89 - /* the input parameter start use the same unit as returned 90 - * by rtw_get_current_time 91 - */ 92 - inline s32 rtw_get_passing_time_ms23a(u32 start) 93 - { 94 - return rtw_systime_to_ms23a(jiffies-start); 95 - } 96 - 97 - inline s32 rtw_get_time_interval_ms23a(u32 start, u32 end) 98 - { 99 - return rtw_systime_to_ms23a(end-start); 100 - } 101 - 102 - #define RTW_SUSPEND_LOCK_NAME "rtw_wifi" 103 - 104 - inline void rtw_suspend_lock_init(void) 105 - { 106 - } 107 - 108 - inline void rtw_suspend_lock_uninit(void) 109 - { 110 - } 111 - 112 - inline void rtw_lock_suspend(void) 113 - { 114 - } 115 - 116 - inline void rtw_unlock_suspend(void) 117 - { 118 - } 119 - 120 - /* Open a file with the specific @param path, @param flag, @param mode 121 - * @param fpp the pointer of struct file pointer to get struct 122 - * file pointer while file opening is success 123 - * @param path the path of the file to open 124 - * @param flag file operation flags, please refer to linux document 125 - * @param mode please refer to linux document 126 - * @return Linux specific error code 127 - */ 128 - static int openFile(struct file **fpp, char *path, int flag, int mode) 129 - { 130 - struct file *fp; 131 - 132 - fp = filp_open(path, flag, mode); 133 - if (IS_ERR(fp)) { 134 - *fpp = NULL; 135 - return PTR_ERR(fp); 136 - } else { 137 - *fpp = fp; 138 - return 0; 139 - } 140 - } 141 - 142 - /* Close the file with the specific @param fp 143 - * @param fp the pointer of struct file to close 144 - * @return always 0 145 - */ 146 - static int closeFile(struct file *fp) 147 - { 148 - filp_close(fp, NULL); 149 - return 0; 150 - } 151 - 152 - static int readFile(struct file *fp, char *buf, int len) 153 - { 154 - int rlen = 0, sum = 0; 155 - 156 - if (!fp->f_op || !fp->f_op->read) 157 - return -EPERM; 158 - 159 - while (sum < len) { 160 - rlen = fp->f_op->read(fp, buf+sum, len-sum, &fp->f_pos); 161 - if (rlen > 0) 162 - sum += rlen; 163 - else if (0 != rlen) 164 - return rlen; 165 - else 166 - break; 167 - } 168 - return sum; 169 - } 170 - 171 - static int writeFile(struct file *fp, char *buf, int len) 172 - { 173 - int wlen = 0, sum = 0; 174 - 175 - if (!fp->f_op || !fp->f_op->write) 176 - return -EPERM; 177 - 178 - while (sum < len) { 179 - wlen = fp->f_op->write(fp, buf+sum, len-sum, &fp->f_pos); 180 - if (wlen > 0) 181 - sum += wlen; 182 - else if (0 != wlen) 183 - return wlen; 184 - else 185 - break; 186 - } 187 - return sum; 188 - } 189 - 190 - /* Test if the specifi @param path is a file and readable 191 - * @param path the path of the file to test 192 - * @return Linux specific error code 193 - */ 194 - static int isFileReadable(char *path) 195 - { 196 - struct file *fp; 197 - int ret = 0; 198 - mm_segment_t oldfs; 199 - char buf; 200 - 201 - fp = filp_open(path, O_RDONLY, 0); 202 - if (IS_ERR(fp)) { 203 - ret = PTR_ERR(fp); 204 - } else { 205 - oldfs = get_fs(); 206 - set_fs(get_ds()); 207 - 208 - if (1 != readFile(fp, &buf, 1)) 209 - ret = PTR_ERR(fp); 210 - 211 - set_fs(oldfs); 212 - filp_close(fp, NULL); 213 - } 214 - return ret; 215 - } 216 - 217 - /* Open the file with @param path and retrive the file content into 218 - * memory starting from @param buf for @param sz at most 219 - * @param path the path of the file to open and read 220 - * @param buf the starting address of the buffer to store file content 221 - * @param sz how many bytes to read at most 222 - * @return the byte we've read, or Linux specific error code 223 - */ 224 - static int retriveFromFile(char *path, u8 *buf, u32 sz) 225 - { 226 - int ret = -1; 227 - mm_segment_t oldfs; 228 - struct file *fp; 229 - 230 - if (path && buf) { 231 - ret = openFile(&fp, path, O_RDONLY, 0); 232 - if (!ret) { 233 - DBG_8723A("%s openFile path:%s fp =%p\n", 234 - __func__, path, fp); 235 - 236 - oldfs = get_fs(); set_fs(get_ds()); 237 - ret = readFile(fp, buf, sz); 238 - set_fs(oldfs); 239 - closeFile(fp); 240 - 241 - DBG_8723A("%s readFile, ret:%d\n", __func__, ret); 242 - } else { 243 - DBG_8723A("%s openFile path:%s Fail, ret:%d\n", 244 - __func__, path, ret); 245 - } 246 - } else { 247 - DBG_8723A("%s NULL pointer\n", __func__); 248 - ret = -EINVAL; 249 - } 250 - return ret; 251 - } 252 - 253 - /* Open the file with @param path and wirte @param sz byte of data starting 254 - * from @param buf into the file 255 - * @param path the path of the file to open and write 256 - * @param buf the starting address of the data to write into file 257 - * @param sz how many bytes to write at most 258 - * @return the byte we've written, or Linux specific error code 259 - */ 260 - static int storeToFile(char *path, u8 *buf, u32 sz) 261 - { 262 - struct file *fp; 263 - int ret = 0; 264 - mm_segment_t oldfs; 265 - 266 - if (path && buf) { 267 - ret = openFile(&fp, path, O_CREAT|O_WRONLY, 0666); 268 - if (!ret) { 269 - DBG_8723A("%s openFile path:%s fp =%p\n", __func__, 270 - path, fp); 271 - 272 - oldfs = get_fs(); set_fs(get_ds()); 273 - ret = writeFile(fp, buf, sz); 274 - set_fs(oldfs); 275 - closeFile(fp); 276 - 277 - DBG_8723A("%s writeFile, ret:%d\n", __func__, ret); 278 - } else { 279 - DBG_8723A("%s openFile path:%s Fail, ret:%d\n", 280 - __func__, path, ret); 281 - } 282 - } else { 283 - DBG_8723A("%s NULL pointer\n", __func__); 284 - ret = -EINVAL; 285 - } 286 - return ret; 287 - } 288 - 289 - /* 290 - * Test if the specifi @param path is a file and readable 291 - * @param path the path of the file to test 292 - * @return true or false 293 - */ 294 - int rtw_is_file_readable(char *path) 295 - { 296 - if (isFileReadable(path) == 0) 297 - return true; 298 - else 299 - return false; 300 - } 301 - 302 - /* Open the file with @param path and retrive the file content into memoryi 303 - * starting from @param buf for @param sz at most 304 - * @param path the path of the file to open and read 305 - * @param buf the starting address of the buffer to store file content 306 - * @param sz how many bytes to read at most 307 - * @return the byte we've read 308 - */ 309 - int rtw_retrive_from_file(char *path, u8 *buf, u32 sz) 310 - { 311 - int ret = retriveFromFile(path, buf, sz); 312 - return ret >= 0 ? ret : 0; 313 - } 314 - 315 - /* Open the file with @param path and wirte @param sz byte of 316 - * data starting from @param buf into the file 317 - * @param path the path of the file to open and write 318 - * @param buf the starting address of the data to write into file 319 - * @param sz how many bytes to write at most 320 - * @return the byte we've written 321 - */ 322 - int rtw_store_to_file(char *path, u8 *buf, u32 sz) 323 - { 324 - int ret = storeToFile(path, buf, sz); 325 - return ret >= 0 ? ret : 0; 326 - } 327 - 328 74 u64 rtw_modular6423a(u64 x, u64 y) 329 75 { 330 76 return do_div(x, y);
+2 -5
drivers/staging/rtl8723au/os_dep/usb_intf.c
··· 664 664 665 665 /* set mac addr */ 666 666 rtw_macaddr_cfg23a(padapter->eeprompriv.mac_addr); 667 + #ifdef CONFIG_8723AU_P2P 667 668 rtw_init_wifidirect_addrs23a(padapter, padapter->eeprompriv.mac_addr, 668 669 padapter->eeprompriv.mac_addr); 670 + #endif 669 671 670 672 DBG_8723A("bDriverStopped:%d, bSurpriseRemoved:%d, bup:%d, hw_init_completed:%d\n", 671 673 padapter->bDriverStopped, padapter->bSurpriseRemoved, ··· 813 811 return; 814 812 } 815 813 816 - extern int console_suspend_enabled; 817 - 818 814 static int __init rtw_drv_entry(void) 819 815 { 820 816 RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_entry\n")); 821 - rtw_suspend_lock_init(); 822 817 return usb_register(usb_drv); 823 818 } 824 819 ··· 823 824 { 824 825 RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_halt\n")); 825 826 DBG_8723A("+rtw_drv_halt\n"); 826 - 827 - rtw_suspend_lock_uninit(); 828 827 829 828 usb_deregister(usb_drv); 830 829