diff options
author | Adham Abozaeid <adham.abozaeid@microchip.com> | 2019-03-25 22:27:26 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-27 23:37:30 +0900 |
commit | ac118d87cff7eb9b799c6676ca0646928cb65e85 (patch) | |
tree | c43c6d8aad9db22882526dca0c55d65057beef96 /drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | |
parent | ffb99752e93053242988e858ff879855cc87bf89 (diff) | |
download | linux-next-ac118d87cff7eb9b799c6676ca0646928cb65e85.tar.gz |
staging: wilc1000: use cfg80211 ssid list instead of repacking it
Avoid repacking ssid values into struct wilc_probe_ssid, and use the
cfg80211 provided struct to pass the ssid list to wilc_scan.
With this change, struct wilc_probe_ssid, struct wilc_probe_ssid_info
and function wilc_wfi_cfg_alloc_fill_ssid will not be needed anymore.
Signed-off-by: Adham Abozaeid <adham.abozaeid@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wilc1000/wilc_wfi_cfgoperations.c')
-rw-r--r-- | drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 69 |
1 files changed, 3 insertions, 66 deletions
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 75ec752b5059..f6825727bf77 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -214,50 +214,6 @@ static int set_channel(struct wiphy *wiphy, return result; } -static inline int -wilc_wfi_cfg_alloc_fill_ssid(struct cfg80211_scan_request *request, - struct wilc_probe_ssid *search) -{ - int i; - int slot_id = 0; - - search->ssid_info = kcalloc(request->n_ssids, - sizeof(*search->ssid_info), GFP_KERNEL); - if (!search->ssid_info) - goto out; - - search->n_ssids = request->n_ssids; - - for (i = 0; i < request->n_ssids; i++) { - if (request->ssids[i].ssid_len > 0) { - struct wilc_probe_ssid_info *info; - - info = &search->ssid_info[slot_id]; - info->ssid = kmemdup(request->ssids[i].ssid, - request->ssids[i].ssid_len, - GFP_KERNEL); - if (!info->ssid) - goto out_free; - - info->ssid_len = request->ssids[i].ssid_len; - slot_id++; - } else { - search->n_ssids -= 1; - } - } - return 0; - -out_free: - - for (i = 0; i < slot_id; i++) - kfree(search->ssid_info[i].ssid); - - kfree(search->ssid_info); -out: - - return -ENOMEM; -} - static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) { struct wilc_priv *priv = wiphy_priv(wiphy); @@ -265,7 +221,6 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) u32 i; int ret = 0; u8 scan_ch_list[WILC_MAX_NUM_SCANNED_CH]; - struct wilc_probe_ssid probe_ssid; if (request->n_channels > WILC_MAX_NUM_SCANNED_CH) { netdev_err(priv->dev, "Requested scanned channels over\n"); @@ -280,28 +235,10 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request) scan_ch_list[i] = ieee80211_frequency_to_channel(freq); } - if (request->n_ssids >= 1) { - if (wilc_wfi_cfg_alloc_fill_ssid(request, &probe_ssid)) { - ret = -ENOMEM; - goto out; - } - - ret = wilc_scan(vif, WILC_FW_USER_SCAN, - WILC_FW_ACTIVE_SCAN, scan_ch_list, - request->n_channels, - (const u8 *)request->ie, - request->ie_len, cfg_scan_result, - (void *)priv, &probe_ssid); - } else { - ret = wilc_scan(vif, WILC_FW_USER_SCAN, - WILC_FW_ACTIVE_SCAN, scan_ch_list, - request->n_channels, - (const u8 *)request->ie, - request->ie_len, cfg_scan_result, - (void *)priv, NULL); - } + ret = wilc_scan(vif, WILC_FW_USER_SCAN, WILC_FW_ACTIVE_SCAN, + scan_ch_list, request->n_channels, cfg_scan_result, + (void *)priv, request); -out: if (ret) { priv->scan_req = NULL; priv->cfg_scanning = false; |