staging: rtl8723bs: replace RTW_GET_LE16 with get_unaligned_le16
authorRoss Schmidt <ross.schm.dev@gmail.com>
Sun, 4 Oct 2020 01:17:41 +0000 (20:17 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Oct 2020 07:59:31 +0000 (09:59 +0200)
Replace RTW_GET_LE16 macro with get_unaligned_le16.

Signed-off-by: Ross Schmidt <ross.schm.dev@gmail.com>
Link: https://lore.kernel.org/r/20201004011743.10750-6-ross.schm.dev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_ap.c
drivers/staging/rtl8723bs/core/rtw_ieee80211.c
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
drivers/staging/rtl8723bs/include/osdep_service.h

index a76e813..4f270d5 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <drv_types.h>
 #include <rtw_debug.h>
+#include <asm/unaligned.h>
 
 extern unsigned char RTW_WPA_OUI[];
 extern unsigned char WMM_OUI[];
@@ -995,12 +996,12 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
        /* beacon interval */
        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 = RTW_GET_LE16(p);
+       pbss_network->Configuration.BeaconPeriod = get_unaligned_le16(p);
 
        /* capability */
        /* cap = *(unsigned short *)rtw_get_capability_from_ie(ie); */
        /* cap = le16_to_cpu(cap); */
-       cap = RTW_GET_LE16(ie);
+       cap = get_unaligned_le16(ie);
 
        /* SSID */
        p = rtw_get_ie(
index 977f0ed..3b7a3c2 100644 (file)
@@ -500,7 +500,7 @@ int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwis
        /* pairwise_cipher */
        if (left >= 2) {
                /* count = le16_to_cpu(*(u16*)pos); */
-               count = RTW_GET_LE16(pos);
+               count = get_unaligned_le16(pos);
                pos += 2;
                left -= 2;
 
@@ -570,7 +570,7 @@ int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi
        /* pairwise_cipher */
        if (left >= 2) {
          /* count = le16_to_cpu(*(u16*)pos); */
-               count = RTW_GET_LE16(pos);
+               count = get_unaligned_le16(pos);
                pos += 2;
                left -= 2;
 
index 6db6377..b912ad2 100644 (file)
@@ -11,6 +11,7 @@
 #include <rtw_wifi_regd.h>
 #include <hal_btcoex.h>
 #include <linux/kernel.h>
+#include <asm/unaligned.h>
 
 static struct mlme_handler mlme_sta_tbl[] = {
        {WIFI_ASSOCREQ,         "OnAssocReq",   &OnAssocReq},
@@ -1213,7 +1214,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
                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)); */
 
        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
                        break;
 
                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);
 
                        if (status == 0) {
@@ -1989,7 +1990,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra
                                        ~BIT((frame_body[3] >> 4) & 0xf);
 
                                /* 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)) {
                                tid = (frame_body[3] >> 4) & 0x0F;
 
index a26c8db..2f7e166 100644 (file)
@@ -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_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
-
 void rtw_buf_free(u8 **buf, u32 *buf_len);
 void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len);