aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-01-07 20:43:33 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-16 17:08:24 -0500
commita92a3ce72483d7f0902dff8a3be8cdcee215a37c (patch)
treed2bcf4f2ce63fd0526f518c62ed66261f1518874 /net
parent73e1a65d3c4a013f6fa56e47133be95143a75fe3 (diff)
cfg80211: make handle_band() and handle_channel() wiphy specific
This allows us to make more wiphy specific judgements when handling the channels later on. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Acked-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/wireless/reg.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 4f877535e666..af805b0e1579 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -778,13 +778,22 @@ static int freq_reg_info(u32 center_freq, u32 *bandwidth,
778 return !max_bandwidth; 778 return !max_bandwidth;
779} 779}
780 780
781static void handle_channel(struct ieee80211_channel *chan) 781static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
782 unsigned int chan_idx)
782{ 783{
783 int r; 784 int r;
784 u32 flags = chan->orig_flags; 785 u32 flags;
785 u32 max_bandwidth = 0; 786 u32 max_bandwidth = 0;
786 const struct ieee80211_reg_rule *reg_rule = NULL; 787 const struct ieee80211_reg_rule *reg_rule = NULL;
787 const struct ieee80211_power_rule *power_rule = NULL; 788 const struct ieee80211_power_rule *power_rule = NULL;
789 struct ieee80211_supported_band *sband;
790 struct ieee80211_channel *chan;
791
792 sband = wiphy->bands[band];
793 BUG_ON(chan_idx >= sband->n_channels);
794 chan = &sband->channels[chan_idx];
795
796 flags = chan->orig_flags;
788 797
789 r = freq_reg_info(MHZ_TO_KHZ(chan->center_freq), 798 r = freq_reg_info(MHZ_TO_KHZ(chan->center_freq),
790 &max_bandwidth, &reg_rule); 799 &max_bandwidth, &reg_rule);
@@ -808,12 +817,16 @@ static void handle_channel(struct ieee80211_channel *chan)
808 chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp); 817 chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
809} 818}
810 819
811static void handle_band(struct ieee80211_supported_band *sband) 820static void handle_band(struct wiphy *wiphy, enum ieee80211_band band)
812{ 821{
813 int i; 822 unsigned int i;
823 struct ieee80211_supported_band *sband;
824
825 BUG_ON(!wiphy->bands[band]);
826 sband = wiphy->bands[band];
814 827
815 for (i = 0; i < sband->n_channels; i++) 828 for (i = 0; i < sband->n_channels; i++)
816 handle_channel(&sband->channels[i]); 829 handle_channel(wiphy, band, i);
817} 830}
818 831
819static bool ignore_reg_update(struct wiphy *wiphy, enum reg_set_by setby) 832static bool ignore_reg_update(struct wiphy *wiphy, enum reg_set_by setby)
@@ -840,7 +853,7 @@ void wiphy_update_regulatory(struct wiphy *wiphy, enum reg_set_by setby)
840 enum ieee80211_band band; 853 enum ieee80211_band band;
841 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 854 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
842 if (wiphy->bands[band]) 855 if (wiphy->bands[band])
843 handle_band(wiphy->bands[band]); 856 handle_band(wiphy, band);
844 if (wiphy->reg_notifier) 857 if (wiphy->reg_notifier)
845 wiphy->reg_notifier(wiphy, setby); 858 wiphy->reg_notifier(wiphy, setby);
846 } 859 }