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>
This commit is contained in:
parent
31a5cddaae
commit
c61029c77f
1 changed files with 7 additions and 9 deletions
|
@ -36,6 +36,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/list.h>
|
#include <linux/list.h>
|
||||||
#include <linux/random.h>
|
#include <linux/random.h>
|
||||||
|
#include <linux/ctype.h>
|
||||||
#include <linux/nl80211.h>
|
#include <linux/nl80211.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <net/cfg80211.h>
|
#include <net/cfg80211.h>
|
||||||
|
@ -181,14 +182,6 @@ static bool is_alpha2_set(const char *alpha2)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_alpha_upper(char letter)
|
|
||||||
{
|
|
||||||
/* ASCII A - Z */
|
|
||||||
if (letter >= 65 && letter <= 90)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool is_unknown_alpha2(const char *alpha2)
|
static bool is_unknown_alpha2(const char *alpha2)
|
||||||
{
|
{
|
||||||
if (!alpha2)
|
if (!alpha2)
|
||||||
|
@ -220,7 +213,7 @@ static bool is_an_alpha2(const char *alpha2)
|
||||||
{
|
{
|
||||||
if (!alpha2)
|
if (!alpha2)
|
||||||
return false;
|
return false;
|
||||||
if (is_alpha_upper(alpha2[0]) && is_alpha_upper(alpha2[1]))
|
if (isalpha(alpha2[0]) && isalpha(alpha2[1]))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1399,6 +1392,11 @@ static DECLARE_WORK(reg_work, reg_todo);
|
||||||
|
|
||||||
static void queue_regulatory_request(struct regulatory_request *request)
|
static void queue_regulatory_request(struct regulatory_request *request)
|
||||||
{
|
{
|
||||||
|
if (isalpha(request->alpha2[0]))
|
||||||
|
request->alpha2[0] = toupper(request->alpha2[0]);
|
||||||
|
if (isalpha(request->alpha2[1]))
|
||||||
|
request->alpha2[1] = toupper(request->alpha2[1]);
|
||||||
|
|
||||||
spin_lock(®_requests_lock);
|
spin_lock(®_requests_lock);
|
||||||
list_add_tail(&request->list, ®_requests_list);
|
list_add_tail(&request->list, ®_requests_list);
|
||||||
spin_unlock(®_requests_lock);
|
spin_unlock(®_requests_lock);
|
||||||
|
|
Loading…
Add table
Reference in a new issue