mac80211: use ieee80211_get_channel
authorJohannes Berg <johannes@sipsolutions.net>
Sun, 16 Mar 2008 17:35:56 +0000 (18:35 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 25 Mar 2008 20:41:55 +0000 (16:41 -0400)
Use the new ieee80211_get_channel() function instead of open-coding it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/ieee80211_ioctl.c

index 1d91575a0fe93b89a66075ec7f8b93982ef2294a..8e8e5a19d8937c0e1c621f878db67c7db58f18b9 100644 (file)
@@ -279,35 +279,14 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev,
 
 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];
+       struct ieee80211_channel *chan;
 
-               if (!sband)
-                       continue;
+       chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);
 
-               for (i = 0; i < sband->n_channels; i++) {
-                       struct ieee80211_channel *chan = &sband->channels[i];
-
-                       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