projects
/
deliverable
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wireless: Add channel/frequency conversions to ieee80211.h
[deliverable/linux.git]
/
drivers
/
net
/
wireless
/
orinoco
/
orinoco.c
diff --git
a/drivers/net/wireless/orinoco/orinoco.c
b/drivers/net/wireless/orinoco/orinoco.c
index 45a04faa7818e7ead799eeee65030bd08ede0592..beb4d1f8c184b050de7f55a13da7ea45e7bb3072 100644
(file)
--- a/
drivers/net/wireless/orinoco/orinoco.c
+++ b/
drivers/net/wireless/orinoco/orinoco.c
@@
-178,12
+178,7
@@
static const struct ethtool_ops orinoco_ethtool_ops;
/* Data tables */
/********************************************************************/
/* Data tables */
/********************************************************************/
-/* The frequency of each channel in MHz */
-static const long channel_frequency[] = {
- 2412, 2417, 2422, 2427, 2432, 2437, 2442,
- 2447, 2452, 2457, 2462, 2467, 2472, 2484
-};
-#define NUM_CHANNELS ARRAY_SIZE(channel_frequency)
+#define NUM_CHANNELS 14
/* This tables gives the actual meanings of the bitrate IDs returned
* by the firmware. */
/* This tables gives the actual meanings of the bitrate IDs returned
* by the firmware. */
@@
-3742,13
+3737,13
@@
static int orinoco_hw_get_essid(struct orinoco_private *priv, int *active,
return err;
}
return err;
}
-static
long
orinoco_hw_get_freq(struct orinoco_private *priv)
+static
int
orinoco_hw_get_freq(struct orinoco_private *priv)
{
hermes_t *hw = &priv->hw;
int err = 0;
u16 channel;
{
hermes_t *hw = &priv->hw;
int err = 0;
u16 channel;
-
long
freq = 0;
+
int
freq = 0;
unsigned long flags;
if (orinoco_lock(priv, &flags) != 0)
unsigned long flags;
if (orinoco_lock(priv, &flags) != 0)
@@
-3771,7
+3766,7
@@
static long orinoco_hw_get_freq(struct orinoco_private *priv)
goto out;
}
goto out;
}
- freq =
channel_frequency[channel-1] * 100000
;
+ freq =
ieee80211_dsss_chan_to_freq(channel)
;
out:
orinoco_unlock(priv, &flags);
out:
orinoco_unlock(priv, &flags);
@@
-3998,7
+3993,8
@@
static int orinoco_ioctl_getiwrange(struct net_device *dev,
for (i = 0; i < NUM_CHANNELS; i++) {
if (priv->channel_mask & (1 << i)) {
range->freq[k].i = i + 1;
for (i = 0; i < NUM_CHANNELS; i++) {
if (priv->channel_mask & (1 << i)) {
range->freq[k].i = i + 1;
- range->freq[k].m = channel_frequency[i] * 100000;
+ range->freq[k].m = (ieee80211_dsss_chan_to_freq(i + 1) *
+ 100000);
range->freq[k].e = 1;
k++;
}
range->freq[k].e = 1;
k++;
}
@@
-4346,16
+4342,15
@@
static int orinoco_ioctl_setfreq(struct net_device *dev,
/* Setting by channel number */
chan = frq->m;
} else {
/* Setting by channel number */
chan = frq->m;
} else {
- /* Setting by frequency
- search the table
*/
- int
mult
= 1;
+ /* Setting by frequency */
+ int
denom
= 1;
int i;
int i;
+ /* Calculate denominator to rescale to MHz */
for (i = 0; i < (6 - frq->e); i++)
for (i = 0; i < (6 - frq->e); i++)
-
mult
*= 10;
+
denom
*= 10;
- for (i = 0; i < NUM_CHANNELS; i++)
- if (frq->m == (channel_frequency[i] * mult))
- chan = i+1;
+ chan = ieee80211_freq_to_dsss_chan(frq->m / denom);
}
if ( (chan < 1) || (chan > NUM_CHANNELS) ||
}
if ( (chan < 1) || (chan > NUM_CHANNELS) ||
@@
-4392,7
+4387,7
@@
static int orinoco_ioctl_getfreq(struct net_device *dev,
return tmp;
}
return tmp;
}
- frq->m = tmp;
+ frq->m = tmp
* 100000
;
frq->e = 1;
return 0;
frq->e = 1;
return 0;
@@
-5609,7
+5604,7
@@
static inline char *orinoco_translate_scan(struct net_device *dev,
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
&iwe, IW_EV_FREQ_LEN);
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
&iwe, IW_EV_FREQ_LEN);
- iwe.u.freq.m =
channel_frequency[channel-1]
* 100000;
+ iwe.u.freq.m =
ieee80211_dsss_chan_to_freq(channel)
* 100000;
iwe.u.freq.e = 1;
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
&iwe, IW_EV_FREQ_LEN);
iwe.u.freq.e = 1;
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
&iwe, IW_EV_FREQ_LEN);
@@
-5760,7
+5755,7
@@
static inline char *orinoco_translate_ext_scan(struct net_device *dev,
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
&iwe, IW_EV_FREQ_LEN);
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
&iwe, IW_EV_FREQ_LEN);
- iwe.u.freq.m =
channel_frequency[channel-1]
* 100000;
+ iwe.u.freq.m =
ieee80211_dsss_chan_to_freq(channel)
* 100000;
iwe.u.freq.e = 1;
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
&iwe, IW_EV_FREQ_LEN);
iwe.u.freq.e = 1;
current_ev = iwe_stream_add_event(info, current_ev, end_buf,
&iwe, IW_EV_FREQ_LEN);
This page took
0.043033 seconds
and
5
git commands to generate.