mac80211: introduce hw config change flags
[firefly-linux-kernel-4.4.55.git] / net / mac80211 / scan.c
index 8e6685e7ae8595569582ecdf7ea67340da79f2fa..7372d7abb8c0ecc439bb5a076640d1168e65947f 100644 (file)
@@ -388,7 +388,8 @@ ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
        bss = ieee80211_bss_info_update(sdata->local, rx_status,
                                        mgmt, skb->len, &elems,
                                        freq, beacon);
-       ieee80211_rx_bss_put(sdata->local, bss);
+       if (bss)
+               ieee80211_rx_bss_put(sdata->local, bss);
 
        dev_kfree_skb(skb);
        return RX_QUEUED;
@@ -447,18 +448,17 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
 
        if (local->hw_scanning) {
                local->hw_scanning = false;
-               if (ieee80211_hw_config(local))
-                       printk(KERN_DEBUG "%s: failed to restore operational "
-                              "channel after scan\n", wiphy_name(local->hw.wiphy));
-
+               /*
+                * Somebody might have requested channel change during scan
+                * that we won't have acted upon, try now. ieee80211_hw_config
+                * will set the flag based on actual changes.
+                */
+               ieee80211_hw_config(local, 0);
                goto done;
        }
 
        local->sw_scanning = false;
-       if (ieee80211_hw_config(local))
-               printk(KERN_DEBUG "%s: failed to restore operational "
-                      "channel after scan\n", wiphy_name(local->hw.wiphy));
-
+       ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
 
        netif_tx_lock_bh(local->mdev);
        netif_addr_lock(local->mdev);
@@ -545,12 +545,9 @@ void ieee80211_scan_work(struct work_struct *work)
 
                if (!skip) {
                        local->scan_channel = chan;
-                       if (ieee80211_hw_config(local)) {
-                               printk(KERN_DEBUG "%s: failed to set freq to "
-                                      "%d MHz for scan\n", wiphy_name(local->hw.wiphy),
-                                      chan->center_freq);
+                       if (ieee80211_hw_config(local,
+                                               IEEE80211_CONF_CHANGE_CHANNEL))
                                skip = 1;
-                       }
                }
 
                /* advance state machine to next channel/band */