cfg80211: Simplify the handling of regulatory indoor setting
Directly update the indoor setting without wrapping it as a regulatory request, to simplify the processing. Acked-by: Luis R. Rodriguez <mcgrof@suse.com> Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
560676282e
commit
0c4ddcd214
|
@ -82,17 +82,12 @@
|
||||||
* be intersected with the current one.
|
* be intersected with the current one.
|
||||||
* @REG_REQ_ALREADY_SET: the regulatory request will not change the current
|
* @REG_REQ_ALREADY_SET: the regulatory request will not change the current
|
||||||
* regulatory settings, and no further processing is required.
|
* regulatory settings, and no further processing is required.
|
||||||
* @REG_REQ_USER_HINT_HANDLED: a non alpha2 user hint was handled and no
|
|
||||||
* further processing is required, i.e., not need to update last_request
|
|
||||||
* etc. This should be used for user hints that do not provide an alpha2
|
|
||||||
* but some other type of regulatory hint, i.e., indoor operation.
|
|
||||||
*/
|
*/
|
||||||
enum reg_request_treatment {
|
enum reg_request_treatment {
|
||||||
REG_REQ_OK,
|
REG_REQ_OK,
|
||||||
REG_REQ_IGNORE,
|
REG_REQ_IGNORE,
|
||||||
REG_REQ_INTERSECT,
|
REG_REQ_INTERSECT,
|
||||||
REG_REQ_ALREADY_SET,
|
REG_REQ_ALREADY_SET,
|
||||||
REG_REQ_USER_HINT_HANDLED,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct regulatory_request core_request_world = {
|
static struct regulatory_request core_request_world = {
|
||||||
|
@ -1248,13 +1243,6 @@ static bool reg_request_cell_base(struct regulatory_request *request)
|
||||||
return request->user_reg_hint_type == NL80211_USER_REG_HINT_CELL_BASE;
|
return request->user_reg_hint_type == NL80211_USER_REG_HINT_CELL_BASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool reg_request_indoor(struct regulatory_request *request)
|
|
||||||
{
|
|
||||||
if (request->initiator != NL80211_REGDOM_SET_BY_USER)
|
|
||||||
return false;
|
|
||||||
return request->user_reg_hint_type == NL80211_USER_REG_HINT_INDOOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool reg_last_request_cell_base(void)
|
bool reg_last_request_cell_base(void)
|
||||||
{
|
{
|
||||||
return reg_request_cell_base(get_last_request());
|
return reg_request_cell_base(get_last_request());
|
||||||
|
@ -1833,11 +1821,6 @@ __reg_process_hint_user(struct regulatory_request *user_request)
|
||||||
{
|
{
|
||||||
struct regulatory_request *lr = get_last_request();
|
struct regulatory_request *lr = get_last_request();
|
||||||
|
|
||||||
if (reg_request_indoor(user_request)) {
|
|
||||||
reg_is_indoor = true;
|
|
||||||
return REG_REQ_USER_HINT_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reg_request_cell_base(user_request))
|
if (reg_request_cell_base(user_request))
|
||||||
return reg_ignore_cell_hint(user_request);
|
return reg_ignore_cell_hint(user_request);
|
||||||
|
|
||||||
|
@ -1885,8 +1868,7 @@ reg_process_hint_user(struct regulatory_request *user_request)
|
||||||
|
|
||||||
treatment = __reg_process_hint_user(user_request);
|
treatment = __reg_process_hint_user(user_request);
|
||||||
if (treatment == REG_REQ_IGNORE ||
|
if (treatment == REG_REQ_IGNORE ||
|
||||||
treatment == REG_REQ_ALREADY_SET ||
|
treatment == REG_REQ_ALREADY_SET) {
|
||||||
treatment == REG_REQ_USER_HINT_HANDLED) {
|
|
||||||
reg_free_request(user_request);
|
reg_free_request(user_request);
|
||||||
return treatment;
|
return treatment;
|
||||||
}
|
}
|
||||||
|
@ -1947,7 +1929,6 @@ reg_process_hint_driver(struct wiphy *wiphy,
|
||||||
case REG_REQ_OK:
|
case REG_REQ_OK:
|
||||||
break;
|
break;
|
||||||
case REG_REQ_IGNORE:
|
case REG_REQ_IGNORE:
|
||||||
case REG_REQ_USER_HINT_HANDLED:
|
|
||||||
reg_free_request(driver_request);
|
reg_free_request(driver_request);
|
||||||
return treatment;
|
return treatment;
|
||||||
case REG_REQ_INTERSECT:
|
case REG_REQ_INTERSECT:
|
||||||
|
@ -2047,7 +2028,6 @@ reg_process_hint_country_ie(struct wiphy *wiphy,
|
||||||
case REG_REQ_OK:
|
case REG_REQ_OK:
|
||||||
break;
|
break;
|
||||||
case REG_REQ_IGNORE:
|
case REG_REQ_IGNORE:
|
||||||
case REG_REQ_USER_HINT_HANDLED:
|
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case REG_REQ_ALREADY_SET:
|
case REG_REQ_ALREADY_SET:
|
||||||
reg_free_request(country_ie_request);
|
reg_free_request(country_ie_request);
|
||||||
|
@ -2086,8 +2066,7 @@ static void reg_process_hint(struct regulatory_request *reg_request)
|
||||||
case NL80211_REGDOM_SET_BY_USER:
|
case NL80211_REGDOM_SET_BY_USER:
|
||||||
treatment = reg_process_hint_user(reg_request);
|
treatment = reg_process_hint_user(reg_request);
|
||||||
if (treatment == REG_REQ_IGNORE ||
|
if (treatment == REG_REQ_IGNORE ||
|
||||||
treatment == REG_REQ_ALREADY_SET ||
|
treatment == REG_REQ_ALREADY_SET)
|
||||||
treatment == REG_REQ_USER_HINT_HANDLED)
|
|
||||||
return;
|
return;
|
||||||
queue_delayed_work(system_power_efficient_wq,
|
queue_delayed_work(system_power_efficient_wq,
|
||||||
®_timeout, msecs_to_jiffies(3142));
|
®_timeout, msecs_to_jiffies(3142));
|
||||||
|
@ -2311,16 +2290,9 @@ int regulatory_hint_user(const char *alpha2,
|
||||||
|
|
||||||
int regulatory_hint_indoor_user(void)
|
int regulatory_hint_indoor_user(void)
|
||||||
{
|
{
|
||||||
struct regulatory_request *request;
|
|
||||||
|
|
||||||
request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL);
|
|
||||||
if (!request)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
request->wiphy_idx = WIPHY_IDX_INVALID;
|
reg_is_indoor = true;
|
||||||
request->initiator = NL80211_REGDOM_SET_BY_USER;
|
|
||||||
request->user_reg_hint_type = NL80211_USER_REG_HINT_INDOOR;
|
|
||||||
queue_regulatory_request(request);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue