Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe33eb39 authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville
Browse files

cfg80211: move all regulatory hints to workqueue



All regulatory hints (core, driver, userspace and 11d) are now processed in
a workqueue.

Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 0441d6ff
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1656,8 +1656,12 @@ int ath_attach(u16 devid, struct ath_softc *sc)

	error = ieee80211_register_hw(hw);

	if (!ath9k_is_world_regd(sc->sc_ah))
		regulatory_hint(hw->wiphy, sc->sc_ah->regulatory.alpha2);
	if (!ath9k_is_world_regd(sc->sc_ah)) {
		error = regulatory_hint(hw->wiphy,
			sc->sc_ah->regulatory.alpha2);
		if (error)
			goto error_attach;
	}

	/* Initialize LED control */
	ath_init_leds(sc);
+3 −3
Original line number Diff line number Diff line
@@ -170,10 +170,10 @@ int zd_mac_init_hw(struct ieee80211_hw *hw)
		goto disable_int;

	r = zd_reg2alpha2(mac->regdomain, alpha2);
	if (!r)
		regulatory_hint(hw->wiphy, alpha2);
	if (r)
		goto disable_int;

	r = 0;
	r = regulatory_hint(hw->wiphy, alpha2);
disable_int:
	zd_chip_disable_int(chip);
out:
+2 −0
Original line number Diff line number Diff line
@@ -404,6 +404,7 @@ enum environment_cap {
 * 	country IE
 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
 * 	indoor, or if it doesn't matter
 * @list: used to insert into the reg_requests_list linked list
 */
struct regulatory_request {
	int wiphy_idx;
@@ -412,6 +413,7 @@ struct regulatory_request {
	bool intersect;
	u32 country_ie_checksum;
	enum environment_cap country_ie_env;
	struct list_head list;
};

struct ieee80211_freq_range {
+8 −1
Original line number Diff line number Diff line
@@ -401,8 +401,15 @@ ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
 * domain should be in or by providing a completely build regulatory domain.
 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
 * for a regulatory domain structure for the respective country.
 *
 * The wiphy must have been registered to cfg80211 prior to this call.
 * For cfg80211 drivers this means you must first use wiphy_register(),
 * for mac80211 drivers you must first use ieee80211_register_hw().
 *
 * Drivers should check the return value, its possible you can get
 * an -ENOMEM.
 */
extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2);
extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);

/**
 * regulatory_hint_11d - hints a country IE as a regulatory domain
+10 −20
Original line number Diff line number Diff line
@@ -1915,34 +1915,24 @@ static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info)
	 */
	mutex_lock(&cfg80211_mutex);
	if (unlikely(!cfg80211_regdomain)) {
		r = -EINPROGRESS;
		goto out;
		mutex_unlock(&cfg80211_mutex);
		return -EINPROGRESS;
	}
	mutex_unlock(&cfg80211_mutex);

	if (!info->attrs[NL80211_ATTR_REG_ALPHA2]) {
		r = -EINVAL;
		goto out;
	}
	if (!info->attrs[NL80211_ATTR_REG_ALPHA2])
		return -EINVAL;

	data = nla_data(info->attrs[NL80211_ATTR_REG_ALPHA2]);

#ifdef CONFIG_WIRELESS_OLD_REGULATORY
	/* We ignore world regdom requests with the old regdom setup */
	if (is_world_regdom(data)) {
		r = -EINVAL;
		goto out;
	}
	if (is_world_regdom(data))
		return -EINVAL;
#endif
	r = __regulatory_hint(NULL, REGDOM_SET_BY_USER, data, 0, ENVIRON_ANY);
	/*
	 * This means the regulatory domain was already set, however
	 * we don't want to confuse userspace with a "successful error"
	 * message so lets just treat it as a success
	 */
	if (r == -EALREADY)
		r = 0;
out:
	mutex_unlock(&cfg80211_mutex);

	r = regulatory_hint_user(data);

	return r;
}

Loading