Linux wireless drivers development
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
To: Janusz Dziedzic <janusz.dziedzic@tieto.com>
Cc: linux-wireless@vger.kernel.org, johannes@sipsolutions.net,
	Janusz Dziedzic <janusz.dziedzi@tieto.com>
Subject: Re: [PATCH v2 1/3] cfg80211: add helper reg_get_regdomain() function
Date: Fri, 24 Jan 2014 16:34:20 -0800	[thread overview]
Message-ID: <20140125003418.GF28512@garbanzo.do-not-panic.com> (raw)
In-Reply-To: <1390394624-3927-1-git-send-email-janusz.dziedzic@tieto.com>

On Wed, Jan 22, 2014 at 01:43:42PM +0100, Janusz Dziedzic wrote:
> Add helper function that will return regdomain.
> Follow the driver's regulatory domain, if present,
> unless a country IE has been processed or a user
> wants to help complaince further.
> 
> Signed-off-by: Janusz Dziedzic <janusz.dziedzi@tieto.com>
> ---
>  net/wireless/reg.c |   31 ++++++++++++++++++++-----------
>  1 file changed, 20 insertions(+), 11 deletions(-)
> 
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index 9b897fc..d58a09c 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -522,6 +522,25 @@ bool reg_is_valid_request(const char *alpha2)
>  	return alpha2_equal(lr->alpha2, alpha2);
>  }
>  
> +static const struct ieee80211_regdomain *reg_get_regdomain(struct wiphy *wiphy)
> +{
> +	const struct ieee80211_regdomain *regd;
> +	struct regulatory_request *lr = get_last_request();
> +
> +	/*
> +	 * Follow the driver's regulatory domain, if present, unless a country
> +	 * IE has been processed or a user wants to help complaince further
> +	 */
> +	if (lr->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
> +	    lr->initiator != NL80211_REGDOM_SET_BY_USER &&
> +	    wiphy->regd)
> +		regd = get_wiphy_regdom(wiphy);
> +	else
> +		regd = get_cfg80211_regdom();
> +
> +	return regd;
> +}
> +
>  /* Sanity check on a regulatory rule */
>  static bool is_valid_reg_rule(const struct ieee80211_reg_rule *rule)
>  {
> @@ -821,18 +840,8 @@ const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
>  					       u32 center_freq)
>  {
>  	const struct ieee80211_regdomain *regd;
> -	struct regulatory_request *lr = get_last_request();
>  
> -	/*
> -	 * Follow the driver's regulatory domain, if present, unless a country
> -	 * IE has been processed or a user wants to help complaince further
> -	 */
> -	if (lr->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
> -	    lr->initiator != NL80211_REGDOM_SET_BY_USER &&
> -	    wiphy->regd)
> -		regd = get_wiphy_regdom(wiphy);
> -	else
> -		regd = get_cfg80211_regdom();
> +	regd = reg_get_regdomain(wiphy);

Nice! I welcome this -- can you also add nl80211 API to expose when
a wiphy has its own wiphy->regd and send that to userspace too?

  Luis

  parent reply	other threads:[~2014-01-25  0:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-22 12:43 [PATCH v2 1/3] cfg80211: add helper reg_get_regdomain() function Janusz Dziedzic
2014-01-22 12:43 ` [PATCH v2 2/3] cfg80211: introduce regulatory wide bandwidth flag Janusz Dziedzic
2014-01-23 15:57   ` Johannes Berg
2014-01-25  0:32     ` Luis R. Rodriguez
2014-01-25  0:36       ` Luis R. Rodriguez
2014-01-25 10:29         ` Janusz Dziedzic
2014-01-29 13:10       ` Johannes Berg
2014-01-30  0:41         ` Luis R. Rodriguez
2014-01-31 13:42           ` Johannes Berg
2014-01-22 12:43 ` [PATCH v2 3/3] cfg80211: parse WIDE-BW flag for internal regdb option Janusz Dziedzic
2014-01-25  0:34 ` Luis R. Rodriguez [this message]
2014-01-28 19:23   ` [PATCH v2 1/3] cfg80211: add helper reg_get_regdomain() function Janusz Dziedzic
2014-01-28 19:42     ` Luis R. Rodriguez
2014-01-29  8:17       ` Johannes Berg
2014-01-29  9:44         ` Luis R. Rodriguez
2014-01-29  9:46           ` Luis R. Rodriguez
2014-01-29  9:58             ` 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=20140125003418.GF28512@garbanzo.do-not-panic.com \
    --to=mcgrof@do-not-panic.com \
    --cc=janusz.dziedzi@tieto.com \
    --cc=janusz.dziedzic@tieto.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