Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134941
b: refs/heads/master
c: d951c1d
h: refs/heads/master
i:
  134939: 3d3f4db
v: v3
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Feb 27, 2009
1 parent f366fcd commit 22efd67
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 39 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 28da32d7cafdd181d6a59e8c0b74e9651a8f8be3
refs/heads/master: d951c1ddeba3c84c464069c808efc494aa705304
54 changes: 16 additions & 38 deletions trunk/net/wireless/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,6 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
static int __regulatory_hint(struct wiphy *wiphy,
struct regulatory_request *pending_request)
{
struct regulatory_request *request;
bool intersect = false;
int r = 0;

Expand All @@ -1354,8 +1353,10 @@ static int __regulatory_hint(struct wiphy *wiphy,
if (r == REG_INTERSECT) {
if (pending_request->initiator == REGDOM_SET_BY_DRIVER) {
r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain);
if (r)
if (r) {
kfree(pending_request);
return r;
}
}
intersect = true;
} else if (r) {
Expand All @@ -1367,30 +1368,24 @@ static int __regulatory_hint(struct wiphy *wiphy,
if (r == -EALREADY &&
pending_request->initiator == REGDOM_SET_BY_DRIVER) {
r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain);
if (r)
if (r) {
kfree(pending_request);
return r;
}
r = -EALREADY;
goto new_request;
}
kfree(pending_request);
return r;
}

new_request:
request = kzalloc(sizeof(struct regulatory_request),
GFP_KERNEL);
if (!request)
return -ENOMEM;
kfree(last_request);

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 = pending_request->country_ie_checksum;
request->country_ie_env = pending_request->country_ie_env;
last_request = pending_request;
last_request->intersect = intersect;

kfree(last_request);
last_request = request;
pending_request = NULL;

/* When r == REG_INTERSECT we do need to call CRDA */
if (r < 0)
Expand All @@ -1406,11 +1401,11 @@ static int __regulatory_hint(struct wiphy *wiphy,
*
* to intersect with the static rd
*/
return call_crda(request->alpha2);
return call_crda(last_request->alpha2);
}

/* This currently only processes user and driver regulatory hints */
static int reg_process_hint(struct regulatory_request *reg_request)
static void reg_process_hint(struct regulatory_request *reg_request)
{
int r = 0;
struct wiphy *wiphy = NULL;
Expand All @@ -1424,7 +1419,7 @@ static int reg_process_hint(struct regulatory_request *reg_request)

if (reg_request->initiator == REGDOM_SET_BY_DRIVER &&
!wiphy) {
r = -ENODEV;
kfree(reg_request);
goto out;
}

Expand All @@ -1434,39 +1429,22 @@ static int reg_process_hint(struct regulatory_request *reg_request)
wiphy_update_regulatory(wiphy, reg_request->initiator);
out:
mutex_unlock(&cfg80211_mutex);

if (r == -EALREADY)
r = 0;

return r;
}

/* Processes regulatory hints, this is all the REGDOM_SET_BY_* */
static void reg_process_pending_hints(void)
{
struct regulatory_request *reg_request;
int r;

spin_lock(&reg_requests_lock);
while (!list_empty(&reg_requests_list)) {
reg_request = list_first_entry(&reg_requests_list,
struct regulatory_request,
list);
list_del_init(&reg_request->list);
spin_unlock(&reg_requests_lock);

r = reg_process_hint(reg_request);
#ifdef CONFIG_CFG80211_REG_DEBUG
if (r && (reg_request->initiator == REGDOM_SET_BY_DRIVER ||
reg_request->initiator == REGDOM_SET_BY_COUNTRY_IE))
printk(KERN_ERR "cfg80211: wiphy_idx %d sent a "
"regulatory hint for %c%c but now has "
"gone fishing, ignoring request\n",
reg_request->wiphy_idx,
reg_request->alpha2[0],
reg_request->alpha2[1]);
#endif
kfree(reg_request);
spin_unlock(&reg_requests_lock);
reg_process_hint(reg_request);
spin_lock(&reg_requests_lock);
}
spin_unlock(&reg_requests_lock);
Expand Down

0 comments on commit 22efd67

Please sign in to comment.