cfg80211: warn when wiphy_apply_custom_regulatory() does nothing
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 19 May 2009 21:49:47 +0000 (17:49 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 20 May 2009 18:46:37 +0000 (14:46 -0400)
Device drivers using wiphy_apply_custom_regulatory() want some
regulatory settings applied to their wiphy, if no bands were
configured on the wiphy then something went wrong.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/wireless/reg.c

index 8d176a8010baebcef113478a2e845ec6c09f497a..df0ced9405d3db34a083b0bbce63022c8d7801a6 100644 (file)
@@ -1344,13 +1344,22 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
                                   const struct ieee80211_regdomain *regd)
 {
        enum ieee80211_band band;
+       unsigned int bands_set = 0;
 
        mutex_lock(&cfg80211_mutex);
        for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
-               if (wiphy->bands[band])
-                       handle_band_custom(wiphy, band, regd);
+               if (!wiphy->bands[band])
+                       continue;
+               handle_band_custom(wiphy, band, regd);
+               bands_set++;
        }
        mutex_unlock(&cfg80211_mutex);
+
+       /*
+        * no point in calling this if it won't have any effect
+        * on your device's supportd bands.
+        */
+       WARN_ON(!bands_set);
 }
 EXPORT_SYMBOL(wiphy_apply_custom_regulatory);