On Tue, 2012-11-20 at 09:41 +0100, Johannes Berg wrote: > On Tue, 2012-11-20 at 13:57 +0530, Mahesh Palivela wrote: > > > > + for (freq = center_freq - bw/2 + 10; > > > + freq <= center_freq + bw/2 - 10; > > > + freq += 20) { > > > + c = ieee80211_get_channel(wiphy, freq); > > > + if (!c || c->flags & (IEEE80211_CHAN_DISABLED | > > > + IEEE80211_CHAN_PASSIVE_SCAN | > > > + IEEE80211_CHAN_NO_IBSS | > > > + IEEE80211_CHAN_RADAR)) > > > + return false; > > > > > + for (freq = center_freq - bw/2 + 10; > > > + freq <= center_freq + bw/2 - 10; > > > + freq += 20) { > > > + c = ieee80211_get_channel(&rdev->wiphy, freq); > > > + if (!c || c->flags & IEEE80211_CHAN_DISABLED) > > > + return -EINVAL; > > > > For loops in both functions seems to be similar. One return false, other > > return -EINVAL. Can we remove duplication? > > True, but they check different flags. I suppose we could have a common > function where the checked flags are passed in, I can try that. I'll add this to the patch: http://p.sipsolutions.net/24eb25fb98ef2d0b.txt -- 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