cfg80211: Add a function to get the number of supported channels
[firefly-linux-kernel-4.4.55.git] / net / wireless / sme.c
index 65f800890d70d857c9b42d379caad887f5a98c74..c854f1ce22db539aa1ba0d339712acef8a834f4d 100644 (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);
@@ -870,6 +863,8 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
                for (i = 0; i < 6; i++)
                        rdev_del_key(rdev, dev, i, false, NULL);
 
+       rdev_set_qos_map(rdev, dev, NULL);
+
 #ifdef CONFIG_CFG80211_WEXT
        memset(&wrqu, 0, sizeof(wrqu));
        wrqu.ap_addr.sa_family = ARPHRD_ETHER;