cfg80211: Add a function to get the number of supported channels

Add a utility function to get the number of channels supported by
the device, and update the places in the code that need this data.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
[replace another occurrence in libertas, fix kernel-doc, fix bugs]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Ilan Peer 2014-01-09 11:37:23 +02:00 committed by Johannes Berg
parent 685328b296
commit bdfbec2d2d
6 changed files with 29 additions and 32 deletions

View file

@ -70,18 +70,11 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
if (rdev->scan_req)
return -EBUSY;
if (wdev->conn->params.channel) {
if (wdev->conn->params.channel)
n_channels = 1;
} else {
enum ieee80211_band band;
n_channels = 0;
else
n_channels = ieee80211_get_num_supported_channels(wdev->wiphy);
for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
if (!wdev->wiphy->bands[band])
continue;
n_channels += wdev->wiphy->bands[band]->n_channels;
}
}
request = kzalloc(sizeof(*request) + sizeof(request->ssids[0]) +
sizeof(request->channels[0]) * n_channels,
GFP_KERNEL);