Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e048c6e4 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville
Browse files

mac80211: use ieee80211_get_channel



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

Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 906c730a
Loading
Loading
Loading
Loading
+4 −25
Original line number Diff line number Diff line
@@ -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;
	struct ieee80211_channel *chan;

	for (band = 0; band < IEEE80211_NUM_BANDS; band ++) {
		sband = local->hw.wiphy->bands[band];
	chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);

		if (!sband)
			continue;

		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;
	if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
		local->oper_channel = chan;
				break;
			}
		}
		if (set)
			break;
	}

	if (set) {
		if (local->sta_sw_scanning)
			ret = 0;
		else