Search Linux Wireless

[PATCH] mac80211: use ieee80211_get_channel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the new ieee80211_get_channel() function instead of open-coding it.

Signed-off-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
---
 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


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux