aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/atmel.c
diff options
context:
space:
mode:
authorDavid Kilroy <kilroyd@googlemail.com>2008-12-23 09:03:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:58:46 -0500
commit9ee677c2276bfcbcf68042ec2718a504af0c5fd7 (patch)
tree0b5528241690e143c60832d319ddbb2ad1c5d7f1 /drivers/net/wireless/atmel.c
parenteaee7cc2c180c291084a1c1f49cd2bf13002b3e1 (diff)
wireless: Add channel/frequency conversions to ieee80211.h
Added mappings for FHSS, DSSS and OFDM channels - with macros to point HR DSSS and ERP to the DSSS mappings. Currently just static inline functions. Use the new functions in the older fullmac drivers. This eliminates a number of const static buffers and removes a couple of range checks that are now redundant. Signed-off-by: David Kilroy <kilroyd@googlemail.com> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Acked-by: Richard Farina <sidhayn@gmail.com> Acked-by: Jeroen Vreeken <pe1rxq@amsat.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/atmel.c')
-rw-r--r--drivers/net/wireless/atmel.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 4223672c4432..91930a2c3c6b 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -2204,9 +2204,6 @@ static int atmel_get_frag(struct net_device *dev,
2204 return 0; 2204 return 0;
2205} 2205}
2206 2206
2207static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442,
2208 2447, 2452, 2457, 2462, 2467, 2472, 2484 };
2209
2210static int atmel_set_freq(struct net_device *dev, 2207static int atmel_set_freq(struct net_device *dev,
2211 struct iw_request_info *info, 2208 struct iw_request_info *info,
2212 struct iw_freq *fwrq, 2209 struct iw_freq *fwrq,
@@ -2216,16 +2213,12 @@ static int atmel_set_freq(struct net_device *dev,
2216 int rc = -EINPROGRESS; /* Call commit handler */ 2213 int rc = -EINPROGRESS; /* Call commit handler */
2217 2214
2218 /* If setting by frequency, convert to a channel */ 2215 /* If setting by frequency, convert to a channel */
2219 if ((fwrq->e == 1) && 2216 if (fwrq->e == 1) {
2220 (fwrq->m >= (int) 241200000) &&
2221 (fwrq->m <= (int) 248700000)) {
2222 int f = fwrq->m / 100000; 2217 int f = fwrq->m / 100000;
2223 int c = 0; 2218
2224 while ((c < 14) && (f != frequency_list[c]))
2225 c++;
2226 /* Hack to fall through... */ 2219 /* Hack to fall through... */
2227 fwrq->e = 0; 2220 fwrq->e = 0;
2228 fwrq->m = c + 1; 2221 fwrq->m = ieee80211_freq_to_dsss_chan(f);
2229 } 2222 }
2230 /* Setting by channel number */ 2223 /* Setting by channel number */
2231 if ((fwrq->m > 1000) || (fwrq->e > 0)) 2224 if ((fwrq->m > 1000) || (fwrq->e > 0))
@@ -2384,8 +2377,11 @@ static int atmel_get_range(struct net_device *dev,
2384 if (range->num_channels != 0) { 2377 if (range->num_channels != 0) {
2385 for (k = 0, i = channel_table[j].min; i <= channel_table[j].max; i++) { 2378 for (k = 0, i = channel_table[j].min; i <= channel_table[j].max; i++) {
2386 range->freq[k].i = i; /* List index */ 2379 range->freq[k].i = i; /* List index */
2387 range->freq[k].m = frequency_list[i - 1] * 100000; 2380
2388 range->freq[k++].e = 1; /* Values in table in MHz -> * 10^5 * 10 */ 2381 /* Values in MHz -> * 10^5 * 10 */
2382 range->freq[k].m = (ieee80211_dsss_chan_to_freq(i) *
2383 100000);
2384 range->freq[k++].e = 1;
2389 } 2385 }
2390 range->num_frequency = k; 2386 range->num_frequency = k;
2391 } 2387 }