public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: "Luis R. Rodriguez" <lrodriguez@atheros.com>
To: linville@tuxdriver.com, johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org,
	"Luis R. Rodriguez" <lrodriguez@atheros.com>
Subject: [PATCH 2/4] cfg80211: pass the regulatory_request struct in __regulatory_hint()
Date: Sat, 21 Feb 2009 00:24:14 -0500	[thread overview]
Message-ID: <1235193856-3524-3-git-send-email-lrodriguez@atheros.com> (raw)
In-Reply-To: <1235193856-3524-1-git-send-email-lrodriguez@atheros.com>

We were passing value by value, lets just pass the struct.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 net/wireless/reg.c |   45 ++++++++++++++++++---------------------------
 1 files changed, 18 insertions(+), 27 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 0253d01..6e17337 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1328,26 +1328,18 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
  * __regulatory_hint - hint to the wireless core a regulatory domain
  * @wiphy: if the hint comes from country information from an AP, this
  *	is required to be set to the wiphy that received the information
- * @alpha2: the ISO/IEC 3166 alpha2 being claimed the regulatory domain
- *	should be in.
- * @country_ie_checksum: checksum of processed country IE, set this to 0
- * 	if the hint did not come from a country IE
- * @country_ie_env: the environment the IE told us we are in, %ENVIRON_*
+ * @pending_request: the regulatory request currently being processed
  *
  * The Wireless subsystem can use this function to hint to the wireless core
- * what it believes should be the current regulatory domain by giving it an
- * ISO/IEC 3166 alpha2 country code it knows its regulatory domain should be
- * in.
+ * what it believes should be the current regulatory domain.
  *
  * Returns zero if all went fine, %-EALREADY if a regulatory domain had
  * already been set or other standard error codes.
  *
  * Caller must hold &cfg80211_mutex
  */
-static int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
-			const char *alpha2,
-			u32 country_ie_checksum,
-			enum environment_cap env)
+static int __regulatory_hint(struct wiphy *wiphy,
+			     struct regulatory_request *pending_request)
 {
 	struct regulatory_request *request;
 	bool intersect = false;
@@ -1355,10 +1347,12 @@ static int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
 
 	assert_cfg80211_lock();
 
-	r = ignore_request(wiphy, set_by, alpha2);
+	r = ignore_request(wiphy,
+			  pending_request->initiator,
+			  pending_request->alpha2);
 
 	if (r == REG_INTERSECT) {
-		if (set_by == REGDOM_SET_BY_DRIVER) {
+		if (pending_request->initiator == REGDOM_SET_BY_DRIVER) {
 			r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain);
 			if (r)
 				return r;
@@ -1370,7 +1364,8 @@ static int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
 		 * driver has already been set just copy it to the
 		 * wiphy
 		 */
-		if (r == -EALREADY && set_by == REGDOM_SET_BY_DRIVER) {
+		if (r == -EALREADY &&
+		    pending_request->initiator == REGDOM_SET_BY_DRIVER) {
 			r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain);
 			if (r)
 				return r;
@@ -1386,13 +1381,13 @@ new_request:
 	if (!request)
 		return -ENOMEM;
 
-	request->alpha2[0] = alpha2[0];
-	request->alpha2[1] = alpha2[1];
-	request->initiator = set_by;
-	request->wiphy_idx = get_wiphy_idx(wiphy);
+	request->alpha2[0] = pending_request->alpha2[0];
+	request->alpha2[1] = pending_request->alpha2[1];
+	request->initiator = pending_request->initiator;
+	request->wiphy_idx = pending_request->wiphy_idx;
 	request->intersect = intersect;
-	request->country_ie_checksum = country_ie_checksum;
-	request->country_ie_env = env;
+	request->country_ie_checksum = pending_request->country_ie_checksum;
+	request->country_ie_env = pending_request->country_ie_env;
 
 	kfree(last_request);
 	last_request = request;
@@ -1411,7 +1406,7 @@ new_request:
 	 *
 	 * to intersect with the static rd
 	 */
-	return call_crda(alpha2);
+	return call_crda(request->alpha2);
 }
 
 /* This currently only processes user and driver regulatory hints */
@@ -1433,11 +1428,7 @@ static int reg_process_hint(struct regulatory_request *reg_request)
 		goto out;
 	}
 
-	r = __regulatory_hint(wiphy,
-			      reg_request->initiator,
-			      reg_request->alpha2,
-			      reg_request->country_ie_checksum,
-			      reg_request->country_ie_env);
+	r = __regulatory_hint(wiphy, reg_request);
 	/* This is required so that the orig_* parameters are saved */
 	if (r == -EALREADY && wiphy && wiphy->strict_regulatory)
 		wiphy_update_regulatory(wiphy, reg_request->initiator);
-- 
1.6.0.3


  parent reply	other threads:[~2009-02-21  5:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-21  5:24 [PATCH 0/4] cfg80211: few minor enhancements based on reg requests Luis R. Rodriguez
2009-02-21  5:24 ` [PATCH 1/4] cfg80211: make __regulatory_hint() static Luis R. Rodriguez
2009-02-21  5:24 ` Luis R. Rodriguez [this message]
2009-02-21  5:24 ` [PATCH 3/4] cfg80211: do not kzalloc() again for a new request on __regulatory_hint Luis R. Rodriguez
2009-02-21  5:24 ` [PATCH 4/4] cfg80211: pass the regulatory_request to ignore_request Luis R. Rodriguez
2009-02-24  2:00 ` [PATCH 0/4] cfg80211: few minor enhancements based on reg requests 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=1235193856-3524-3-git-send-email-lrodriguez@atheros.com \
    --to=lrodriguez@atheros.com \
    --cc=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