Commit 6f466168 authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman
Browse files

staging: wilc1000: refactor scan() cfg80211 ops callback



Refactor scan() cfg80211 callback function and use correct value for
valid channel number limit.

Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0ae6cb7a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ enum {
};

#define WILC_MAX_NUM_STA			9
#define MAX_NUM_SCANNED_NETWORKS		100
#define WILC_MAX_NUM_SCANNED_CH			14
#define WILC_MAX_NUM_PROBED_SSID		10

#define TX_MIC_KEY_LEN				8
+27 −28
Original line number Diff line number Diff line
@@ -266,13 +266,16 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
	struct wilc_vif *vif = netdev_priv(priv->dev);
	u32 i;
	int ret = 0;
	u8 scan_ch_list[MAX_NUM_SCANNED_NETWORKS];
	u8 scan_ch_list[WILC_MAX_NUM_SCANNED_CH];
	struct wilc_probe_ssid probe_ssid;

	priv->scan_req = request;
	if (request->n_channels > WILC_MAX_NUM_SCANNED_CH) {
		netdev_err(priv->dev, "Requested scanned channels over\n");
		return -EINVAL;
	}

	priv->scan_req = request;
	priv->cfg_scanning = true;
	if (request->n_channels <= MAX_NUM_SCANNED_NETWORKS) {
	for (i = 0; i < request->n_channels; i++) {
		u16 freq = request->channels[i]->center_freq;

@@ -280,8 +283,7 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
	}

	if (request->n_ssids >= 1) {
			if (wilc_wfi_cfg_alloc_fill_ssid(request,
							 &probe_ssid)) {
		if (wilc_wfi_cfg_alloc_fill_ssid(request, &probe_ssid)) {
			ret = -ENOMEM;
			goto out;
		}
@@ -300,9 +302,6 @@ static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
				request->ie_len, cfg_scan_result,
				(void *)priv, NULL);
	}
	} else {
		netdev_err(priv->dev, "Requested scanned channels over\n");
	}

out:
	if (ret) {