aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/ieee80211_geo.c
diff options
context:
space:
mode:
authorZhu Yi <yi.zhu@intel.com>2006-01-19 03:21:45 -0500
committerJohn W. Linville <linville@tuxdriver.com>2006-01-27 17:08:06 -0500
commitd128f6c176bff9c4929476e13132804321a6d5c5 (patch)
tree6c48f08712a5a81501fea7c317faa9f517d70520 /net/ieee80211/ieee80211_geo.c
parent24056bec086aaa99923b21c0e1a0e993bb1c7e2a (diff)
[PATCH] ieee80211: add flags for all geo channels
Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/ieee80211/ieee80211_geo.c')
-rw-r--r--net/ieee80211/ieee80211_geo.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/net/ieee80211/ieee80211_geo.c b/net/ieee80211/ieee80211_geo.c
index 610cc5cbc252..3027153940fc 100644
--- a/net/ieee80211/ieee80211_geo.c
+++ b/net/ieee80211/ieee80211_geo.c
@@ -58,13 +58,15 @@ int ieee80211_is_valid_channel(struct ieee80211_device *ieee, u8 channel)
58 * this is a B only channel, we don't see it 58 * this is a B only channel, we don't see it
59 * as valid. */ 59 * as valid. */
60 if ((ieee->geo.bg[i].channel == channel) && 60 if ((ieee->geo.bg[i].channel == channel) &&
61 !(ieee->geo.bg[i].flags & IEEE80211_CH_INVALID) &&
61 (!(ieee->mode & IEEE_G) || 62 (!(ieee->mode & IEEE_G) ||
62 !(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY))) 63 !(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY)))
63 return IEEE80211_24GHZ_BAND; 64 return IEEE80211_24GHZ_BAND;
64 65
65 if (ieee->freq_band & IEEE80211_52GHZ_BAND) 66 if (ieee->freq_band & IEEE80211_52GHZ_BAND)
66 for (i = 0; i < ieee->geo.a_channels; i++) 67 for (i = 0; i < ieee->geo.a_channels; i++)
67 if (ieee->geo.a[i].channel == channel) 68 if ((ieee->geo.a[i].channel == channel) &&
69 !(ieee->geo.a[i].flags & IEEE80211_CH_INVALID))
68 return IEEE80211_52GHZ_BAND; 70 return IEEE80211_52GHZ_BAND;
69 71
70 return 0; 72 return 0;
@@ -133,6 +135,41 @@ const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device *ieee)
133 return &ieee->geo; 135 return &ieee->geo;
134} 136}
135 137
138u8 ieee80211_get_channel_flags(struct ieee80211_device * ieee, u8 channel)
139{
140 int index = ieee80211_channel_to_index(ieee, channel);
141
142 if (index == -1)
143 return IEEE80211_CH_INVALID;
144
145 if (channel <= IEEE80211_24GHZ_CHANNELS)
146 return ieee->geo.bg[index].flags;
147
148 return ieee->geo.a[index].flags;
149}
150
151static const struct ieee80211_channel bad_channel = {
152 .channel = 0,
153 .flags = IEEE80211_CH_INVALID,
154 .max_power = 0,
155};
156
157const struct ieee80211_channel *ieee80211_get_channel(struct ieee80211_device
158 *ieee, u8 channel)
159{
160 int index = ieee80211_channel_to_index(ieee, channel);
161
162 if (index == -1)
163 return &bad_channel;
164
165 if (channel <= IEEE80211_24GHZ_CHANNELS)
166 return &ieee->geo.bg[index];
167
168 return &ieee->geo.a[index];
169}
170
171EXPORT_SYMBOL(ieee80211_get_channel);
172EXPORT_SYMBOL(ieee80211_get_channel_flags);
136EXPORT_SYMBOL(ieee80211_is_valid_channel); 173EXPORT_SYMBOL(ieee80211_is_valid_channel);
137EXPORT_SYMBOL(ieee80211_freq_to_channel); 174EXPORT_SYMBOL(ieee80211_freq_to_channel);
138EXPORT_SYMBOL(ieee80211_channel_to_index); 175EXPORT_SYMBOL(ieee80211_channel_to_index);