On Sun, Mar 9, 2014 at 11:47 AM, Eliad Peller <eliad@xxxxxxxxxx> wrote: > On Fri, Mar 7, 2014 at 1:19 PM, Michal Kazior <michal.kazior@xxxxxxxxx> wrote: >> It doesn't make much sense to have a manually >> managed chanctx refcount. It isn't performance >> critical and it can't be even used outside the >> protection of chanctx_mtx. >> >> With future enhancements to channel contenxt >> (namely reservations) refcount accounting will >> become more complex and having manually managed >> refcount is going to be error-prone and confusing. >> >> The refcount is now equal to the number of vifs it >> is assigned to. However in the future this will >> change so keep the refcount/num_assigned_vifs >> functions split now. >> >> Signed-off-by: Michal Kazior <michal.kazior@xxxxxxxxx> >> --- > [...] > >> +int ieee80211_chanctx_num_assigned_vifs(struct ieee80211_chanctx *ctx) >> +{ >> + struct ieee80211_local *local = ctx->local; >> + struct ieee80211_sub_if_data *sdata; >> + int num = 0; >> + >> + lockdep_assert_held(&local->chanctx_mtx); >> + >> + rcu_read_lock(); >> + list_for_each_entry_rcu(sdata, &local->interfaces, list) >> + if (ieee80211_vif_assigned_chanctx(sdata) == ctx) >> + num++; >> + rcu_read_unlock(); > > i don't think you need rcu_read_lock if you already hold chanctx_mtx > just realized this for the interface iteration, not for the chanctx. please ignore :) Eliad. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html