Commit d48603af authored by Ross Schmidt's avatar Ross Schmidt Committed by Greg Kroah-Hartman

staging: rtl8723bs: replace RTW_GET_LE16 with get_unaligned_le16

Replace RTW_GET_LE16 macro with get_unaligned_le16.
Signed-off-by: default avatarRoss Schmidt <ross.schm.dev@gmail.com>
Link: https://lore.kernel.org/r/20201004011743.10750-6-ross.schm.dev@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 56c14938
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <drv_types.h> #include <drv_types.h>
#include <rtw_debug.h> #include <rtw_debug.h>
#include <asm/unaligned.h>
extern unsigned char RTW_WPA_OUI[]; extern unsigned char RTW_WPA_OUI[];
extern unsigned char WMM_OUI[]; extern unsigned char WMM_OUI[];
...@@ -995,12 +996,12 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) ...@@ -995,12 +996,12 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
/* beacon interval */ /* beacon interval */
p = rtw_get_beacon_interval_from_ie(ie);/* ie + 8; 8: TimeStamp, 2: Beacon Interval 2:Capability */ p = rtw_get_beacon_interval_from_ie(ie);/* ie + 8; 8: TimeStamp, 2: Beacon Interval 2:Capability */
/* pbss_network->Configuration.BeaconPeriod = le16_to_cpu(*(unsigned short*)p); */ /* pbss_network->Configuration.BeaconPeriod = le16_to_cpu(*(unsigned short*)p); */
pbss_network->Configuration.BeaconPeriod = RTW_GET_LE16(p); pbss_network->Configuration.BeaconPeriod = get_unaligned_le16(p);
/* capability */ /* capability */
/* cap = *(unsigned short *)rtw_get_capability_from_ie(ie); */ /* cap = *(unsigned short *)rtw_get_capability_from_ie(ie); */
/* cap = le16_to_cpu(cap); */ /* cap = le16_to_cpu(cap); */
cap = RTW_GET_LE16(ie); cap = get_unaligned_le16(ie);
/* SSID */ /* SSID */
p = rtw_get_ie( p = rtw_get_ie(
......
...@@ -500,7 +500,7 @@ int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis ...@@ -500,7 +500,7 @@ int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis
/* pairwise_cipher */ /* pairwise_cipher */
if (left >= 2) { if (left >= 2) {
/* count = le16_to_cpu(*(u16*)pos); */ /* count = le16_to_cpu(*(u16*)pos); */
count = RTW_GET_LE16(pos); count = get_unaligned_le16(pos);
pos += 2; pos += 2;
left -= 2; left -= 2;
...@@ -570,7 +570,7 @@ int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi ...@@ -570,7 +570,7 @@ int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi
/* pairwise_cipher */ /* pairwise_cipher */
if (left >= 2) { if (left >= 2) {
/* count = le16_to_cpu(*(u16*)pos); */ /* count = le16_to_cpu(*(u16*)pos); */
count = RTW_GET_LE16(pos); count = get_unaligned_le16(pos);
pos += 2; pos += 2;
left -= 2; left -= 2;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <rtw_wifi_regd.h> #include <rtw_wifi_regd.h>
#include <hal_btcoex.h> #include <hal_btcoex.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <asm/unaligned.h>
static struct mlme_handler mlme_sta_tbl[] = { static struct mlme_handler mlme_sta_tbl[] = {
{WIFI_ASSOCREQ, "OnAssocReq", &OnAssocReq}, {WIFI_ASSOCREQ, "OnAssocReq", &OnAssocReq},
...@@ -1213,7 +1214,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame) ...@@ -1213,7 +1214,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
goto asoc_class2_error; goto asoc_class2_error;
} }
capab_info = RTW_GET_LE16(pframe + WLAN_HDR_A3_LEN); capab_info = get_unaligned_le16(pframe + WLAN_HDR_A3_LEN);
/* capab_info = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN)); */ /* capab_info = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN)); */
left = pkt_len - (sizeof(struct ieee80211_hdr_3addr) + ie_offset); left = pkt_len - (sizeof(struct ieee80211_hdr_3addr) + ie_offset);
...@@ -1959,7 +1960,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra ...@@ -1959,7 +1960,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra
break; break;
case RTW_WLAN_ACTION_ADDBA_RESP: /* ADDBA response */ case RTW_WLAN_ACTION_ADDBA_RESP: /* ADDBA response */
status = RTW_GET_LE16(&frame_body[3]); status = get_unaligned_le16(&frame_body[3]);
tid = ((frame_body[5] >> 2) & 0x7); tid = ((frame_body[5] >> 2) & 0x7);
if (status == 0) { if (status == 0) {
...@@ -1989,7 +1990,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra ...@@ -1989,7 +1990,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra
~BIT((frame_body[3] >> 4) & 0xf); ~BIT((frame_body[3] >> 4) & 0xf);
/* reason_code = frame_body[4] | (frame_body[5] << 8); */ /* reason_code = frame_body[4] | (frame_body[5] << 8); */
reason_code = RTW_GET_LE16(&frame_body[4]); reason_code = get_unaligned_le16(&frame_body[4]);
} else if ((frame_body[3] & BIT(3)) == BIT(3)) { } else if ((frame_body[3] & BIT(3)) == BIT(3)) {
tid = (frame_body[3] >> 4) & 0x0F; tid = (frame_body[3] >> 4) & 0x0F;
......
...@@ -152,8 +152,6 @@ extern void rtw_free_netdev(struct net_device * netdev); ...@@ -152,8 +152,6 @@ extern void rtw_free_netdev(struct net_device * netdev);
#define RTW_GET_BE16(a) ((u16) (((a)[0] << 8) | (a)[1])) #define RTW_GET_BE16(a) ((u16) (((a)[0] << 8) | (a)[1]))
#define RTW_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
void rtw_buf_free(u8 **buf, u32 *buf_len); void rtw_buf_free(u8 **buf, u32 *buf_len);
void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len); void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment