aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-02-25 09:43:36 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-02-25 09:44:44 -0500
commit1226d2587065f98dae54c79e14dd329879b896f7 (patch)
tree28a4502fdb2722673688a8ea345bc9834c2b1a0f /net/wireless/reg.c
parent6658ab80fd4ef940fc2366ddb66690a15ea69c18 (diff)
cfg80211: regulatory: simplify uevent sending
There's no need for the struct device_type with the uevent function etc., just fill the country alpha2 when sending the event. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c37
1 files changed, 8 insertions, 29 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 6b6f33ad78f2..c9844d264312 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -91,10 +91,6 @@ static struct regulatory_request __rcu *last_request =
91/* To trigger userspace events */ 91/* To trigger userspace events */
92static struct platform_device *reg_pdev; 92static struct platform_device *reg_pdev;
93 93
94static const struct device_type reg_device_type = {
95 .uevent = reg_device_uevent,
96};
97
98/* 94/*
99 * Central wireless core regulatory domains, we only need two, 95 * Central wireless core regulatory domains, we only need two,
100 * the current one and a world regulatory domain in case we have no 96 * the current one and a world regulatory domain in case we have no
@@ -487,11 +483,16 @@ static inline void reg_regdb_query(const char *alpha2) {}
487 483
488/* 484/*
489 * This lets us keep regulatory code which is updated on a regulatory 485 * This lets us keep regulatory code which is updated on a regulatory
490 * basis in userspace. Country information is filled in by 486 * basis in userspace.
491 * reg_device_uevent
492 */ 487 */
493static int call_crda(const char *alpha2) 488static int call_crda(const char *alpha2)
494{ 489{
490 char country[12];
491 char *env[] = { country, NULL };
492
493 snprintf(country, sizeof(country), "COUNTRY=%c%c",
494 alpha2[0], alpha2[1]);
495
495 if (!is_world_regdom((char *) alpha2)) 496 if (!is_world_regdom((char *) alpha2))
496 pr_info("Calling CRDA for country: %c%c\n", 497 pr_info("Calling CRDA for country: %c%c\n",
497 alpha2[0], alpha2[1]); 498 alpha2[0], alpha2[1]);
@@ -501,7 +502,7 @@ static int call_crda(const char *alpha2)
501 /* query internal regulatory database (if it exists) */ 502 /* query internal regulatory database (if it exists) */
502 reg_regdb_query(alpha2); 503 reg_regdb_query(alpha2);
503 504
504 return kobject_uevent(&reg_pdev->dev.kobj, KOBJ_CHANGE); 505 return kobject_uevent_env(&reg_pdev->dev.kobj, KOBJ_CHANGE, env);
505} 506}
506 507
507static enum reg_request_treatment 508static enum reg_request_treatment
@@ -2544,26 +2545,6 @@ int set_regdom(const struct ieee80211_regdomain *rd)
2544 return 0; 2545 return 0;
2545} 2546}
2546 2547
2547int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
2548{
2549 struct regulatory_request *lr;
2550 u8 alpha2[2];
2551 bool add = false;
2552
2553 rcu_read_lock();
2554 lr = get_last_request();
2555 if (lr && !lr->processed) {
2556 memcpy(alpha2, lr->alpha2, 2);
2557 add = true;
2558 }
2559 rcu_read_unlock();
2560
2561 if (add)
2562 return add_uevent_var(env, "COUNTRY=%c%c",
2563 alpha2[0], alpha2[1]);
2564 return 0;
2565}
2566
2567void wiphy_regulatory_register(struct wiphy *wiphy) 2548void wiphy_regulatory_register(struct wiphy *wiphy)
2568{ 2549{
2569 struct regulatory_request *lr; 2550 struct regulatory_request *lr;
@@ -2614,8 +2595,6 @@ int __init regulatory_init(void)
2614 if (IS_ERR(reg_pdev)) 2595 if (IS_ERR(reg_pdev))
2615 return PTR_ERR(reg_pdev); 2596 return PTR_ERR(reg_pdev);
2616 2597
2617 reg_pdev->dev.type = &reg_device_type;
2618
2619 spin_lock_init(&reg_requests_lock); 2598 spin_lock_init(&reg_requests_lock);
2620 spin_lock_init(&reg_pending_beacons_lock); 2599 spin_lock_init(&reg_pending_beacons_lock);
2621 2600