Commit a3df43b1 authored by Johannes Berg's avatar Johannes Berg
Browse files

wifi: mac80211: unregister netdevs through cfg80211



Since we want to have wiphy_lock() for the unregistration
in the future, unregister also netdevs via cfg80211 now
to be able to hold the wiphy_lock() for it.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 16114496
Loading
Loading
Loading
Loading
+7 −13
Original line number Diff line number Diff line
@@ -2258,7 +2258,6 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local)
{
	struct ieee80211_sub_if_data *sdata, *tmp;
	LIST_HEAD(unreg_list);
	LIST_HEAD(wdev_list);

	ASSERT_RTNL();

@@ -2281,22 +2280,17 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local)
	ieee80211_txq_teardown_flows(local);

	mutex_lock(&local->iflist_mtx);
	list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
		list_del(&sdata->list);

		if (sdata->dev)
			unregister_netdevice_queue(sdata->dev, &unreg_list);
		else
			list_add(&sdata->list, &wdev_list);
	}
	list_splice_init(&local->interfaces, &unreg_list);
	mutex_unlock(&local->iflist_mtx);

	unregister_netdevice_many(&unreg_list);

	wiphy_lock(local->hw.wiphy);
	list_for_each_entry_safe(sdata, tmp, &wdev_list, list) {
	list_for_each_entry_safe(sdata, tmp, &unreg_list, list) {
		bool netdev = sdata->dev;

		list_del(&sdata->list);
		cfg80211_unregister_wdev(&sdata->wdev);

		if (!netdev)
			kfree(sdata);
	}
	wiphy_unlock(local->hw.wiphy);