hi Michal, On Fri, May 18, 2012 at 3:03 PM, Michal Kazior <michal.kazior@xxxxxxxxx> wrote: > Split functionality for further reuse. > > Will prevent code duplication when channel context > channel_type merging is introduced. > > Signed-off-by: Michal Kazior <michal.kazior@xxxxxxxxx> > --- [...] > - switch (superchan) { > +static bool > +ieee80211_channel_types_are_compatible(enum nl80211_channel_type chantype1, > + enum nl80211_channel_type chantype2, > + enum nl80211_channel_type *compat) > +{ you split superchan (in + out) into chantype1 (in) + compat (out) here, but it looks a bit broken - > + switch (chantype1) { > case NL80211_CHAN_NO_HT: > case NL80211_CHAN_HT20: > /* > * allow any change that doesn't go to no-HT > * (if it already is no-HT no change is needed) > */ > - if (chantype == NL80211_CHAN_NO_HT) > + if (chantype2 == NL80211_CHAN_NO_HT) > break; you don't set compat here... > + > +bool ieee80211_set_channel_type(struct ieee80211_local *local, > + struct ieee80211_sub_if_data *sdata, > + enum nl80211_channel_type chantype) > +{ > + enum nl80211_channel_type superchan; > + enum nl80211_channel_type compatchan = NL80211_CHAN_NO_HT; > + > + superchan = ieee80211_get_superchan(local, sdata); > + if (!ieee80211_channel_types_are_compatible(superchan, chantype, > + &compatchan)) > + return false; > + > + local->_oper_channel_type = compatchan; > so when superchan=NL80211_CHAN_HT20, and chantype=NL80211_CHAN_NO_HT, you'll end up with compatchan=NL80211_CHAN_NO_HT which is wrong. 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