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

Commit 4c796a9c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cfg80211: avoid restoring the regulatory during disconnect"

parents 32e5112c 47f2bf24
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -66,11 +66,45 @@ static bool cfg80211_is_all_idle(void)
	return is_all_idle;
}


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

	mutex_lock(&cfg80211_mutex);

	list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
		cfg80211_lock_rdev(rdev);
		list_for_each_entry(wdev, &rdev->wdev_list, list) {
			wdev_lock(wdev);
			if (!(wdev->wiphy->country_ie_pref &
				NL80211_COUNTRY_IE_IGNORE_CORE)) {
				is_all_countryie_ignore = false;
				wdev_unlock(wdev);
				cfg80211_unlock_rdev(rdev);
				goto out;
			}
			wdev_unlock(wdev);
		}
		cfg80211_unlock_rdev(rdev);
	}
out:
	mutex_unlock(&cfg80211_mutex);

	return is_all_countryie_ignore;
}


static void disconnect_work(struct work_struct *work)
{
	if (!cfg80211_is_all_idle())
		return;

	if (cfg80211_is_all_countryie_ignore())
		return;

	regulatory_hint_disconnect();
}