From: Mahesh Palivela <maheshp@posedge.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: <linux-wireless@vger.kernel.org>,
Johannes Berg <johannes.berg@intel.com>
Subject: Re: [RFC v2 4/8] nl80211/cfg80211: support VHT channel configuration
Date: Tue, 20 Nov 2012 13:57:13 +0530 [thread overview]
Message-ID: <50AB3EE1.8060101@posedge.com> (raw)
In-Reply-To: <1352492254-29399-5-git-send-email-johannes@sipsolutions.net>
On 11/10/2012 01:47 AM, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> diff --git a/net/wireless/chan.c b/net/wireless/chan.c
> +static bool cfg80211_check_beacon_chans(struct wiphy *wiphy,
> + u32 center_freq, u32 bw)
> +{
> + struct ieee80211_channel *c;
> + u32 freq;
> +
> + for (freq = center_freq - bw/2 + 10;
> + freq <= center_freq + bw/2 - 10;
> + freq += 20) {
> + c = ieee80211_get_channel(wiphy, freq);
> + if (!c || c->flags & (IEEE80211_CHAN_DISABLED |
> + IEEE80211_CHAN_PASSIVE_SCAN |
> + IEEE80211_CHAN_NO_IBSS |
> + IEEE80211_CHAN_RADAR))
> + return false;
> }
>
> - sec_chan = ieee80211_get_channel(wiphy,
> - chandef->chan->center_freq + diff);
> - if (!sec_chan) {
> + return true;
> +}
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> +static int nl80211_check_sec_chans(struct cfg80211_registered_device *rdev,
> + u32 center_freq, u32 bw)
> {
> - enum nl80211_channel_type tmp;
> -
> - if (!info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE])
> - return false;
> + struct ieee80211_channel *c;
> + u32 freq;
>
> - tmp = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]);
> - if (tmp != NL80211_CHAN_NO_HT &&
> - tmp != NL80211_CHAN_HT20 &&
> - tmp != NL80211_CHAN_HT40PLUS &&
> - tmp != NL80211_CHAN_HT40MINUS)
> - return false;
> -
> - if (channel_type)
> - *channel_type = tmp;
> + for (freq = center_freq - bw/2 + 10;
> + freq <= center_freq + bw/2 - 10;
> + freq += 20) {
> + c = ieee80211_get_channel(&rdev->wiphy, freq);
> + if (!c || c->flags & IEEE80211_CHAN_DISABLED)
> + return -EINVAL;
> + }
>
> - return true;
> + return 0;
> }
For loops in both functions seems to be similar. One return false, other
return -EINVAL. Can we remove duplication?
next prev parent reply other threads:[~2012-11-20 8:27 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-09 20:17 VHT support, take 2 Johannes Berg
2012-11-09 20:17 ` [RFC v2 1/8] cfg80211: remove remain-on-channel channel type Johannes Berg
2012-11-09 20:17 ` [RFC v2 2/8] nl80211: add documentation for " Johannes Berg
2012-11-15 11:00 ` Mahesh Palivela
2012-11-15 12:09 ` Johannes Berg
2012-11-09 20:17 ` [RFC v2 3/8] cfg80211: pass a channel definition struct Johannes Berg
2012-11-09 20:17 ` [RFC v2 4/8] nl80211/cfg80211: support VHT channel configuration Johannes Berg
2012-11-12 10:55 ` Johannes Berg
2012-11-16 12:21 ` Mahesh Palivela
2012-11-16 12:37 ` Johannes Berg
2012-11-19 4:18 ` Mahesh Palivela
2012-11-19 8:33 ` Johannes Berg
2012-11-19 12:18 ` Mahesh Palivela
2012-11-19 14:11 ` Johannes Berg
2012-11-20 6:03 ` Mahesh Palivela
2012-11-20 7:27 ` Johannes Berg
2012-11-20 8:27 ` Mahesh Palivela [this message]
2012-11-20 8:41 ` Johannes Berg
2012-11-20 9:39 ` Johannes Berg
2012-11-20 11:59 ` Mahesh Palivela
2012-11-20 12:21 ` Johannes Berg
2012-11-20 12:56 ` Mahesh Palivela
2012-11-09 20:17 ` [RFC v2 5/8] mac80211: convert to channel definition struct Johannes Berg
2012-11-09 20:17 ` [RFC v2 6/8] nl80211/cfg80211: add VHT MCS support Johannes Berg
2012-11-09 20:17 ` [RFC v2 7/8] mac80211: support drivers reporting VHT RX Johannes Berg
2012-11-09 20:17 ` [RFC v2 8/8] mac80211: support VHT rates in TX info Johannes Berg
2012-11-09 20:21 ` VHT support, take 2 Johannes Berg
2012-11-15 12:09 ` Mahesh Palivela
2012-11-16 13:28 ` Johannes Berg
2012-11-16 14:57 ` Arend van Spriel
2012-11-17 0:10 ` Luis R. Rodriguez
2012-11-17 8:48 ` Johannes Berg
2012-11-17 23:34 ` Luis R. Rodriguez
2012-11-18 11:03 ` Johannes Berg
2012-11-18 11:05 ` Johannes Berg
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=50AB3EE1.8060101@posedge.com \
--to=maheshp@posedge.com \
--cc=johannes.berg@intel.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).