* [PATCH] mac80211: use ieee80211_get_channel
@ 2008-03-16 17:35 Johannes Berg
0 siblings, 0 replies; only message in thread
From: Johannes Berg @ 2008-03-16 17:35 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
Use the new ieee80211_get_channel() function instead of open-coding it.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
net/mac80211/ieee80211_ioctl.c | 29 ++++-------------------------
1 file changed, 4 insertions(+), 25 deletions(-)
--- everything.orig/net/mac80211/ieee80211_ioctl.c 2008-03-16 18:24:36.000000000 +0100
+++ everything/net/mac80211/ieee80211_ioctl.c 2008-03-16 18:26:41.000000000 +0100
@@ -282,35 +282,14 @@ static int ieee80211_ioctl_giwmode(struc
int ieee80211_set_freq(struct ieee80211_local *local, int freqMHz)
{
- int set = 0;
int ret = -EINVAL;
- enum ieee80211_band band;
- struct ieee80211_supported_band *sband;
- int i;
-
- for (band = 0; band < IEEE80211_NUM_BANDS; band ++) {
- sband = local->hw.wiphy->bands[band];
-
- if (!sband)
- continue;
+ struct ieee80211_channel *chan;
- for (i = 0; i < sband->n_channels; i++) {
- struct ieee80211_channel *chan = &sband->channels[i];
+ chan = ieee80211_get_channel(&local->hw.wiphy, freqMHz);
- if (chan->flags & IEEE80211_CHAN_DISABLED)
- continue;
-
- if (chan->center_freq == freqMHz) {
- set = 1;
- local->oper_channel = chan;
- break;
- }
- }
- if (set)
- break;
- }
+ if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
+ local->oper_channel = chan;
- if (set) {
if (local->sta_sw_scanning)
ret = 0;
else
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-03-16 17:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-16 17:35 [PATCH] mac80211: use ieee80211_get_channel Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox