mwifiex: use get_random_mask_addr() helper

Avoid calculating random MAC address in driver. Instead make
use of 'get_random_mask_addr()' function.

Signed-off-by: Ganapathi Bhat <gbhat@marvell.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
Ganapathi Bhat 2017-09-18 13:12:17 +05:30 committed by Kalle Valo
parent e251a882c0
commit e9a3846afa

View File

@ -2503,6 +2503,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
struct ieee80211_channel *chan; struct ieee80211_channel *chan;
struct ieee_types_header *ie; struct ieee_types_header *ie;
struct mwifiex_user_scan_cfg *user_scan_cfg; struct mwifiex_user_scan_cfg *user_scan_cfg;
u8 mac_addr[ETH_ALEN];
mwifiex_dbg(priv->adapter, CMD, mwifiex_dbg(priv->adapter, CMD,
"info: received scan request on %s\n", dev->name); "info: received scan request on %s\n", dev->name);
@ -2529,12 +2530,10 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
priv->scan_request = request; priv->scan_request = request;
if (request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { if (request->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) {
for (i = 0; i < ETH_ALEN; i++) { get_random_mask_addr(mac_addr, request->mac_addr,
request->mac_addr[i] &= request->mac_addr_mask[i]; request->mac_addr_mask);
request->mac_addr[i] |= ether_addr_copy(request->mac_addr, mac_addr);
get_random_int() & ~(request->mac_addr_mask[i]); ether_addr_copy(user_scan_cfg->random_mac, mac_addr);
}
ether_addr_copy(user_scan_cfg->random_mac, request->mac_addr);
} }
user_scan_cfg->num_ssids = request->n_ssids; user_scan_cfg->num_ssids = request->n_ssids;