aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index ed89c59bb431..422da20d1e5b 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -33,6 +33,7 @@
33 * 33 *
34 */ 34 */
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/slab.h>
36#include <linux/list.h> 37#include <linux/list.h>
37#include <linux/random.h> 38#include <linux/random.h>
38#include <linux/nl80211.h> 39#include <linux/nl80211.h>
@@ -324,7 +325,7 @@ struct reg_regdb_search_request {
324}; 325};
325 326
326static LIST_HEAD(reg_regdb_search_list); 327static LIST_HEAD(reg_regdb_search_list);
327static DEFINE_SPINLOCK(reg_regdb_search_lock); 328static DEFINE_MUTEX(reg_regdb_search_mutex);
328 329
329static void reg_regdb_search(struct work_struct *work) 330static void reg_regdb_search(struct work_struct *work)
330{ 331{
@@ -332,7 +333,7 @@ static void reg_regdb_search(struct work_struct *work)
332 const struct ieee80211_regdomain *curdom, *regdom; 333 const struct ieee80211_regdomain *curdom, *regdom;
333 int i, r; 334 int i, r;
334 335
335 spin_lock(&reg_regdb_search_lock); 336 mutex_lock(&reg_regdb_search_mutex);
336 while (!list_empty(&reg_regdb_search_list)) { 337 while (!list_empty(&reg_regdb_search_list)) {
337 request = list_first_entry(&reg_regdb_search_list, 338 request = list_first_entry(&reg_regdb_search_list,
338 struct reg_regdb_search_request, 339 struct reg_regdb_search_request,
@@ -346,18 +347,16 @@ static void reg_regdb_search(struct work_struct *work)
346 r = reg_copy_regd(&regdom, curdom); 347 r = reg_copy_regd(&regdom, curdom);
347 if (r) 348 if (r)
348 break; 349 break;
349 spin_unlock(&reg_regdb_search_lock);
350 mutex_lock(&cfg80211_mutex); 350 mutex_lock(&cfg80211_mutex);
351 set_regdom(regdom); 351 set_regdom(regdom);
352 mutex_unlock(&cfg80211_mutex); 352 mutex_unlock(&cfg80211_mutex);
353 spin_lock(&reg_regdb_search_lock);
354 break; 353 break;
355 } 354 }
356 } 355 }
357 356
358 kfree(request); 357 kfree(request);
359 } 358 }
360 spin_unlock(&reg_regdb_search_lock); 359 mutex_unlock(&reg_regdb_search_mutex);
361} 360}
362 361
363static DECLARE_WORK(reg_regdb_work, reg_regdb_search); 362static DECLARE_WORK(reg_regdb_work, reg_regdb_search);
@@ -375,9 +374,9 @@ static void reg_regdb_query(const char *alpha2)
375 374
376 memcpy(request->alpha2, alpha2, 2); 375 memcpy(request->alpha2, alpha2, 2);
377 376
378 spin_lock(&reg_regdb_search_lock); 377 mutex_lock(&reg_regdb_search_mutex);
379 list_add_tail(&request->list, &reg_regdb_search_list); 378 list_add_tail(&request->list, &reg_regdb_search_list);
380 spin_unlock(&reg_regdb_search_lock); 379 mutex_unlock(&reg_regdb_search_mutex);
381 380
382 schedule_work(&reg_regdb_work); 381 schedule_work(&reg_regdb_work);
383} 382}