/* @local: local interface data @sdata: matching rule for the net device (sta->dev) or NULL to match all STAs  */
int sta_info_flush(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata)
/* @local: local interface data @sdata: matching rule for the net device (sta->dev) or NULL to match all STAs  */
int sta_info_flush(struct ieee80211_local *local, struct ieee80211_sub_if_data *sdata)
{
	struct sta_info *sta, *tmp;
	LIST_HEAD(tmp_list);
	int ret = 0;
	unsigned long flags;
	might_sleep();
	spin_lock_irqsave(&local->sta_lock, flags);
	list_for_each_entry_safe(sta, tmp, &local->sta_list, list) {
		if (!sdata || sdata == sta->sdata) {
			__sta_info_unlink(&sta);
			if (sta) {
				list_add_tail(&sta->list, &tmp_list);
				ret++;
			}
		}
	}
	spin_unlock_irqrestore(&local->sta_lock, flags);
	list_for_each_entry_safe(sta, tmp, &tmp_list, list)
		sta_info_destroy(sta);
	return ret;
}