]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - net/wireless/reg.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6.git] / net / wireless / reg.c
index 08265ca157853c525a74512306bbe7ac055b72c3..139d13fdc94f30db342147cc6a9f3e93576de013 100644 (file)
@@ -37,7 +37,6 @@
 #include <linux/random.h>
 #include <linux/nl80211.h>
 #include <linux/platform_device.h>
-#include <net/wireless.h>
 #include <net/cfg80211.h>
 #include "core.h"
 #include "reg.h"
@@ -1050,18 +1049,10 @@ static void handle_reg_beacon(struct wiphy *wiphy,
                              unsigned int chan_idx,
                              struct reg_beacon *reg_beacon)
 {
-#ifdef CONFIG_CFG80211_REG_DEBUG
-#define REG_DEBUG_BEACON_FLAG(desc) \
-       printk(KERN_DEBUG "cfg80211: Enabling " desc " on " \
-               "frequency: %d MHz (Ch %d) on %s\n", \
-               reg_beacon->chan.center_freq, \
-               ieee80211_frequency_to_channel(reg_beacon->chan.center_freq), \
-               wiphy_name(wiphy));
-#else
-#define REG_DEBUG_BEACON_FLAG(desc) do {} while (0)
-#endif
        struct ieee80211_supported_band *sband;
        struct ieee80211_channel *chan;
+       bool channel_changed = false;
+       struct ieee80211_channel chan_before;
 
        assert_cfg80211_lock();
 
@@ -1071,18 +1062,28 @@ static void handle_reg_beacon(struct wiphy *wiphy,
        if (likely(chan->center_freq != reg_beacon->chan.center_freq))
                return;
 
-       if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) {
+       if (chan->beacon_found)
+               return;
+
+       chan->beacon_found = true;
+
+       chan_before.center_freq = chan->center_freq;
+       chan_before.flags = chan->flags;
+
+       if ((chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) &&
+           !(chan->orig_flags & IEEE80211_CHAN_PASSIVE_SCAN)) {
                chan->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
-               REG_DEBUG_BEACON_FLAG("active scanning");
+               channel_changed = true;
        }
 
-       if (chan->flags & IEEE80211_CHAN_NO_IBSS) {
+       if ((chan->flags & IEEE80211_CHAN_NO_IBSS) &&
+           !(chan->orig_flags & IEEE80211_CHAN_NO_IBSS)) {
                chan->flags &= ~IEEE80211_CHAN_NO_IBSS;
-               REG_DEBUG_BEACON_FLAG("beaconing");
+               channel_changed = true;
        }
 
-       chan->beacon_found = true;
-#undef REG_DEBUG_BEACON_FLAG
+       if (channel_changed)
+               nl80211_send_beacon_hint_event(wiphy, &chan_before, chan);
 }
 
 /*