From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>
Subject: [PATCH] mac80211: use ieee80211_get_channel
Date: Sun, 16 Mar 2008 18:35:56 +0100 [thread overview]
Message-ID: <1205688956.3878.5.camel@johannes.berg> (raw)
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
reply other threads:[~2008-03-16 17:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1205688956.3878.5.camel@johannes.berg \
--to=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox