net: Add export.h for EXPORT_SYMBOL/THIS_MODULE to non-modules
[pandora-kernel.git] / net / wireless / reg.c
index 68a471b..6acba9d 100644 (file)
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
+#include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/list.h>
 #include <linux/random.h>
 #include <linux/ctype.h>
 #include <linux/nl80211.h>
 #include <linux/platform_device.h>
+#include <linux/moduleparam.h>
 #include <net/cfg80211.h>
 #include "core.h"
 #include "reg.h"
 #include "nl80211.h"
 
 #ifdef CONFIG_CFG80211_REG_DEBUG
-#define REG_DBG_PRINT(format, args...) \
-       do { \
-               printk(KERN_DEBUG pr_fmt(format), ##args);      \
-       } while (0)
+#define REG_DBG_PRINT(format, args...)                 \
+       printk(KERN_DEBUG pr_fmt(format), ##args)
 #else
 #define REG_DBG_PRINT(args...)
 #endif
@@ -753,9 +753,10 @@ static void chan_reg_rule_print_dbg(struct ieee80211_channel *chan,
                      chan->center_freq,
                      KHZ_TO_MHZ(desired_bw_khz));
 
-       REG_DBG_PRINT("%d KHz - %d KHz @  KHz), (%s mBi, %d mBm)\n",
+       REG_DBG_PRINT("%d KHz - %d KHz @ %d KHz), (%s mBi, %d mBm)\n",
                      freq_range->start_freq_khz,
                      freq_range->end_freq_khz,
+                     freq_range->max_bandwidth_khz,
                      max_antenna_gain,
                      power_rule->max_eirp);
 }
@@ -891,7 +892,7 @@ static bool ignore_reg_update(struct wiphy *wiphy,
            wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) {
                REG_DBG_PRINT("Ignoring regulatory request %s "
                              "since the driver uses its own custom "
-                             "regulatory domain ",
+                             "regulatory domain\n",
                              reg_initiator_name(initiator));
                return true;
        }
@@ -905,7 +906,7 @@ static bool ignore_reg_update(struct wiphy *wiphy,
            !is_world_regdom(last_request->alpha2)) {
                REG_DBG_PRINT("Ignoring regulatory request %s "
                              "since the driver requires its own regulatory "
-                             "domain to be set first",
+                             "domain to be set first\n",
                              reg_initiator_name(initiator));
                return true;
        }
@@ -913,14 +914,6 @@ static bool ignore_reg_update(struct wiphy *wiphy,
        return false;
 }
 
-static void update_all_wiphy_regulatory(enum nl80211_reg_initiator initiator)
-{
-       struct cfg80211_registered_device *rdev;
-
-       list_for_each_entry(rdev, &cfg80211_rdev_list, list)
-               wiphy_update_regulatory(&rdev->wiphy, initiator);
-}
-
 static void handle_reg_beacon(struct wiphy *wiphy,
                              unsigned int chan_idx,
                              struct reg_beacon *reg_beacon)
@@ -1120,11 +1113,13 @@ static void reg_process_ht_flags(struct wiphy *wiphy)
 
 }
 
-void wiphy_update_regulatory(struct wiphy *wiphy,
-                            enum nl80211_reg_initiator initiator)
+static void wiphy_update_regulatory(struct wiphy *wiphy,
+                                   enum nl80211_reg_initiator initiator)
 {
        enum ieee80211_band band;
 
+       assert_reg_lock();
+
        if (ignore_reg_update(wiphy, initiator))
                return;
 
@@ -1139,6 +1134,22 @@ void wiphy_update_regulatory(struct wiphy *wiphy,
                wiphy->reg_notifier(wiphy, last_request);
 }
 
+void regulatory_update(struct wiphy *wiphy,
+                      enum nl80211_reg_initiator setby)
+{
+       mutex_lock(&reg_mutex);
+       wiphy_update_regulatory(wiphy, setby);
+       mutex_unlock(&reg_mutex);
+}
+
+static void update_all_wiphy_regulatory(enum nl80211_reg_initiator initiator)
+{
+       struct cfg80211_registered_device *rdev;
+
+       list_for_each_entry(rdev, &cfg80211_rdev_list, list)
+               wiphy_update_regulatory(&rdev->wiphy, initiator);
+}
+
 static void handle_channel_custom(struct wiphy *wiphy,
                                  enum ieee80211_band band,
                                  unsigned int chan_idx,
@@ -1475,7 +1486,7 @@ static void reg_process_pending_hints(void)
        /* When last_request->processed becomes true this will be rescheduled */
        if (last_request && !last_request->processed) {
                REG_DBG_PRINT("Pending regulatory request, waiting "
-                             "for it to be processed...");
+                             "for it to be processed...\n");
                goto out;
        }
 
@@ -2188,7 +2199,7 @@ out:
 static void reg_timeout_work(struct work_struct *work)
 {
        REG_DBG_PRINT("Timeout while waiting for CRDA to reply, "
-                     "restoring regulatory settings");
+                     "restoring regulatory settings\n");
        restore_regulatory_settings(true);
 }