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>
This commit is contained in:
parent
6658ab80fd
commit
1226d25870
2 changed files with 8 additions and 30 deletions
|
@ -91,10 +91,6 @@ static struct regulatory_request __rcu *last_request =
|
|||
/* To trigger userspace events */
|
||||
static struct platform_device *reg_pdev;
|
||||
|
||||
static const struct device_type reg_device_type = {
|
||||
.uevent = reg_device_uevent,
|
||||
};
|
||||
|
||||
/*
|
||||
* Central wireless core regulatory domains, we only need two,
|
||||
* 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) {}
|
|||
|
||||
/*
|
||||
* This lets us keep regulatory code which is updated on a regulatory
|
||||
* basis in userspace. Country information is filled in by
|
||||
* reg_device_uevent
|
||||
* basis in userspace.
|
||||
*/
|
||||
static int call_crda(const char *alpha2)
|
||||
{
|
||||
char country[12];
|
||||
char *env[] = { country, NULL };
|
||||
|
||||
snprintf(country, sizeof(country), "COUNTRY=%c%c",
|
||||
alpha2[0], alpha2[1]);
|
||||
|
||||
if (!is_world_regdom((char *) alpha2))
|
||||
pr_info("Calling CRDA for country: %c%c\n",
|
||||
alpha2[0], alpha2[1]);
|
||||
|
@ -501,7 +502,7 @@ static int call_crda(const char *alpha2)
|
|||
/* query internal regulatory database (if it exists) */
|
||||
reg_regdb_query(alpha2);
|
||||
|
||||
return kobject_uevent(®_pdev->dev.kobj, KOBJ_CHANGE);
|
||||
return kobject_uevent_env(®_pdev->dev.kobj, KOBJ_CHANGE, env);
|
||||
}
|
||||
|
||||
static enum reg_request_treatment
|
||||
|
@ -2544,26 +2545,6 @@ int set_regdom(const struct ieee80211_regdomain *rd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
{
|
||||
struct regulatory_request *lr;
|
||||
u8 alpha2[2];
|
||||
bool add = false;
|
||||
|
||||
rcu_read_lock();
|
||||
lr = get_last_request();
|
||||
if (lr && !lr->processed) {
|
||||
memcpy(alpha2, lr->alpha2, 2);
|
||||
add = true;
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
if (add)
|
||||
return add_uevent_var(env, "COUNTRY=%c%c",
|
||||
alpha2[0], alpha2[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wiphy_regulatory_register(struct wiphy *wiphy)
|
||||
{
|
||||
struct regulatory_request *lr;
|
||||
|
@ -2614,8 +2595,6 @@ int __init regulatory_init(void)
|
|||
if (IS_ERR(reg_pdev))
|
||||
return PTR_ERR(reg_pdev);
|
||||
|
||||
reg_pdev->dev.type = ®_device_type;
|
||||
|
||||
spin_lock_init(®_requests_lock);
|
||||
spin_lock_init(®_pending_beacons_lock);
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy);
|
|||
int regulatory_hint_user(const char *alpha2,
|
||||
enum nl80211_user_reg_hint_type user_reg_hint_type);
|
||||
|
||||
int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env);
|
||||
void wiphy_regulatory_register(struct wiphy *wiphy);
|
||||
void wiphy_regulatory_deregister(struct wiphy *wiphy);
|
||||
|
||||
|
|
Loading…
Reference in a new issue