aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-08-05 14:26:24 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-16 14:39:47 -0400
commitc61029c77fb68d7a182c0ae010f0f9dcae4e196c (patch)
tree74f63730da29daf894d23abf5dc5cd182fa861f0 /net/wireless/reg.c
parent31a5cddaaed9c04ef653e3c2900cfb5a646fe686 (diff)
wireless: upcase alpha2 values in queue_regulatory_request
This provides a little more flexibility for human users, and it allows us to use isalpha rather than the custom is_alpha_upper. Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index f180db0de66c..b0d9a08447c9 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -36,6 +36,7 @@
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/list.h> 37#include <linux/list.h>
38#include <linux/random.h> 38#include <linux/random.h>
39#include <linux/ctype.h>
39#include <linux/nl80211.h> 40#include <linux/nl80211.h>
40#include <linux/platform_device.h> 41#include <linux/platform_device.h>
41#include <net/cfg80211.h> 42#include <net/cfg80211.h>
@@ -181,14 +182,6 @@ static bool is_alpha2_set(const char *alpha2)
181 return false; 182 return false;
182} 183}
183 184
184static bool is_alpha_upper(char letter)
185{
186 /* ASCII A - Z */
187 if (letter >= 65 && letter <= 90)
188 return true;
189 return false;
190}
191
192static bool is_unknown_alpha2(const char *alpha2) 185static bool is_unknown_alpha2(const char *alpha2)
193{ 186{
194 if (!alpha2) 187 if (!alpha2)
@@ -220,7 +213,7 @@ static bool is_an_alpha2(const char *alpha2)
220{ 213{
221 if (!alpha2) 214 if (!alpha2)
222 return false; 215 return false;
223 if (is_alpha_upper(alpha2[0]) && is_alpha_upper(alpha2[1])) 216 if (isalpha(alpha2[0]) && isalpha(alpha2[1]))
224 return true; 217 return true;
225 return false; 218 return false;
226} 219}
@@ -1399,6 +1392,11 @@ static DECLARE_WORK(reg_work, reg_todo);
1399 1392
1400static void queue_regulatory_request(struct regulatory_request *request) 1393static void queue_regulatory_request(struct regulatory_request *request)
1401{ 1394{
1395 if (isalpha(request->alpha2[0]))
1396 request->alpha2[0] = toupper(request->alpha2[0]);
1397 if (isalpha(request->alpha2[1]))
1398 request->alpha2[1] = toupper(request->alpha2[1]);
1399
1402 spin_lock(&reg_requests_lock); 1400 spin_lock(&reg_requests_lock);
1403 list_add_tail(&request->list, &reg_requests_list); 1401 list_add_tail(&request->list, &reg_requests_list);
1404 spin_unlock(&reg_requests_lock); 1402 spin_unlock(&reg_requests_lock);