Commit bbcf3f02 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

cfg80211: warn when wiphy_apply_custom_regulatory() does nothing

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: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent eeddfd9d
...@@ -1344,13 +1344,22 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy, ...@@ -1344,13 +1344,22 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
const struct ieee80211_regdomain *regd) const struct ieee80211_regdomain *regd)
{ {
enum ieee80211_band band; enum ieee80211_band band;
unsigned int bands_set = 0;
mutex_lock(&cfg80211_mutex); mutex_lock(&cfg80211_mutex);
for (band = 0; band < IEEE80211_NUM_BANDS; band++) { for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
if (wiphy->bands[band]) if (!wiphy->bands[band])
handle_band_custom(wiphy, band, regd); continue;
handle_band_custom(wiphy, band, regd);
bands_set++;
} }
mutex_unlock(&cfg80211_mutex); 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); EXPORT_SYMBOL(wiphy_apply_custom_regulatory);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment