Commit 1a919318 authored by Johannes Berg's avatar Johannes Berg

regulatory: code cleanup

Clean up various things like indentation, extra
parentheses, too many/few line breaks, etc.
Acked-by: default avatarLuis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 75e2dba8
...@@ -4259,7 +4259,7 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) ...@@ -4259,7 +4259,7 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
dfs_region = nla_get_u8(info->attrs[NL80211_ATTR_DFS_REGION]); dfs_region = nla_get_u8(info->attrs[NL80211_ATTR_DFS_REGION]);
nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES], nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES],
rem_reg_rules) { rem_reg_rules) {
num_rules++; num_rules++;
if (num_rules > NL80211_MAX_SUPP_REG_RULES) if (num_rules > NL80211_MAX_SUPP_REG_RULES)
return -EINVAL; return -EINVAL;
...@@ -4273,7 +4273,7 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) ...@@ -4273,7 +4273,7 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
} }
size_of_regd = sizeof(struct ieee80211_regdomain) + size_of_regd = sizeof(struct ieee80211_regdomain) +
(num_rules * sizeof(struct ieee80211_reg_rule)); num_rules * sizeof(struct ieee80211_reg_rule);
rd = kzalloc(size_of_regd, GFP_KERNEL); rd = kzalloc(size_of_regd, GFP_KERNEL);
if (!rd) { if (!rd) {
...@@ -4293,10 +4293,10 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) ...@@ -4293,10 +4293,10 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
rd->dfs_region = dfs_region; rd->dfs_region = dfs_region;
nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES], nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES],
rem_reg_rules) { rem_reg_rules) {
nla_parse(tb, NL80211_REG_RULE_ATTR_MAX, nla_parse(tb, NL80211_REG_RULE_ATTR_MAX,
nla_data(nl_reg_rule), nla_len(nl_reg_rule), nla_data(nl_reg_rule), nla_len(nl_reg_rule),
reg_rule_policy); reg_rule_policy);
r = parse_reg_rule(tb, &rd->reg_rules[rule_idx]); r = parse_reg_rule(tb, &rd->reg_rules[rule_idx]);
if (r) if (r)
goto bad_reg; goto bad_reg;
...@@ -4312,10 +4312,7 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) ...@@ -4312,10 +4312,7 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
BUG_ON(rule_idx != num_rules); BUG_ON(rule_idx != num_rules);
r = set_regdom(rd); r = set_regdom(rd);
rd = NULL;
mutex_unlock(&cfg80211_mutex);
return r;
bad_reg: bad_reg:
mutex_unlock(&cfg80211_mutex); mutex_unlock(&cfg80211_mutex);
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#include <linux/export.h> #include <linux/export.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/random.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/nl80211.h> #include <linux/nl80211.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -219,18 +218,14 @@ bool is_world_regdom(const char *alpha2) ...@@ -219,18 +218,14 @@ bool is_world_regdom(const char *alpha2)
{ {
if (!alpha2) if (!alpha2)
return false; return false;
if (alpha2[0] == '0' && alpha2[1] == '0') return alpha2[0] == '0' && alpha2[1] == '0';
return true;
return false;
} }
static bool is_alpha2_set(const char *alpha2) static bool is_alpha2_set(const char *alpha2)
{ {
if (!alpha2) if (!alpha2)
return false; return false;
if (alpha2[0] != 0 && alpha2[1] != 0) return alpha2[0] && alpha2[1];
return true;
return false;
} }
static bool is_unknown_alpha2(const char *alpha2) static bool is_unknown_alpha2(const char *alpha2)
...@@ -241,9 +236,7 @@ static bool is_unknown_alpha2(const char *alpha2) ...@@ -241,9 +236,7 @@ static bool is_unknown_alpha2(const char *alpha2)
* Special case where regulatory domain was built by driver * Special case where regulatory domain was built by driver
* but a specific alpha2 cannot be determined * but a specific alpha2 cannot be determined
*/ */
if (alpha2[0] == '9' && alpha2[1] == '9') return alpha2[0] == '9' && alpha2[1] == '9';
return true;
return false;
} }
static bool is_intersected_alpha2(const char *alpha2) static bool is_intersected_alpha2(const char *alpha2)
...@@ -255,28 +248,21 @@ static bool is_intersected_alpha2(const char *alpha2) ...@@ -255,28 +248,21 @@ static bool is_intersected_alpha2(const char *alpha2)
* result of an intersection between two regulatory domain * result of an intersection between two regulatory domain
* structures * structures
*/ */
if (alpha2[0] == '9' && alpha2[1] == '8') return alpha2[0] == '9' && alpha2[1] == '8';
return true;
return false;
} }
static bool is_an_alpha2(const char *alpha2) static bool is_an_alpha2(const char *alpha2)
{ {
if (!alpha2) if (!alpha2)
return false; return false;
if (isalpha(alpha2[0]) && isalpha(alpha2[1])) return isalpha(alpha2[0]) && isalpha(alpha2[1]);
return true;
return false;
} }
static bool alpha2_equal(const char *alpha2_x, const char *alpha2_y) static bool alpha2_equal(const char *alpha2_x, const char *alpha2_y)
{ {
if (!alpha2_x || !alpha2_y) if (!alpha2_x || !alpha2_y)
return false; return false;
if (alpha2_x[0] == alpha2_y[0] && return alpha2_x[0] == alpha2_y[0] && alpha2_x[1] == alpha2_y[1];
alpha2_x[1] == alpha2_y[1])
return true;
return false;
} }
static bool regdom_changes(const char *alpha2) static bool regdom_changes(const char *alpha2)
...@@ -285,9 +271,7 @@ static bool regdom_changes(const char *alpha2) ...@@ -285,9 +271,7 @@ static bool regdom_changes(const char *alpha2)
if (!cfg80211_regdomain) if (!cfg80211_regdomain)
return true; return true;
if (alpha2_equal(cfg80211_regdomain->alpha2, alpha2)) return !alpha2_equal(cfg80211_regdomain->alpha2, alpha2);
return false;
return true;
} }
/* /*
...@@ -301,11 +285,9 @@ static bool is_user_regdom_saved(void) ...@@ -301,11 +285,9 @@ static bool is_user_regdom_saved(void)
return false; return false;
/* This would indicate a mistake on the design */ /* This would indicate a mistake on the design */
if (WARN((!is_world_regdom(user_alpha2) && if (WARN(!is_world_regdom(user_alpha2) && !is_an_alpha2(user_alpha2),
!is_an_alpha2(user_alpha2)),
"Unexpected user alpha2: %c%c\n", "Unexpected user alpha2: %c%c\n",
user_alpha2[0], user_alpha2[0], user_alpha2[1]))
user_alpha2[1]))
return false; return false;
return true; return true;
...@@ -359,10 +341,10 @@ static void reg_regdb_search(struct work_struct *work) ...@@ -359,10 +341,10 @@ static void reg_regdb_search(struct work_struct *work)
list); list);
list_del(&request->list); list_del(&request->list);
for (i=0; i<reg_regdb_size; i++) { for (i = 0; i < reg_regdb_size; i++) {
curdom = reg_regdb[i]; curdom = reg_regdb[i];
if (!memcmp(request->alpha2, curdom->alpha2, 2)) { if (alpha2_equal(request->alpha2, curdom->alpha2)) {
regdom = reg_copy_regd(curdom); regdom = reg_copy_regd(curdom);
break; break;
} }
...@@ -456,7 +438,7 @@ static bool is_valid_reg_rule(const struct ieee80211_reg_rule *rule) ...@@ -456,7 +438,7 @@ static bool is_valid_reg_rule(const struct ieee80211_reg_rule *rule)
freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz; freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz;
if (freq_range->end_freq_khz <= freq_range->start_freq_khz || if (freq_range->end_freq_khz <= freq_range->start_freq_khz ||
freq_range->max_bandwidth_khz > freq_diff) freq_range->max_bandwidth_khz > freq_diff)
return false; return false;
return true; return true;
...@@ -514,7 +496,7 @@ static bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range, ...@@ -514,7 +496,7 @@ static bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range,
* regulatory rule support for other "bands". * regulatory rule support for other "bands".
**/ **/
static bool freq_in_rule_band(const struct ieee80211_freq_range *freq_range, static bool freq_in_rule_band(const struct ieee80211_freq_range *freq_range,
u32 freq_khz) u32 freq_khz)
{ {
#define ONE_GHZ_IN_KHZ 1000000 #define ONE_GHZ_IN_KHZ 1000000
/* /*
...@@ -536,10 +518,9 @@ static bool freq_in_rule_band(const struct ieee80211_freq_range *freq_range, ...@@ -536,10 +518,9 @@ static bool freq_in_rule_band(const struct ieee80211_freq_range *freq_range,
* Helper for regdom_intersect(), this does the real * Helper for regdom_intersect(), this does the real
* mathematical intersection fun * mathematical intersection fun
*/ */
static int reg_rules_intersect( static int reg_rules_intersect(const struct ieee80211_reg_rule *rule1,
const struct ieee80211_reg_rule *rule1, const struct ieee80211_reg_rule *rule2,
const struct ieee80211_reg_rule *rule2, struct ieee80211_reg_rule *intersected_rule)
struct ieee80211_reg_rule *intersected_rule)
{ {
const struct ieee80211_freq_range *freq_range1, *freq_range2; const struct ieee80211_freq_range *freq_range1, *freq_range2;
struct ieee80211_freq_range *freq_range; struct ieee80211_freq_range *freq_range;
...@@ -556,11 +537,11 @@ static int reg_rules_intersect( ...@@ -556,11 +537,11 @@ static int reg_rules_intersect(
power_rule = &intersected_rule->power_rule; power_rule = &intersected_rule->power_rule;
freq_range->start_freq_khz = max(freq_range1->start_freq_khz, freq_range->start_freq_khz = max(freq_range1->start_freq_khz,
freq_range2->start_freq_khz); freq_range2->start_freq_khz);
freq_range->end_freq_khz = min(freq_range1->end_freq_khz, freq_range->end_freq_khz = min(freq_range1->end_freq_khz,
freq_range2->end_freq_khz); freq_range2->end_freq_khz);
freq_range->max_bandwidth_khz = min(freq_range1->max_bandwidth_khz, freq_range->max_bandwidth_khz = min(freq_range1->max_bandwidth_khz,
freq_range2->max_bandwidth_khz); freq_range2->max_bandwidth_khz);
freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz; freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz;
if (freq_range->max_bandwidth_khz > freq_diff) if (freq_range->max_bandwidth_khz > freq_diff)
...@@ -571,7 +552,7 @@ static int reg_rules_intersect( ...@@ -571,7 +552,7 @@ static int reg_rules_intersect(
power_rule->max_antenna_gain = min(power_rule1->max_antenna_gain, power_rule->max_antenna_gain = min(power_rule1->max_antenna_gain,
power_rule2->max_antenna_gain); power_rule2->max_antenna_gain);
intersected_rule->flags = (rule1->flags | rule2->flags); intersected_rule->flags = rule1->flags | rule2->flags;
if (!is_valid_reg_rule(intersected_rule)) if (!is_valid_reg_rule(intersected_rule))
return -EINVAL; return -EINVAL;
...@@ -592,9 +573,9 @@ static int reg_rules_intersect( ...@@ -592,9 +573,9 @@ static int reg_rules_intersect(
* resulting intersection of rules between rd1 and rd2. We will * resulting intersection of rules between rd1 and rd2. We will
* kzalloc() this structure for you. * kzalloc() this structure for you.
*/ */
static struct ieee80211_regdomain *regdom_intersect( static struct ieee80211_regdomain *
const struct ieee80211_regdomain *rd1, regdom_intersect(const struct ieee80211_regdomain *rd1,
const struct ieee80211_regdomain *rd2) const struct ieee80211_regdomain *rd2)
{ {
int r, size_of_regd; int r, size_of_regd;
unsigned int x, y; unsigned int x, y;
...@@ -645,8 +626,7 @@ static struct ieee80211_regdomain *regdom_intersect( ...@@ -645,8 +626,7 @@ static struct ieee80211_regdomain *regdom_intersect(
* a memcpy() * a memcpy()
*/ */
intersected_rule = &rd->reg_rules[rule_idx]; intersected_rule = &rd->reg_rules[rule_idx];
r = reg_rules_intersect(rule1, rule2, r = reg_rules_intersect(rule1, rule2, intersected_rule);
intersected_rule);
/* /*
* No need to memset here the intersected rule here as * No need to memset here the intersected rule here as
* we're not using the stack anymore * we're not using the stack anymore
...@@ -731,9 +711,7 @@ static int freq_reg_info_regd(struct wiphy *wiphy, ...@@ -731,9 +711,7 @@ static int freq_reg_info_regd(struct wiphy *wiphy,
if (!band_rule_found) if (!band_rule_found)
band_rule_found = freq_in_rule_band(fr, center_freq); band_rule_found = freq_in_rule_band(fr, center_freq);
bw_fits = reg_does_bw_fit(fr, bw_fits = reg_does_bw_fit(fr, center_freq, desired_bw_khz);
center_freq,
desired_bw_khz);
if (band_rule_found && bw_fits) { if (band_rule_found && bw_fits) {
*reg_rule = rr; *reg_rule = rr;
...@@ -747,17 +725,13 @@ static int freq_reg_info_regd(struct wiphy *wiphy, ...@@ -747,17 +725,13 @@ static int freq_reg_info_regd(struct wiphy *wiphy,
return -EINVAL; return -EINVAL;
} }
int freq_reg_info(struct wiphy *wiphy, int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 desired_bw_khz,
u32 center_freq,
u32 desired_bw_khz,
const struct ieee80211_reg_rule **reg_rule) const struct ieee80211_reg_rule **reg_rule)
{ {
assert_cfg80211_lock(); assert_cfg80211_lock();
return freq_reg_info_regd(wiphy,
center_freq, return freq_reg_info_regd(wiphy, center_freq, desired_bw_khz,
desired_bw_khz, reg_rule, NULL);
reg_rule,
NULL);
} }
EXPORT_SYMBOL(freq_reg_info); EXPORT_SYMBOL(freq_reg_info);
...@@ -795,16 +769,12 @@ static void chan_reg_rule_print_dbg(struct ieee80211_channel *chan, ...@@ -795,16 +769,12 @@ static void chan_reg_rule_print_dbg(struct ieee80211_channel *chan,
else else
snprintf(max_antenna_gain, 32, "%d", power_rule->max_antenna_gain); snprintf(max_antenna_gain, 32, "%d", power_rule->max_antenna_gain);
REG_DBG_PRINT("Updating information on frequency %d MHz " REG_DBG_PRINT("Updating information on frequency %d MHz for a %d MHz width channel with regulatory rule:\n",
"for a %d MHz width channel with regulatory rule:\n", chan->center_freq, KHZ_TO_MHZ(desired_bw_khz));
chan->center_freq,
KHZ_TO_MHZ(desired_bw_khz));
REG_DBG_PRINT("%d KHz - %d KHz @ %d KHz), (%s mBi, %d mBm)\n", REG_DBG_PRINT("%d KHz - %d KHz @ %d KHz), (%s mBi, %d mBm)\n",
freq_range->start_freq_khz, freq_range->start_freq_khz, freq_range->end_freq_khz,
freq_range->end_freq_khz, freq_range->max_bandwidth_khz, max_antenna_gain,
freq_range->max_bandwidth_khz,
max_antenna_gain,
power_rule->max_eirp); power_rule->max_eirp);
} }
#else #else
...@@ -850,11 +820,8 @@ static void handle_channel(struct wiphy *wiphy, ...@@ -850,11 +820,8 @@ static void handle_channel(struct wiphy *wiphy,
flags = chan->orig_flags; flags = chan->orig_flags;
r = freq_reg_info(wiphy, r = freq_reg_info(wiphy, MHZ_TO_KHZ(chan->center_freq),
MHZ_TO_KHZ(chan->center_freq), desired_bw_khz, &reg_rule);
desired_bw_khz,
&reg_rule);
if (r) { if (r) {
/* /*
* We will disable all channels that do not match our * We will disable all channels that do not match our
...@@ -902,8 +869,9 @@ static void handle_channel(struct wiphy *wiphy, ...@@ -902,8 +869,9 @@ static void handle_channel(struct wiphy *wiphy,
chan->beacon_found = false; chan->beacon_found = false;
chan->flags = flags | bw_flags | map_regdom_flags(reg_rule->flags); chan->flags = flags | bw_flags | map_regdom_flags(reg_rule->flags);
chan->max_antenna_gain = min(chan->orig_mag, chan->max_antenna_gain =
(int) MBI_TO_DBI(power_rule->max_antenna_gain)); min_t(int, chan->orig_mag,
MBI_TO_DBI(power_rule->max_antenna_gain));
chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp); chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp);
if (chan->orig_mpwr) { if (chan->orig_mpwr) {
/* /*
...@@ -922,8 +890,7 @@ static void handle_channel(struct wiphy *wiphy, ...@@ -922,8 +890,7 @@ static void handle_channel(struct wiphy *wiphy,
chan->max_power = chan->max_reg_power; chan->max_power = chan->max_reg_power;
} }
static void handle_band(struct wiphy *wiphy, static void handle_band(struct wiphy *wiphy, enum ieee80211_band band,
enum ieee80211_band band,
enum nl80211_reg_initiator initiator) enum nl80211_reg_initiator initiator)
{ {
unsigned int i; unsigned int i;
...@@ -940,51 +907,48 @@ static bool reg_request_cell_base(struct regulatory_request *request) ...@@ -940,51 +907,48 @@ static bool reg_request_cell_base(struct regulatory_request *request)
{ {
if (request->initiator != NL80211_REGDOM_SET_BY_USER) if (request->initiator != NL80211_REGDOM_SET_BY_USER)
return false; return false;
if (request->user_reg_hint_type != NL80211_USER_REG_HINT_CELL_BASE) return request->user_reg_hint_type == NL80211_USER_REG_HINT_CELL_BASE;
return false;
return true;
} }
bool reg_last_request_cell_base(void) bool reg_last_request_cell_base(void)
{ {
bool val; bool val;
assert_cfg80211_lock(); assert_cfg80211_lock();
mutex_lock(&reg_mutex); mutex_lock(&reg_mutex);
val = reg_request_cell_base(last_request); val = reg_request_cell_base(last_request);
mutex_unlock(&reg_mutex); mutex_unlock(&reg_mutex);
return val; return val;
} }
#ifdef CONFIG_CFG80211_CERTIFICATION_ONUS #ifdef CONFIG_CFG80211_CERTIFICATION_ONUS
/* Core specific check */ /* Core specific check */
static int reg_ignore_cell_hint(struct regulatory_request *pending_request) static int reg_ignore_cell_hint(struct regulatory_request *pending_request)
{ {
if (!reg_num_devs_support_basehint) if (!reg_num_devs_support_basehint)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (reg_request_cell_base(last_request)) { if (reg_request_cell_base(last_request) &&
if (!regdom_changes(pending_request->alpha2)) !regdom_changes(pending_request->alpha2))
return -EALREADY; return -EALREADY;
return 0;
}
return 0; return 0;
} }
/* Device specific check */ /* Device specific check */
static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy) static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy)
{ {
if (!(wiphy->features & NL80211_FEATURE_CELL_BASE_REG_HINTS)) return !(wiphy->features & NL80211_FEATURE_CELL_BASE_REG_HINTS);
return true;
return false;
} }
#else #else
static int reg_ignore_cell_hint(struct regulatory_request *pending_request) static int reg_ignore_cell_hint(struct regulatory_request *pending_request)
{ {
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static int reg_dev_ignore_cell_hint(struct wiphy *wiphy)
static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy)
{ {
return true; return true;
} }
...@@ -995,17 +959,14 @@ static bool ignore_reg_update(struct wiphy *wiphy, ...@@ -995,17 +959,14 @@ static bool ignore_reg_update(struct wiphy *wiphy,
enum nl80211_reg_initiator initiator) enum nl80211_reg_initiator initiator)
{ {
if (!last_request) { if (!last_request) {
REG_DBG_PRINT("Ignoring regulatory request %s since " REG_DBG_PRINT("Ignoring regulatory request %s since last_request is not set\n",
"last_request is not set\n",
reg_initiator_name(initiator)); reg_initiator_name(initiator));
return true; return true;
} }
if (initiator == NL80211_REGDOM_SET_BY_CORE && if (initiator == NL80211_REGDOM_SET_BY_CORE &&
wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) { wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) {
REG_DBG_PRINT("Ignoring regulatory request %s " REG_DBG_PRINT("Ignoring regulatory request %s since the driver uses its own custom regulatory domain\n",
"since the driver uses its own custom "
"regulatory domain\n",
reg_initiator_name(initiator)); reg_initiator_name(initiator));
return true; return true;
} }
...@@ -1017,9 +978,7 @@ static bool ignore_reg_update(struct wiphy *wiphy, ...@@ -1017,9 +978,7 @@ static bool ignore_reg_update(struct wiphy *wiphy,
if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && !wiphy->regd && if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && !wiphy->regd &&
initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE &&
!is_world_regdom(last_request->alpha2)) { !is_world_regdom(last_request->alpha2)) {
REG_DBG_PRINT("Ignoring regulatory request %s " REG_DBG_PRINT("Ignoring regulatory request %s since the driver requires its own regulatory domain to be set first\n",
"since the driver requires its own regulatory "
"domain to be set first\n",
reg_initiator_name(initiator)); reg_initiator_name(initiator));
return true; return true;
} }
...@@ -1030,8 +989,7 @@ static bool ignore_reg_update(struct wiphy *wiphy, ...@@ -1030,8 +989,7 @@ static bool ignore_reg_update(struct wiphy *wiphy,
return false; return false;
} }
static void handle_reg_beacon(struct wiphy *wiphy, static void handle_reg_beacon(struct wiphy *wiphy, unsigned int chan_idx,
unsigned int chan_idx,
struct reg_beacon *reg_beacon) struct reg_beacon *reg_beacon)
{ {
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
...@@ -1139,16 +1097,14 @@ static void reg_process_beacons(struct wiphy *wiphy) ...@@ -1139,16 +1097,14 @@ static void reg_process_beacons(struct wiphy *wiphy)
wiphy_update_beacon_reg(wiphy); wiphy_update_beacon_reg(wiphy);
} }
static bool is_ht40_not_allowed(struct ieee80211_channel *chan) static bool is_ht40_allowed(struct ieee80211_channel *chan)
{ {
if (!chan) if (!chan)
return true; return false;
if (chan->flags & IEEE80211_CHAN_DISABLED) if (chan->flags & IEEE80211_CHAN_DISABLED)
return true; return false;
/* This would happen when regulatory rules disallow HT40 completely */ /* This would happen when regulatory rules disallow HT40 completely */
if (IEEE80211_CHAN_NO_HT40 == (chan->flags & (IEEE80211_CHAN_NO_HT40))) return !(chan->flags & IEEE80211_CHAN_NO_HT40);
return true;
return false;
} }
static void reg_process_ht_flags_channel(struct wiphy *wiphy, static void reg_process_ht_flags_channel(struct wiphy *wiphy,
...@@ -1166,7 +1122,7 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy, ...@@ -1166,7 +1122,7 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
BUG_ON(chan_idx >= sband->n_channels); BUG_ON(chan_idx >= sband->n_channels);
channel = &sband->channels[chan_idx]; channel = &sband->channels[chan_idx];
if (is_ht40_not_allowed(channel)) { if (!is_ht40_allowed(channel)) {
channel->flags |= IEEE80211_CHAN_NO_HT40; channel->flags |= IEEE80211_CHAN_NO_HT40;
return; return;
} }
...@@ -1177,6 +1133,7 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy, ...@@ -1177,6 +1133,7 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
*/ */
for (i = 0; i < sband->n_channels; i++) { for (i = 0; i < sband->n_channels; i++) {
struct ieee80211_channel *c = &sband->channels[i]; struct ieee80211_channel *c = &sband->channels[i];
if (c->center_freq == (channel->center_freq - 20)) if (c->center_freq == (channel->center_freq - 20))
channel_before = c; channel_before = c;
if (c->center_freq == (channel->center_freq + 20)) if (c->center_freq == (channel->center_freq + 20))
...@@ -1188,12 +1145,12 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy, ...@@ -1188,12 +1145,12 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
* if that ever changes we also need to change the below logic * if that ever changes we also need to change the below logic
* to include that as well. * to include that as well.
*/ */
if (is_ht40_not_allowed(channel_before)) if (!is_ht40_allowed(channel_before))
channel->flags |= IEEE80211_CHAN_NO_HT40MINUS; channel->flags |= IEEE80211_CHAN_NO_HT40MINUS;
else else
channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS; channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS;
if (is_ht40_not_allowed(channel_after)) if (!is_ht40_allowed(channel_after))
channel->flags |= IEEE80211_CHAN_NO_HT40PLUS; channel->flags |= IEEE80211_CHAN_NO_HT40PLUS;
else else
channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS; channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS;
...@@ -1245,6 +1202,7 @@ static void wiphy_update_regulatory(struct wiphy *wiphy, ...@@ -1245,6 +1202,7 @@ static void wiphy_update_regulatory(struct wiphy *wiphy,
reg_process_beacons(wiphy); reg_process_beacons(wiphy);
reg_process_ht_flags(wiphy); reg_process_ht_flags(wiphy);
if (wiphy->reg_notifier) if (wiphy->reg_notifier)
wiphy->reg_notifier(wiphy, last_request); wiphy->reg_notifier(wiphy, last_request);
} }
...@@ -1289,18 +1247,12 @@ static void handle_channel_custom(struct wiphy *wiphy, ...@@ -1289,18 +1247,12 @@ static void handle_channel_custom(struct wiphy *wiphy,
BUG_ON(chan_idx >= sband->n_channels); BUG_ON(chan_idx >= sband->n_channels);
chan = &sband->channels[chan_idx]; chan = &sband->channels[chan_idx];
r = freq_reg_info_regd(wiphy, r = freq_reg_info_regd(wiphy, MHZ_TO_KHZ(chan->center_freq),
MHZ_TO_KHZ(chan->center_freq), desired_bw_khz, &reg_rule, regd);
desired_bw_khz,
&reg_rule,
regd);
if (r) { if (r) {
REG_DBG_PRINT("Disabling freq %d MHz as custom " REG_DBG_PRINT("Disabling freq %d MHz as custom regd has no rule that fits a %d MHz wide channel\n",
"regd has no rule that fits a %d MHz " chan->center_freq, KHZ_TO_MHZ(desired_bw_khz));
"wide channel\n",
chan->center_freq,
KHZ_TO_MHZ(desired_bw_khz));
chan->flags = IEEE80211_CHAN_DISABLED; chan->flags = IEEE80211_CHAN_DISABLED;
return; return;
} }
...@@ -1350,7 +1302,7 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy, ...@@ -1350,7 +1302,7 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
/* /*
* no point in calling this if it won't have any effect * no point in calling this if it won't have any effect
* on your device's supportd bands. * on your device's supported bands.
*/ */
WARN_ON(!bands_set); WARN_ON(!bands_set);
} }
...@@ -1379,7 +1331,6 @@ static int ignore_request(struct wiphy *wiphy, ...@@ -1379,7 +1331,6 @@ static int ignore_request(struct wiphy *wiphy,
case NL80211_REGDOM_SET_BY_CORE: case NL80211_REGDOM_SET_BY_CORE:
return 0; return 0;
case NL80211_REGDOM_SET_BY_COUNTRY_IE: case NL80211_REGDOM_SET_BY_COUNTRY_IE:
if (reg_request_cell_base(last_request)) { if (reg_request_cell_base(last_request)) {
/* Trust a Cell base station over the AP's country IE */ /* Trust a Cell base station over the AP's country IE */
if (regdom_changes(pending_request->alpha2)) if (regdom_changes(pending_request->alpha2))
...@@ -1444,18 +1395,17 @@ static int ignore_request(struct wiphy *wiphy, ...@@ -1444,18 +1395,17 @@ static int ignore_request(struct wiphy *wiphy,
* to their country before the IE is picked up * to their country before the IE is picked up
*/ */
if (last_request->initiator == NL80211_REGDOM_SET_BY_USER && if (last_request->initiator == NL80211_REGDOM_SET_BY_USER &&
last_request->intersect) last_request->intersect)
return -EOPNOTSUPP; return -EOPNOTSUPP;
/* /*
* Process user requests only after previous user/driver/core * Process user requests only after previous user/driver/core
* requests have been processed * requests have been processed
*/ */
if (last_request->initiator == NL80211_REGDOM_SET_BY_CORE || if ((last_request->initiator == NL80211_REGDOM_SET_BY_CORE ||
last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER || last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER ||
last_request->initiator == NL80211_REGDOM_SET_BY_USER) { last_request->initiator == NL80211_REGDOM_SET_BY_USER) &&
if (regdom_changes(last_request->alpha2)) regdom_changes(last_request->alpha2))
return -EAGAIN; return -EAGAIN;
}
if (!regdom_changes(pending_request->alpha2)) if (!regdom_changes(pending_request->alpha2))
return -EALREADY; return -EALREADY;
...@@ -1585,8 +1535,7 @@ static void reg_process_hint(struct regulatory_request *reg_request, ...@@ -1585,8 +1535,7 @@ static void reg_process_hint(struct regulatory_request *reg_request,
if (wiphy_idx_valid(reg_request->wiphy_idx)) if (wiphy_idx_valid(reg_request->wiphy_idx))
wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx);
if (reg_initiator == NL80211_REGDOM_SET_BY_DRIVER && if (reg_initiator == NL80211_REGDOM_SET_BY_DRIVER && !wiphy) {
!wiphy) {
kfree(reg_request); kfree(reg_request);
return; return;
} }
...@@ -1603,8 +1552,7 @@ static void reg_process_hint(struct regulatory_request *reg_request, ...@@ -1603,8 +1552,7 @@ static void reg_process_hint(struct regulatory_request *reg_request,
* We only time out user hints, given that they should be the only * We only time out user hints, given that they should be the only
* source of bogus requests. * source of bogus requests.
*/ */
if (r != -EALREADY && if (r != -EALREADY && reg_initiator == NL80211_REGDOM_SET_BY_USER)
reg_initiator == NL80211_REGDOM_SET_BY_USER)
schedule_delayed_work(&reg_timeout, msecs_to_jiffies(3142)); schedule_delayed_work(&reg_timeout, msecs_to_jiffies(3142));
} }
...@@ -1622,8 +1570,7 @@ static void reg_process_pending_hints(void) ...@@ -1622,8 +1570,7 @@ static void reg_process_pending_hints(void)
/* When last_request->processed becomes true this will be rescheduled */ /* When last_request->processed becomes true this will be rescheduled */
if (last_request && !last_request->processed) { if (last_request && !last_request->processed) {
REG_DBG_PRINT("Pending regulatory request, waiting " REG_DBG_PRINT("Pending regulatory request, waiting for it to be processed...\n");
"for it to be processed...\n");
goto out; goto out;
} }
...@@ -1665,7 +1612,6 @@ static void reg_process_pending_beacon_hints(void) ...@@ -1665,7 +1612,6 @@ static void reg_process_pending_beacon_hints(void)
list_for_each_entry_safe(pending_beacon, tmp, list_for_each_entry_safe(pending_beacon, tmp,
&reg_pending_beacons, list) { &reg_pending_beacons, list) {
list_del_init(&pending_beacon->list); list_del_init(&pending_beacon->list);
/* Applies the beacon hint to current wiphys */ /* Applies the beacon hint to current wiphys */
...@@ -1708,8 +1654,7 @@ static int regulatory_hint_core(const char *alpha2) ...@@ -1708,8 +1654,7 @@ static int regulatory_hint_core(const char *alpha2)
{ {
struct regulatory_request *request; struct regulatory_request *request;
request = kzalloc(sizeof(struct regulatory_request), request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
GFP_KERNEL);
if (!request) if (!request)
return -ENOMEM; return -ENOMEM;
...@@ -1776,10 +1721,8 @@ EXPORT_SYMBOL(regulatory_hint); ...@@ -1776,10 +1721,8 @@ EXPORT_SYMBOL(regulatory_hint);
* We hold wdev_lock() here so we cannot hold cfg80211_mutex() and * We hold wdev_lock() here so we cannot hold cfg80211_mutex() and
* therefore cannot iterate over the rdev list here. * therefore cannot iterate over the rdev list here.
*/ */
void regulatory_hint_11d(struct wiphy *wiphy, void regulatory_hint_11d(struct wiphy *wiphy, enum ieee80211_band band,
enum ieee80211_band band, const u8 *country_ie, u8 country_ie_len)
const u8 *country_ie,
u8 country_ie_len)
{ {
char alpha2[2]; char alpha2[2];
enum environment_cap env = ENVIRON_ANY; enum environment_cap env = ENVIRON_ANY;
...@@ -1811,8 +1754,8 @@ void regulatory_hint_11d(struct wiphy *wiphy, ...@@ -1811,8 +1754,8 @@ void regulatory_hint_11d(struct wiphy *wiphy,
* cfg80211_mutex. * cfg80211_mutex.
*/ */
if (likely(last_request->initiator == if (likely(last_request->initiator ==
NL80211_REGDOM_SET_BY_COUNTRY_IE && NL80211_REGDOM_SET_BY_COUNTRY_IE &&
wiphy_idx_valid(last_request->wiphy_idx))) wiphy_idx_valid(last_request->wiphy_idx)))
goto out; goto out;
request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
...@@ -1840,8 +1783,7 @@ static void restore_alpha2(char *alpha2, bool reset_user) ...@@ -1840,8 +1783,7 @@ static void restore_alpha2(char *alpha2, bool reset_user)
if (is_user_regdom_saved()) { if (is_user_regdom_saved()) {
/* Unless we're asked to ignore it and reset it */ /* Unless we're asked to ignore it and reset it */
if (reset_user) { if (reset_user) {
REG_DBG_PRINT("Restoring regulatory settings " REG_DBG_PRINT("Restoring regulatory settings including user preference\n");
"including user preference\n");
user_alpha2[0] = '9'; user_alpha2[0] = '9';
user_alpha2[1] = '7'; user_alpha2[1] = '7';
...@@ -1851,26 +1793,20 @@ static void restore_alpha2(char *alpha2, bool reset_user) ...@@ -1851,26 +1793,20 @@ static void restore_alpha2(char *alpha2, bool reset_user)
* back as they were for a full restore. * back as they were for a full restore.
*/ */
if (!is_world_regdom(ieee80211_regdom)) { if (!is_world_regdom(ieee80211_regdom)) {
REG_DBG_PRINT("Keeping preference on " REG_DBG_PRINT("Keeping preference on module parameter ieee80211_regdom: %c%c\n",
"module parameter ieee80211_regdom: %c%c\n", ieee80211_regdom[0], ieee80211_regdom[1]);
ieee80211_regdom[0],
ieee80211_regdom[1]);
alpha2[0] = ieee80211_regdom[0]; alpha2[0] = ieee80211_regdom[0];
alpha2[1] = ieee80211_regdom[1]; alpha2[1] = ieee80211_regdom[1];
} }
} else { } else {
REG_DBG_PRINT("Restoring regulatory settings " REG_DBG_PRINT("Restoring regulatory settings while preserving user preference for: %c%c\n",
"while preserving user preference for: %c%c\n", user_alpha2[0], user_alpha2[1]);
user_alpha2[0],
user_alpha2[1]);
alpha2[0] = user_alpha2[0]; alpha2[0] = user_alpha2[0];
alpha2[1] = user_alpha2[1]; alpha2[1] = user_alpha2[1];
} }
} else if (!is_world_regdom(ieee80211_regdom)) { } else if (!is_world_regdom(ieee80211_regdom)) {
REG_DBG_PRINT("Keeping preference on " REG_DBG_PRINT("Keeping preference on module parameter ieee80211_regdom: %c%c\n",
"module parameter ieee80211_regdom: %c%c\n", ieee80211_regdom[0], ieee80211_regdom[1]);
ieee80211_regdom[0],
ieee80211_regdom[1]);
alpha2[0] = ieee80211_regdom[0]; alpha2[0] = ieee80211_regdom[0];
alpha2[1] = ieee80211_regdom[1]; alpha2[1] = ieee80211_regdom[1];
} else } else
...@@ -1986,10 +1922,8 @@ static void restore_regulatory_settings(bool reset_user) ...@@ -1986,10 +1922,8 @@ static void restore_regulatory_settings(bool reset_user)
spin_lock(&reg_requests_lock); spin_lock(&reg_requests_lock);
list_for_each_entry_safe(reg_request, tmp, &tmp_reg_req_list, list) { list_for_each_entry_safe(reg_request, tmp, &tmp_reg_req_list, list) {
REG_DBG_PRINT("Adding request for country %c%c back " REG_DBG_PRINT("Adding request for country %c%c back into the queue\n",
"into the queue\n", reg_request->alpha2[0], reg_request->alpha2[1]);
reg_request->alpha2[0],
reg_request->alpha2[1]);
list_move_tail(&reg_request->list, &reg_requests_list); list_move_tail(&reg_request->list, &reg_requests_list);
} }
spin_unlock(&reg_requests_lock); spin_unlock(&reg_requests_lock);
...@@ -2004,8 +1938,7 @@ static void restore_regulatory_settings(bool reset_user) ...@@ -2004,8 +1938,7 @@ static void restore_regulatory_settings(bool reset_user)
void regulatory_hint_disconnect(void) void regulatory_hint_disconnect(void)
{ {
REG_DBG_PRINT("All devices are disconnected, going to " REG_DBG_PRINT("All devices are disconnected, going to restore regulatory settings\n");
"restore regulatory settings\n");
restore_regulatory_settings(false); restore_regulatory_settings(false);
} }
...@@ -2024,25 +1957,23 @@ int regulatory_hint_found_beacon(struct wiphy *wiphy, ...@@ -2024,25 +1957,23 @@ int regulatory_hint_found_beacon(struct wiphy *wiphy,
{ {
struct reg_beacon *reg_beacon; struct reg_beacon *reg_beacon;
if (likely((beacon_chan->beacon_found || if (beacon_chan->beacon_found ||
(beacon_chan->flags & IEEE80211_CHAN_RADAR) || beacon_chan->flags & IEEE80211_CHAN_RADAR ||
(beacon_chan->band == IEEE80211_BAND_2GHZ && (beacon_chan->band == IEEE80211_BAND_2GHZ &&
!freq_is_chan_12_13_14(beacon_chan->center_freq))))) !freq_is_chan_12_13_14(beacon_chan->center_freq)))
return 0; return 0;
reg_beacon = kzalloc(sizeof(struct reg_beacon), gfp); reg_beacon = kzalloc(sizeof(struct reg_beacon), gfp);
if (!reg_beacon) if (!reg_beacon)
return -ENOMEM; return -ENOMEM;
REG_DBG_PRINT("Found new beacon on " REG_DBG_PRINT("Found new beacon on frequency: %d MHz (Ch %d) on %s\n",
"frequency: %d MHz (Ch %d) on %s\n",
beacon_chan->center_freq, beacon_chan->center_freq,
ieee80211_frequency_to_channel(beacon_chan->center_freq), ieee80211_frequency_to_channel(beacon_chan->center_freq),
wiphy_name(wiphy)); wiphy_name(wiphy));
memcpy(&reg_beacon->chan, beacon_chan, memcpy(&reg_beacon->chan, beacon_chan,
sizeof(struct ieee80211_channel)); sizeof(struct ieee80211_channel));
/* /*
* Since we can be called from BH or and non-BH context * Since we can be called from BH or and non-BH context
...@@ -2122,7 +2053,7 @@ static void print_dfs_region(u8 dfs_region) ...@@ -2122,7 +2053,7 @@ static void print_dfs_region(u8 dfs_region)
pr_info(" DFS Master region JP"); pr_info(" DFS Master region JP");
break; break;
default: default:
pr_info(" DFS Master region Uknown"); pr_info(" DFS Master region Unknown");
break; break;
} }
} }
...@@ -2131,7 +2062,6 @@ static void print_regdomain(const struct ieee80211_regdomain *rd) ...@@ -2131,7 +2062,6 @@ static void print_regdomain(const struct ieee80211_regdomain *rd)
{ {
if (is_intersected_alpha2(rd->alpha2)) { if (is_intersected_alpha2(rd->alpha2)) {
if (last_request->initiator == if (last_request->initiator ==
NL80211_REGDOM_SET_BY_COUNTRY_IE) { NL80211_REGDOM_SET_BY_COUNTRY_IE) {
struct cfg80211_registered_device *rdev; struct cfg80211_registered_device *rdev;
...@@ -2145,22 +2075,21 @@ static void print_regdomain(const struct ieee80211_regdomain *rd) ...@@ -2145,22 +2075,21 @@ static void print_regdomain(const struct ieee80211_regdomain *rd)
pr_info("Current regulatory domain intersected:\n"); pr_info("Current regulatory domain intersected:\n");
} else } else
pr_info("Current regulatory domain intersected:\n"); pr_info("Current regulatory domain intersected:\n");
} else if (is_world_regdom(rd->alpha2)) } else if (is_world_regdom(rd->alpha2)) {
pr_info("World regulatory domain updated:\n"); pr_info("World regulatory domain updated:\n");
else { } else {
if (is_unknown_alpha2(rd->alpha2)) if (is_unknown_alpha2(rd->alpha2))
pr_info("Regulatory domain changed to driver built-in settings (unknown country)\n"); pr_info("Regulatory domain changed to driver built-in settings (unknown country)\n");
else { else {
if (reg_request_cell_base(last_request)) if (reg_request_cell_base(last_request))
pr_info("Regulatory domain changed " pr_info("Regulatory domain changed to country: %c%c by Cell Station\n",
"to country: %c%c by Cell Station\n",
rd->alpha2[0], rd->alpha2[1]); rd->alpha2[0], rd->alpha2[1]);
else else
pr_info("Regulatory domain changed " pr_info("Regulatory domain changed to country: %c%c\n",
"to country: %c%c\n",
rd->alpha2[0], rd->alpha2[1]); rd->alpha2[0], rd->alpha2[1]);
} }
} }
print_dfs_region(rd->dfs_region); print_dfs_region(rd->dfs_region);
print_rd_rules(rd); print_rd_rules(rd);
} }
...@@ -2187,7 +2116,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) ...@@ -2187,7 +2116,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
} }
if (!is_alpha2_set(rd->alpha2) && !is_an_alpha2(rd->alpha2) && if (!is_alpha2_set(rd->alpha2) && !is_an_alpha2(rd->alpha2) &&
!is_unknown_alpha2(rd->alpha2)) !is_unknown_alpha2(rd->alpha2))
return -EINVAL; return -EINVAL;
if (!last_request) if (!last_request)
...@@ -2263,7 +2192,6 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) ...@@ -2263,7 +2192,6 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
/* Intersection requires a bit more work */ /* Intersection requires a bit more work */
if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE) { if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE) {
intersected_rd = regdom_intersect(rd, cfg80211_regdomain); intersected_rd = regdom_intersect(rd, cfg80211_regdomain);
if (!intersected_rd) if (!intersected_rd)
return -EINVAL; return -EINVAL;
...@@ -2315,8 +2243,7 @@ int set_regdom(const struct ieee80211_regdomain *rd) ...@@ -2315,8 +2243,7 @@ int set_regdom(const struct ieee80211_regdomain *rd)
} }
/* This would make this whole thing pointless */ /* This would make this whole thing pointless */
if (!last_request->intersect) BUG_ON(!last_request->intersect && rd != cfg80211_regdomain);
BUG_ON(rd != cfg80211_regdomain);
/* update all wiphys now with the new established regulatory domain */ /* update all wiphys now with the new established regulatory domain */
update_all_wiphy_regulatory(last_request->initiator); update_all_wiphy_regulatory(last_request->initiator);
...@@ -2393,8 +2320,7 @@ void wiphy_regulatory_deregister(struct wiphy *wiphy) ...@@ -2393,8 +2320,7 @@ void wiphy_regulatory_deregister(struct wiphy *wiphy)
static void reg_timeout_work(struct work_struct *work) static void reg_timeout_work(struct work_struct *work)
{ {
REG_DBG_PRINT("Timeout while waiting for CRDA to reply, " REG_DBG_PRINT("Timeout while waiting for CRDA to reply, restoring regulatory settings\n");
"restoring regulatory settings\n");
restore_regulatory_settings(true); restore_regulatory_settings(true);
} }
...@@ -2448,7 +2374,7 @@ int __init regulatory_init(void) ...@@ -2448,7 +2374,7 @@ int __init regulatory_init(void)
return 0; return 0;
} }
void /* __init_or_exit */ regulatory_exit(void) void regulatory_exit(void)
{ {
struct regulatory_request *reg_request, *tmp; struct regulatory_request *reg_request, *tmp;
struct reg_beacon *reg_beacon, *btmp; struct reg_beacon *reg_beacon, *btmp;
......
...@@ -55,8 +55,8 @@ bool reg_last_request_cell_base(void); ...@@ -55,8 +55,8 @@ bool reg_last_request_cell_base(void);
* set the wiphy->disable_beacon_hints to true. * set the wiphy->disable_beacon_hints to true.
*/ */
int regulatory_hint_found_beacon(struct wiphy *wiphy, int regulatory_hint_found_beacon(struct wiphy *wiphy,
struct ieee80211_channel *beacon_chan, struct ieee80211_channel *beacon_chan,
gfp_t gfp); gfp_t gfp);
/** /**
* regulatory_hint_11d - hints a country IE as a regulatory domain * regulatory_hint_11d - hints a country IE as a regulatory domain
......
...@@ -519,10 +519,8 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, ...@@ -519,10 +519,8 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
* - country_ie + 2, the start of the country ie data, and * - country_ie + 2, the start of the country ie data, and
* - and country_ie[1] which is the IE length * - and country_ie[1] which is the IE length
*/ */
regulatory_hint_11d(wdev->wiphy, regulatory_hint_11d(wdev->wiphy, bss->channel->band,
bss->channel->band, country_ie + 2, country_ie[1]);
country_ie + 2,
country_ie[1]);
kfree(country_ie); kfree(country_ie);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment