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

Commit 120c6df3 authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cfg80211: avoid restoring the regulatory during disconnect" into msm-4.8

parents 51449c1f 4216dfb7
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -47,6 +47,29 @@ struct cfg80211_conn {
	bool auto_auth, prev_bssid_valid;
};

static bool cfg80211_is_all_countryie_ignore(void)
{
	struct cfg80211_registered_device *rdev;
	struct wireless_dev *wdev;
	bool is_all_countryie_ignore = true;

	list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
		list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
			wdev_lock(wdev);
			if (!(wdev->wiphy->regulatory_flags &
				REGULATORY_COUNTRY_IE_IGNORE)) {
				is_all_countryie_ignore = false;
				wdev_unlock(wdev);
				goto out;
			}
			wdev_unlock(wdev);
		}
	}

out:
	return is_all_countryie_ignore;
}

static void cfg80211_sme_free(struct wireless_dev *wdev)
{
	if (!wdev->conn)
@@ -629,7 +652,8 @@ static bool cfg80211_is_all_idle(void)
static void disconnect_work(struct work_struct *work)
{
	rtnl_lock();
	if (cfg80211_is_all_idle())
	if (cfg80211_is_all_idle() &&
	    !cfg80211_is_all_countryie_ignore())
		regulatory_hint_disconnect();
	rtnl_unlock();
}