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

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

index 3b7a3c2..c43cca4 100644 (file)
@@ -801,8 +801,8 @@ u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id, u8 *buf_att
 
        while (attr_ptr - wps_ie < wps_ielen) {
                /*  4 = 2(Attribute ID) + 2(Length) */
-               u16 attr_id = RTW_GET_BE16(attr_ptr);
-               u16 attr_data_len = RTW_GET_BE16(attr_ptr + 2);
+               u16 attr_id = get_unaligned_be16(attr_ptr);
+               u16 attr_data_len = get_unaligned_be16(attr_ptr + 2);
                u16 attr_len = attr_data_len + 4;
 
                /* DBG_871X("%s attr_ptr:%p, id:%u, length:%u\n", __func__, attr_ptr, attr_id, attr_data_len); */
index 7e1da0e..6979f8d 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/jiffies.h>
 #include <rtw_recv.h>
 #include <net/cfg80211.h>
+#include <asm/unaligned.h>
 
 static u8 SNAP_ETH_TYPE_IPX[2] = {0x81, 0x37};
 static u8 SNAP_ETH_TYPE_APPLETALK_AARP[2] = {0x80, 0xf3};
@@ -1906,7 +1907,7 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe)
        while (a_len > ETH_HLEN) {
 
                /* Offset 12 denote 2 mac address */
-               nSubframe_Length = RTW_GET_BE16(pdata + 12);
+               nSubframe_Length = get_unaligned_be16(pdata + 12);
 
                if (a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length)) {
                        DBG_871X("nRemain_Length is %d and nSubframe_Length is : %d\n", a_len, nSubframe_Length);
index 2f7e166..a94b723 100644 (file)
@@ -150,8 +150,6 @@ extern void rtw_free_netdev(struct net_device * netdev);
 
 /* Macros for handling unaligned memory accesses */
 
-#define RTW_GET_BE16(a) ((u16) (((a)[0] << 8) | (a)[1]))
-
 void rtw_buf_free(u8 **buf, u32 *buf_len);
 void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len);
 
index b2a1bbb..900ff3a 100644 (file)
@@ -10,6 +10,7 @@
 #include <rtw_debug.h>
 #include <linux/jiffies.h>
 #include <net/cfg80211.h>
+#include <asm/unaligned.h>
 
 void rtw_os_free_recvframe(union recv_frame *precvframe)
 {
@@ -69,7 +70,7 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8
        skb_reserve(sub_skb, 12);
        skb_put_data(sub_skb, (pdata + ETH_HLEN), nSubframe_Length);
 
-       eth_type = RTW_GET_BE16(&sub_skb->data[6]);
+       eth_type = get_unaligned_be16(&sub_skb->data[6]);
 
        if (sub_skb->len >= 8 &&
                ((!memcmp(sub_skb->data, rfc1042_header, SNAP_SIZE) &&