Skip to content

Commit b57f9f3

Browse files
glenlee75gregkh
authored andcommitted
Revert "Staging: wilc1000: coreconfigurator: Drop unneeded wrapper functions"
The source and destination pointers are misplaced. This will be like, ether_addr_copy(data, bssid + ADDR2); -> ether_addr_copy(bssid, data + ADDR2); and also to use ether_addr_copy, it has to be proved that src/dst address are properly aligned(2). I revert this as author agree to drop this patch. This reverts commit d4622f6. Signed-off-by: Glen Lee <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 819db46 commit b57f9f3

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

drivers/staging/wilc1000/coreconfigurator.c

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@
1313
#include "wilc_wlan.h"
1414
#include <linux/errno.h>
1515
#include <linux/slab.h>
16-
#include <linux/etherdevice.h>
1716
#define TAG_PARAM_OFFSET (MAC_HDR_LEN + TIME_STAMP_LEN + \
1817
BEACON_INTERVAL_LEN + CAP_INFO_LEN)
19-
#define ADDR1 4
20-
#define ADDR2 10
21-
#define ADDR3 16
2218

2319
/* Basic Frame Type Codes (2-bit) */
2420
enum basic_frame_type {
@@ -175,32 +171,38 @@ static inline u8 get_from_ds(u8 *header)
175171
return ((header[1] & 0x02) >> 1);
176172
}
177173

174+
/* This function extracts the MAC Address in 'address1' field of the MAC */
175+
/* header and updates the MAC Address in the allocated 'addr' variable. */
176+
static inline void get_address1(u8 *pu8msa, u8 *addr)
177+
{
178+
memcpy(addr, pu8msa + 4, 6);
179+
}
180+
181+
/* This function extracts the MAC Address in 'address2' field of the MAC */
182+
/* header and updates the MAC Address in the allocated 'addr' variable. */
183+
static inline void get_address2(u8 *pu8msa, u8 *addr)
184+
{
185+
memcpy(addr, pu8msa + 10, 6);
186+
}
187+
188+
/* This function extracts the MAC Address in 'address3' field of the MAC */
189+
/* header and updates the MAC Address in the allocated 'addr' variable. */
190+
static inline void get_address3(u8 *pu8msa, u8 *addr)
191+
{
192+
memcpy(addr, pu8msa + 16, 6);
193+
}
194+
178195
/* This function extracts the BSSID from the incoming WLAN packet based on */
179-
/* the 'from ds' bit, and updates the MAC Address in the allocated 'data' */
196+
/* the 'from ds' bit, and updates the MAC Address in the allocated 'addr' */
180197
/* variable. */
181198
static inline void get_BSSID(u8 *data, u8 *bssid)
182199
{
183200
if (get_from_ds(data) == 1)
184-
/*
185-
* Extract the MAC Address in 'address2' field of the MAC
186-
* header and update the MAC Address in the allocated 'data'
187-
* variable.
188-
*/
189-
ether_addr_copy(data, bssid + ADDR2);
201+
get_address2(data, bssid);
190202
else if (get_to_ds(data) == 1)
191-
/*
192-
* Extract the MAC Address in 'address1' field of the MAC
193-
* header and update the MAC Address in the allocated 'data'
194-
* variable.
195-
*/
196-
ether_addr_copy(data, bssid + ADDR1);
203+
get_address1(data, bssid);
197204
else
198-
/*
199-
* Extract the MAC Address in 'address3' field of the MAC
200-
* header and update the MAC Address in the allocated 'data'
201-
* variable.
202-
*/
203-
ether_addr_copy(data, bssid + ADDR3);
205+
get_address3(data, bssid);
204206
}
205207

206208
/* This function extracts the SSID from a beacon/probe response frame */

0 commit comments

Comments
 (0)