aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2x00/libipw_geo.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2009-08-20 14:48:03 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-28 14:40:28 -0400
commitb0a4e7d8a291de63f35b04464de9ab4a83d38a7c (patch)
treec95a79b15483070bf1ca92ddf7b7e9ba4d4af026 /drivers/net/wireless/ipw2x00/libipw_geo.c
parent01a0ac417ce9b4f1216a266f2fd454cffefc5aee (diff)
libipw: switch from ieee80211_* to libipw_* naming policy
This eliminates the dual definition of ieee80211_channel (and possibly others), further clarifying who defines what and paving the way for inclusion of cfg80211.h. Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ipw2x00/libipw_geo.c')
-rw-r--r--drivers/net/wireless/ipw2x00/libipw_geo.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/drivers/net/wireless/ipw2x00/libipw_geo.c b/drivers/net/wireless/ipw2x00/libipw_geo.c
index 9dfbb8760f67..d04979ba2a5b 100644
--- a/drivers/net/wireless/ipw2x00/libipw_geo.c
+++ b/drivers/net/wireless/ipw2x00/libipw_geo.c
@@ -41,9 +41,9 @@
41#include <linux/etherdevice.h> 41#include <linux/etherdevice.h>
42#include <asm/uaccess.h> 42#include <asm/uaccess.h>
43 43
44#include "ieee80211.h" 44#include "libipw.h"
45 45
46int ieee80211_is_valid_channel(struct ieee80211_device *ieee, u8 channel) 46int libipw_is_valid_channel(struct libipw_device *ieee, u8 channel)
47{ 47{
48 int i; 48 int i;
49 49
@@ -52,27 +52,27 @@ int ieee80211_is_valid_channel(struct ieee80211_device *ieee, u8 channel)
52 if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0) 52 if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0)
53 return 0; 53 return 0;
54 54
55 if (ieee->freq_band & IEEE80211_24GHZ_BAND) 55 if (ieee->freq_band & LIBIPW_24GHZ_BAND)
56 for (i = 0; i < ieee->geo.bg_channels; i++) 56 for (i = 0; i < ieee->geo.bg_channels; i++)
57 /* NOTE: If G mode is currently supported but 57 /* NOTE: If G mode is currently supported but
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->geo.bg[i].flags & LIBIPW_CH_INVALID) &&
62 (!(ieee->mode & IEEE_G) || 62 (!(ieee->mode & IEEE_G) ||
63 !(ieee->geo.bg[i].flags & IEEE80211_CH_B_ONLY))) 63 !(ieee->geo.bg[i].flags & LIBIPW_CH_B_ONLY)))
64 return IEEE80211_24GHZ_BAND; 64 return LIBIPW_24GHZ_BAND;
65 65
66 if (ieee->freq_band & IEEE80211_52GHZ_BAND) 66 if (ieee->freq_band & LIBIPW_52GHZ_BAND)
67 for (i = 0; i < ieee->geo.a_channels; i++) 67 for (i = 0; i < ieee->geo.a_channels; i++)
68 if ((ieee->geo.a[i].channel == channel) && 68 if ((ieee->geo.a[i].channel == channel) &&
69 !(ieee->geo.a[i].flags & IEEE80211_CH_INVALID)) 69 !(ieee->geo.a[i].flags & LIBIPW_CH_INVALID))
70 return IEEE80211_52GHZ_BAND; 70 return LIBIPW_52GHZ_BAND;
71 71
72 return 0; 72 return 0;
73} 73}
74 74
75int ieee80211_channel_to_index(struct ieee80211_device *ieee, u8 channel) 75int libipw_channel_to_index(struct libipw_device *ieee, u8 channel)
76{ 76{
77 int i; 77 int i;
78 78
@@ -81,12 +81,12 @@ int ieee80211_channel_to_index(struct ieee80211_device *ieee, u8 channel)
81 if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0) 81 if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0)
82 return -1; 82 return -1;
83 83
84 if (ieee->freq_band & IEEE80211_24GHZ_BAND) 84 if (ieee->freq_band & LIBIPW_24GHZ_BAND)
85 for (i = 0; i < ieee->geo.bg_channels; i++) 85 for (i = 0; i < ieee->geo.bg_channels; i++)
86 if (ieee->geo.bg[i].channel == channel) 86 if (ieee->geo.bg[i].channel == channel)
87 return i; 87 return i;
88 88
89 if (ieee->freq_band & IEEE80211_52GHZ_BAND) 89 if (ieee->freq_band & LIBIPW_52GHZ_BAND)
90 for (i = 0; i < ieee->geo.a_channels; i++) 90 for (i = 0; i < ieee->geo.a_channels; i++)
91 if (ieee->geo.a[i].channel == channel) 91 if (ieee->geo.a[i].channel == channel)
92 return i; 92 return i;
@@ -94,22 +94,22 @@ int ieee80211_channel_to_index(struct ieee80211_device *ieee, u8 channel)
94 return -1; 94 return -1;
95} 95}
96 96
97u32 ieee80211_channel_to_freq(struct ieee80211_device * ieee, u8 channel) 97u32 libipw_channel_to_freq(struct libipw_device * ieee, u8 channel)
98{ 98{
99 const struct ieee80211_channel * ch; 99 const struct libipw_channel * ch;
100 100
101 /* Driver needs to initialize the geography map before using 101 /* Driver needs to initialize the geography map before using
102 * these helper functions */ 102 * these helper functions */
103 if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0) 103 if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0)
104 return 0; 104 return 0;
105 105
106 ch = ieee80211_get_channel(ieee, channel); 106 ch = libipw_get_channel(ieee, channel);
107 if (!ch->channel) 107 if (!ch->channel)
108 return 0; 108 return 0;
109 return ch->freq; 109 return ch->freq;
110} 110}
111 111
112u8 ieee80211_freq_to_channel(struct ieee80211_device * ieee, u32 freq) 112u8 libipw_freq_to_channel(struct libipw_device * ieee, u32 freq)
113{ 113{
114 int i; 114 int i;
115 115
@@ -120,12 +120,12 @@ u8 ieee80211_freq_to_channel(struct ieee80211_device * ieee, u32 freq)
120 120
121 freq /= 100000; 121 freq /= 100000;
122 122
123 if (ieee->freq_band & IEEE80211_24GHZ_BAND) 123 if (ieee->freq_band & LIBIPW_24GHZ_BAND)
124 for (i = 0; i < ieee->geo.bg_channels; i++) 124 for (i = 0; i < ieee->geo.bg_channels; i++)
125 if (ieee->geo.bg[i].freq == freq) 125 if (ieee->geo.bg[i].freq == freq)
126 return ieee->geo.bg[i].channel; 126 return ieee->geo.bg[i].channel;
127 127
128 if (ieee->freq_band & IEEE80211_52GHZ_BAND) 128 if (ieee->freq_band & LIBIPW_52GHZ_BAND)
129 for (i = 0; i < ieee->geo.a_channels; i++) 129 for (i = 0; i < ieee->geo.a_channels; i++)
130 if (ieee->geo.a[i].freq == freq) 130 if (ieee->geo.a[i].freq == freq)
131 return ieee->geo.a[i].channel; 131 return ieee->geo.a[i].channel;
@@ -133,63 +133,63 @@ u8 ieee80211_freq_to_channel(struct ieee80211_device * ieee, u32 freq)
133 return 0; 133 return 0;
134} 134}
135 135
136int ieee80211_set_geo(struct ieee80211_device *ieee, 136int libipw_set_geo(struct libipw_device *ieee,
137 const struct ieee80211_geo *geo) 137 const struct libipw_geo *geo)
138{ 138{
139 memcpy(ieee->geo.name, geo->name, 3); 139 memcpy(ieee->geo.name, geo->name, 3);
140 ieee->geo.name[3] = '\0'; 140 ieee->geo.name[3] = '\0';
141 ieee->geo.bg_channels = geo->bg_channels; 141 ieee->geo.bg_channels = geo->bg_channels;
142 ieee->geo.a_channels = geo->a_channels; 142 ieee->geo.a_channels = geo->a_channels;
143 memcpy(ieee->geo.bg, geo->bg, geo->bg_channels * 143 memcpy(ieee->geo.bg, geo->bg, geo->bg_channels *
144 sizeof(struct ieee80211_channel)); 144 sizeof(struct libipw_channel));
145 memcpy(ieee->geo.a, geo->a, ieee->geo.a_channels * 145 memcpy(ieee->geo.a, geo->a, ieee->geo.a_channels *
146 sizeof(struct ieee80211_channel)); 146 sizeof(struct libipw_channel));
147 return 0; 147 return 0;
148} 148}
149 149
150const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device *ieee) 150const struct libipw_geo *libipw_get_geo(struct libipw_device *ieee)
151{ 151{
152 return &ieee->geo; 152 return &ieee->geo;
153} 153}
154 154
155u8 ieee80211_get_channel_flags(struct ieee80211_device * ieee, u8 channel) 155u8 libipw_get_channel_flags(struct libipw_device * ieee, u8 channel)
156{ 156{
157 int index = ieee80211_channel_to_index(ieee, channel); 157 int index = libipw_channel_to_index(ieee, channel);
158 158
159 if (index == -1) 159 if (index == -1)
160 return IEEE80211_CH_INVALID; 160 return LIBIPW_CH_INVALID;
161 161
162 if (channel <= IEEE80211_24GHZ_CHANNELS) 162 if (channel <= LIBIPW_24GHZ_CHANNELS)
163 return ieee->geo.bg[index].flags; 163 return ieee->geo.bg[index].flags;
164 164
165 return ieee->geo.a[index].flags; 165 return ieee->geo.a[index].flags;
166} 166}
167 167
168static const struct ieee80211_channel bad_channel = { 168static const struct libipw_channel bad_channel = {
169 .channel = 0, 169 .channel = 0,
170 .flags = IEEE80211_CH_INVALID, 170 .flags = LIBIPW_CH_INVALID,
171 .max_power = 0, 171 .max_power = 0,
172}; 172};
173 173
174const struct ieee80211_channel *ieee80211_get_channel(struct ieee80211_device 174const struct libipw_channel *libipw_get_channel(struct libipw_device
175 *ieee, u8 channel) 175 *ieee, u8 channel)
176{ 176{
177 int index = ieee80211_channel_to_index(ieee, channel); 177 int index = libipw_channel_to_index(ieee, channel);
178 178
179 if (index == -1) 179 if (index == -1)
180 return &bad_channel; 180 return &bad_channel;
181 181
182 if (channel <= IEEE80211_24GHZ_CHANNELS) 182 if (channel <= LIBIPW_24GHZ_CHANNELS)
183 return &ieee->geo.bg[index]; 183 return &ieee->geo.bg[index];
184 184
185 return &ieee->geo.a[index]; 185 return &ieee->geo.a[index];
186} 186}
187 187
188EXPORT_SYMBOL(ieee80211_get_channel); 188EXPORT_SYMBOL(libipw_get_channel);
189EXPORT_SYMBOL(ieee80211_get_channel_flags); 189EXPORT_SYMBOL(libipw_get_channel_flags);
190EXPORT_SYMBOL(ieee80211_is_valid_channel); 190EXPORT_SYMBOL(libipw_is_valid_channel);
191EXPORT_SYMBOL(ieee80211_freq_to_channel); 191EXPORT_SYMBOL(libipw_freq_to_channel);
192EXPORT_SYMBOL(ieee80211_channel_to_freq); 192EXPORT_SYMBOL(libipw_channel_to_freq);
193EXPORT_SYMBOL(ieee80211_channel_to_index); 193EXPORT_SYMBOL(libipw_channel_to_index);
194EXPORT_SYMBOL(ieee80211_set_geo); 194EXPORT_SYMBOL(libipw_set_geo);
195EXPORT_SYMBOL(ieee80211_get_geo); 195EXPORT_SYMBOL(libipw_get_geo);