diff --git a/core/mesh/rtw_mesh.c b/core/mesh/rtw_mesh.c index 7409aa0..79c7958 100644 --- a/core/mesh/rtw_mesh.c +++ b/core/mesh/rtw_mesh.c @@ -85,19 +85,19 @@ inline u8 *rtw_set_ie_mpm(u8 *buf, u32 *buf_len u8 data[24] = {0}; u8 *pos = data; - RTW_PUT_LE16(pos, proto_id); + *(u16 *) (pos) = cpu_to_le16(proto_id); pos += 2; - RTW_PUT_LE16(pos, llid); + *(u16 *) (pos) = cpu_to_le16(llid); pos += 2; if (plid) { - RTW_PUT_LE16(pos, *plid); + *(u16 *) (pos) = cpu_to_le16(*plid)); pos += 2; } if (reason) { - RTW_PUT_LE16(pos, *reason); + *(u16 *) (pos) = cpu_to_le16(*reason)); pos += 2; } diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index fa949b8..45150b6 100644 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -282,8 +282,8 @@ inline u8 *rtw_set_ie_mesh_ch_switch_parm(u8 *buf, u32 *buf_len, u8 ttl, ie_data[0] = ttl; ie_data[1] = flags; - RTW_PUT_LE16((u8 *)&ie_data[2], reason); - RTW_PUT_LE16((u8 *)&ie_data[4], 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); } @@ -2169,8 +2169,7 @@ u32 rtw_set_p2p_attr_content(u8 *pbuf, u8 attr_id, u16 attr_len, u8 *pdata_attr) *pbuf = attr_id; - /* *(u16*)(pbuf + 1) = cpu_to_le16(attr_len); */ - RTW_PUT_LE16(pbuf + 1, attr_len); + *(u16 *)(pbuf + 1) = cpu_to_le16(attr_len); if (pdata_attr) memcpy(pbuf + 3, pdata_attr, attr_len); diff --git a/core/rtw_iol.c b/core/rtw_iol.c index e287b36..37f5d50 100644 --- a/core/rtw_iol.c +++ b/core/rtw_iol.c @@ -118,7 +118,6 @@ int _rtw_IOL_append_WB_cmd(struct xmit_frame *xmit_frame, u16 addr, u8 value, u8 { struct ioreg_cfg cmd = {8, IOREG_CMD_WB_REG, 0x0, 0x0, 0x0}; - /* RTW_PUT_LE16((u8*)&cmd.address, addr); */ /* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */ cmd.address = cpu_to_le16(addr); cmd.data = cpu_to_le32(value); @@ -138,7 +137,6 @@ int _rtw_IOL_append_WW_cmd(struct xmit_frame *xmit_frame, u16 addr, u16 value, u { struct ioreg_cfg cmd = {8, IOREG_CMD_WW_REG, 0x0, 0x0, 0x0}; - /* RTW_PUT_LE16((u8*)&cmd.address, addr); */ /* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */ cmd.address = cpu_to_le16(addr); cmd.data = cpu_to_le32(value); @@ -158,7 +156,6 @@ int _rtw_IOL_append_WD_cmd(struct xmit_frame *xmit_frame, u16 addr, u32 value, u { struct ioreg_cfg cmd = {8, IOREG_CMD_WD_REG, 0x0, 0x0, 0x0}; - /* RTW_PUT_LE16((u8*)&cmd.address, addr); */ /* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */ cmd.address = cpu_to_le16(addr); cmd.data = cpu_to_le32(value); @@ -179,7 +176,6 @@ int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, { struct ioreg_cfg cmd = {8, IOREG_CMD_W_RF, 0x0, 0x0, 0x0}; - /* RTW_PUT_LE16((u8*)&cmd.address, addr); */ /* RTW_PUT_LE32((u8*)&cmd.value, (u32)value); */ cmd.address = (rf_path << 8) | ((addr) & 0xFF); cmd.data = cpu_to_le32(value); @@ -201,7 +197,6 @@ int _rtw_IOL_append_WRF_cmd(struct xmit_frame *xmit_frame, u8 rf_path, u16 addr, int rtw_IOL_append_DELAY_US_cmd(struct xmit_frame *xmit_frame, u16 us) { struct ioreg_cfg cmd = {4, IOREG_CMD_DELAY_US, 0x0, 0x0, 0x0}; - /* RTW_PUT_LE16((u8*)&cmd.address, us); */ cmd.address = cpu_to_le16(us); /* RTW_INFO("%s %u\n", __FUNCTION__, us); */ @@ -212,7 +207,6 @@ int rtw_IOL_append_DELAY_MS_cmd(struct xmit_frame *xmit_frame, u16 ms) { struct ioreg_cfg cmd = {4, IOREG_CMD_DELAY_US, 0x0, 0x0, 0x0}; - /* RTW_PUT_LE16((u8*)&cmd.address, ms); */ cmd.address = cpu_to_le16(ms); /* RTW_INFO("%s %u\n", __FUNCTION__, ms); */ diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index 48e10ba..34fcfef 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -4321,7 +4321,7 @@ int rtw_rsn_sync_pmkid(_adapter *adapter, u8 *ie, uint ie_len, int i_ent) } else info.pmkid_cnt = 0; /* update new pmkid_cnt */ - RTW_PUT_LE16(info.pmkid_list - 2, info.pmkid_cnt); + *(u16 *)(info.pmkid_list - 2) = cpu_to_le16(info.pmkid_cnt); if (info.gmcs) memcpy(info.pmkid_list + 16 * info.pmkid_cnt, gm_cs, 4); diff --git a/core/rtw_p2p.c b/core/rtw_p2p.c index fc0310d..d801867 100644 --- a/core/rtw_p2p.c +++ b/core/rtw_p2p.c @@ -1900,8 +1900,7 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) p2pie[p2pielen++] = P2P_ATTR_CAPABILITY; /* Length: */ - /* *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0x0002 ); */ - RTW_PUT_LE16(p2pie + p2pielen, 0x0002); + *(u16 *) (p2pie + p2pielen) = cpu_to_le16(0x0002); p2pielen += 2; /* Value: */ @@ -1929,19 +1928,16 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) p2pie[p2pielen++] = P2P_ATTR_EX_LISTEN_TIMING; /* Length: */ - /* *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0x0004 ); */ - RTW_PUT_LE16(p2pie + p2pielen, 0x0004); + *(u16 *) (p2pie + p2pielen) = cpu_to_le16(0x0004); p2pielen += 2; /* Value: */ /* Availability Period */ - /* *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0xFFFF ); */ - RTW_PUT_LE16(p2pie + p2pielen, 0xFFFF); + *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0xFFFF ); p2pielen += 2; /* Availability Interval */ - /* *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0xFFFF ); */ - RTW_PUT_LE16(p2pie + p2pielen, 0xFFFF); + *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0xFFFF ); p2pielen += 2; @@ -1963,12 +1959,12 @@ u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf) /* *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); */ #ifdef CONFIG_INTEL_WIDI if (widi_version == 35) - RTW_PUT_LE16(p2pie + p2pielen, 21 + 8 + pwdinfo->device_name_len); + *(u16 *) (p2pie + p2pielen) = cpu_to_le16(21 + 8 + pwdinfo->device_name_len); else if (widi_version == 40) - RTW_PUT_LE16(p2pie + p2pielen, 21 + 8 * pmlmepriv->num_p2p_sdt + pwdinfo->device_name_len); + *(u16 *) (p2pie + p2pielen) = cpu_to_le16(21 + 8 * pmlmepriv->num_p2p_sdt + pwdinfo->device_name_len); else #endif /* CONFIG_INTEL_WIDI */ - RTW_PUT_LE16(p2pie + p2pielen, 21 + pwdinfo->device_name_len); + *(u16 *) (p2pie + p2pielen) = cpu_to_le16(21 + pwdinfo->device_name_len); p2pielen += 2; /* Value: */ @@ -2101,8 +2097,7 @@ u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 p2pie[p2pielen++] = P2P_ATTR_CAPABILITY; /* Length: */ - /* *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0x0002 ); */ - RTW_PUT_LE16(p2pie + p2pielen, 0x0002); + *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0x0002 ); p2pielen += 2; /* Value: */ @@ -2123,8 +2118,7 @@ u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 /* Length: */ /* 21->P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) */ /* + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) */ - /* *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); */ - RTW_PUT_LE16(p2pie + p2pielen, 21 + pwdinfo->device_name_len); + *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); p2pielen += 2; /* Value: */ @@ -2187,8 +2181,7 @@ u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf, u8 p2pie[p2pielen++] = P2P_ATTR_GROUP_ID; /* Length: */ - /* *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( ETH_ALEN + ussidlen ); */ - RTW_PUT_LE16(p2pie + p2pielen, ETH_ALEN + ussidlen); + *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( ETH_ALEN + ussidlen ); p2pielen += 2; /* Value: */ diff --git a/hal/hal_mcc.c b/hal/hal_mcc.c index a1cf8fd..d8eafbd 100644 --- a/hal/hal_mcc.c +++ b/hal/hal_mcc.c @@ -98,7 +98,7 @@ static void rtw_hal_mcc_build_p2p_noa_attr(PADAPTER padapter, u8 *ie, u32 *ie_le p2p_noa_attr_len = p2p_noa_attr_len + 1; /* attrute length(2 bytes) length = noa_desc_num*13 + 2 */ - RTW_PUT_LE16(p2p_noa_attr_ie + p2p_noa_attr_len, (noa_desc_num * 13 + 2)); + *(u16 *) (p2p_noa_attr_ie + p2p_noa_attr_len) = cpu_to_le16(noa_desc_num * 13 + 2); p2p_noa_attr_len = p2p_noa_attr_len + 2; /* Index (1 byte) */ diff --git a/include/osdep_service.h b/include/osdep_service.h index 18d67a5..ae08c06 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -514,11 +514,6 @@ extern u32 rtw_random32(void); } while (0) #define RTW_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0])) -#define RTW_PUT_LE16(a, val) \ - do { \ - (a)[1] = ((u16) (val)) >> 8; \ - (a)[0] = ((u16) (val)) & 0xff; \ - } while (0) #define RTW_GET_BE24(a) ((((u32) (a)[0]) << 16) | (((u32) (a)[1]) << 8) | \ ((u32) (a)[2])) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 6bdb7a9..453c944 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -6411,8 +6411,7 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, p2p_ie[p2pielen++] = P2P_ATTR_CAPABILITY; /* Length: */ - /* *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 0x0002 ); */ - RTW_PUT_LE16(p2p_ie + p2pielen, 0x0002); + *(u16*) ( p2p_ie + p2pielen ) = cpu_to_le16( 0x0002 ); p2pielen += 2; /* Value: */ @@ -6429,8 +6428,7 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, /* Length: */ /* 21->P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) */ /* + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) */ - /* *(u16*) ( p2pie + p2pielen ) = cpu_to_le16( 21 + pwdinfo->device_name_len ); */ - RTW_PUT_LE16(p2p_ie + p2pielen, devinfo_contentlen); + *(u16*) (p2p_ie + p2pielen) = cpu_to_le16(devinfo_contentlen); p2pielen += 2; /* Value: */ @@ -8158,7 +8156,7 @@ u8 *rtw_cfg80211_construct_mesh_beacon_ies(struct wiphy *wiphy, _adapter *adapte c = ies + 8; /* beacon interval */ - RTW_PUT_LE16(c , setup->beacon_interval); + *((u16 *)c) = cpu_to_le16(setup->beacon_interval); c += 2; /* capability */ @@ -8208,7 +8206,7 @@ u8 *rtw_cfg80211_construct_mesh_beacon_ies(struct wiphy *wiphy, _adapter *adapte memset(ht_op, 0, HT_OP_IE_LEN); /* WLAN_EID_HT_CAPABILITY */ - RTW_PUT_LE16(HT_CAP_ELE_CAP_INFO(ht_cap), sta_ht_cap->cap); + *(u16 *) (HT_CAP_ELE_CAP_INFO(ht_cap)) = cpu_to_le16(sta_ht_cap->cap); SET_HT_CAP_ELE_MAX_AMPDU_LEN_EXP(ht_cap, sta_ht_cap->ampdu_factor); SET_HT_CAP_ELE_MIN_MPDU_S_SPACE(ht_cap, sta_ht_cap->ampdu_density); memcpy(HT_CAP_ELE_SUP_MCS_SET(ht_cap), &sta_ht_cap->mcs, 16);