diff options
author | Ilan peer <ilan.peer@intel.com> | 2015-03-04 00:32:05 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-03-06 03:37:38 -0500 |
commit | 0c4ddcd214f5bc72713473e8383041ab7a2c6bb7 (patch) | |
tree | 3248c71f0afb4a4c5dd9cb07af631f1eb9021f34 /net/wireless | |
parent | 560676282e19a9cb99378547530aca3d085eb99f (diff) |
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>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/reg.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index b586d0dcb09e..c24c8bf3c988 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -82,17 +82,12 @@ | |||
82 | * be intersected with the current one. | 82 | * be intersected with the current one. |
83 | * @REG_REQ_ALREADY_SET: the regulatory request will not change the current | 83 | * @REG_REQ_ALREADY_SET: the regulatory request will not change the current |
84 | * regulatory settings, and no further processing is required. | 84 | * regulatory settings, and no further processing is required. |
85 | * @REG_REQ_USER_HINT_HANDLED: a non alpha2 user hint was handled and no | ||
86 | * further processing is required, i.e., not need to update last_request | ||
87 | * etc. This should be used for user hints that do not provide an alpha2 | ||
88 | * but some other type of regulatory hint, i.e., indoor operation. | ||
89 | */ | 85 | */ |
90 | enum reg_request_treatment { | 86 | enum reg_request_treatment { |
91 | REG_REQ_OK, | 87 | REG_REQ_OK, |
92 | REG_REQ_IGNORE, | 88 | REG_REQ_IGNORE, |
93 | REG_REQ_INTERSECT, | 89 | REG_REQ_INTERSECT, |
94 | REG_REQ_ALREADY_SET, | 90 | REG_REQ_ALREADY_SET, |
95 | REG_REQ_USER_HINT_HANDLED, | ||
96 | }; | 91 | }; |
97 | 92 | ||
98 | static struct regulatory_request core_request_world = { | 93 | static struct regulatory_request core_request_world = { |
@@ -1248,13 +1243,6 @@ static bool reg_request_cell_base(struct regulatory_request *request) | |||
1248 | return request->user_reg_hint_type == NL80211_USER_REG_HINT_CELL_BASE; | 1243 | return request->user_reg_hint_type == NL80211_USER_REG_HINT_CELL_BASE; |
1249 | } | 1244 | } |
1250 | 1245 | ||
1251 | static bool reg_request_indoor(struct regulatory_request *request) | ||
1252 | { | ||
1253 | if (request->initiator != NL80211_REGDOM_SET_BY_USER) | ||
1254 | return false; | ||
1255 | return request->user_reg_hint_type == NL80211_USER_REG_HINT_INDOOR; | ||
1256 | } | ||
1257 | |||
1258 | bool reg_last_request_cell_base(void) | 1246 | bool reg_last_request_cell_base(void) |
1259 | { | 1247 | { |
1260 | return reg_request_cell_base(get_last_request()); | 1248 | return reg_request_cell_base(get_last_request()); |
@@ -1833,11 +1821,6 @@ __reg_process_hint_user(struct regulatory_request *user_request) | |||
1833 | { | 1821 | { |
1834 | struct regulatory_request *lr = get_last_request(); | 1822 | struct regulatory_request *lr = get_last_request(); |
1835 | 1823 | ||
1836 | if (reg_request_indoor(user_request)) { | ||
1837 | reg_is_indoor = true; | ||
1838 | return REG_REQ_USER_HINT_HANDLED; | ||
1839 | } | ||
1840 | |||
1841 | if (reg_request_cell_base(user_request)) | 1824 | if (reg_request_cell_base(user_request)) |
1842 | return reg_ignore_cell_hint(user_request); | 1825 | return reg_ignore_cell_hint(user_request); |
1843 | 1826 | ||
@@ -1885,8 +1868,7 @@ reg_process_hint_user(struct regulatory_request *user_request) | |||
1885 | 1868 | ||
1886 | treatment = __reg_process_hint_user(user_request); | 1869 | treatment = __reg_process_hint_user(user_request); |
1887 | if (treatment == REG_REQ_IGNORE || | 1870 | if (treatment == REG_REQ_IGNORE || |
1888 | treatment == REG_REQ_ALREADY_SET || | 1871 | treatment == REG_REQ_ALREADY_SET) { |
1889 | treatment == REG_REQ_USER_HINT_HANDLED) { | ||
1890 | reg_free_request(user_request); | 1872 | reg_free_request(user_request); |
1891 | return treatment; | 1873 | return treatment; |
1892 | } | 1874 | } |
@@ -1947,7 +1929,6 @@ reg_process_hint_driver(struct wiphy *wiphy, | |||
1947 | case REG_REQ_OK: | 1929 | case REG_REQ_OK: |
1948 | break; | 1930 | break; |
1949 | case REG_REQ_IGNORE: | 1931 | case REG_REQ_IGNORE: |
1950 | case REG_REQ_USER_HINT_HANDLED: | ||
1951 | reg_free_request(driver_request); | 1932 | reg_free_request(driver_request); |
1952 | return treatment; | 1933 | return treatment; |
1953 | case REG_REQ_INTERSECT: | 1934 | case REG_REQ_INTERSECT: |
@@ -2047,7 +2028,6 @@ reg_process_hint_country_ie(struct wiphy *wiphy, | |||
2047 | case REG_REQ_OK: | 2028 | case REG_REQ_OK: |
2048 | break; | 2029 | break; |
2049 | case REG_REQ_IGNORE: | 2030 | case REG_REQ_IGNORE: |
2050 | case REG_REQ_USER_HINT_HANDLED: | ||
2051 | /* fall through */ | 2031 | /* fall through */ |
2052 | case REG_REQ_ALREADY_SET: | 2032 | case REG_REQ_ALREADY_SET: |
2053 | reg_free_request(country_ie_request); | 2033 | reg_free_request(country_ie_request); |
@@ -2086,8 +2066,7 @@ static void reg_process_hint(struct regulatory_request *reg_request) | |||
2086 | case NL80211_REGDOM_SET_BY_USER: | 2066 | case NL80211_REGDOM_SET_BY_USER: |
2087 | treatment = reg_process_hint_user(reg_request); | 2067 | treatment = reg_process_hint_user(reg_request); |
2088 | if (treatment == REG_REQ_IGNORE || | 2068 | if (treatment == REG_REQ_IGNORE || |
2089 | treatment == REG_REQ_ALREADY_SET || | 2069 | treatment == REG_REQ_ALREADY_SET) |
2090 | treatment == REG_REQ_USER_HINT_HANDLED) | ||
2091 | return; | 2070 | return; |
2092 | queue_delayed_work(system_power_efficient_wq, | 2071 | queue_delayed_work(system_power_efficient_wq, |
2093 | ®_timeout, msecs_to_jiffies(3142)); | 2072 | ®_timeout, msecs_to_jiffies(3142)); |
@@ -2311,16 +2290,9 @@ int regulatory_hint_user(const char *alpha2, | |||
2311 | 2290 | ||
2312 | int regulatory_hint_indoor_user(void) | 2291 | int regulatory_hint_indoor_user(void) |
2313 | { | 2292 | { |
2314 | struct regulatory_request *request; | ||
2315 | 2293 | ||
2316 | request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); | ||
2317 | if (!request) | ||
2318 | return -ENOMEM; | ||
2319 | 2294 | ||
2320 | request->wiphy_idx = WIPHY_IDX_INVALID; | 2295 | reg_is_indoor = true; |
2321 | request->initiator = NL80211_REGDOM_SET_BY_USER; | ||
2322 | request->user_reg_hint_type = NL80211_USER_REG_HINT_INDOOR; | ||
2323 | queue_regulatory_request(request); | ||
2324 | 2296 | ||
2325 | return 0; | 2297 | return 0; |
2326 | } | 2298 | } |