for_each_chanctx_user_all(local, ctx, &iter)
num++;
+ /*
+ * This ctx is in the process of getting used,
+ * take it into consideration
+ */
+ if (ctx->will_be_used)
+ num++;
+
return num;
}
_ieee80211_change_chanctx(local, ctx, old_ctx, chanreq, NULL);
}
-/* Note: if successful, the returned chanctx is reserved for the link */
+/* Note: if successful, the returned chanctx will_be_used flag is set */
static struct ieee80211_chanctx *
ieee80211_find_chanctx(struct ieee80211_local *local,
- struct ieee80211_link_data *link,
const struct ieee80211_chan_req *chanreq,
enum ieee80211_chanctx_mode mode)
{
if (mode == IEEE80211_CHANCTX_EXCLUSIVE)
return NULL;
- if (WARN_ON(link->reserved_chanctx))
- return NULL;
-
list_for_each_entry(ctx, &local->chanctx_list, list) {
const struct ieee80211_chan_req *compat;
continue;
/*
- * Reserve the chanctx temporarily, as the driver might change
+ * Mark the chanctx as will be used, as the driver might change
* active links during callbacks we make into it below and/or
* later during assignment, which could (otherwise) cause the
* context to actually be removed.
*/
- link->reserved_chanctx = ctx;
+ ctx->will_be_used = true;
ieee80211_change_chanctx(local, ctx, ctx, compat);
if (!local->in_reconfig)
__ieee80211_link_release_channel(link, false);
- ctx = ieee80211_find_chanctx(local, link, chanreq, mode);
- /* Note: context is now reserved */
+ ctx = ieee80211_find_chanctx(local, chanreq, mode);
+ /* Note: context will_be_used flag is now set */
if (ctx)
reserved = true;
else if (!ieee80211_find_available_radio(local, chanreq,
ret = ieee80211_assign_link_chanctx(link, ctx, assign_on_failure);
if (reserved) {
- /* remove reservation */
- WARN_ON(link->reserved_chanctx != ctx);
- link->reserved_chanctx = NULL;
+ WARN_ON(!ctx->will_be_used);
+ ctx->will_be_used = false;
}
if (ret) {