On Fri, 2014-03-21 at 14:47 +0100, Michal Kazior wrote: > +int cfg80211_iter_combinations(struct wiphy *wiphy, > + const int num_different_channels, > + const u8 radar_detect, > + const int iftype_num[NUM_NL80211_IFTYPES], > + void (*iter)(const struct ieee80211_iface_combination *c, > + void *data), > + void *data); Maybe *iter should have a non-void return value and allow aborting the loop somehow? > +static void > +cfg80211_iter_sum_ifcombs(const struct ieee80211_iface_combination *c, > + void *data) > +{ > + int *num = data; > + (*num)++; > +} > + > +int cfg80211_check_combinations(struct wiphy *wiphy, > + const int num_different_channels, > + const u8 radar_detect, > + const int iftype_num[NUM_NL80211_IFTYPES]) > +{ > + int err, num = 0; > + > + err = cfg80211_iter_combinations(wiphy, num_different_channels, > + radar_detect, iftype_num, > + cfg80211_iter_sum_ifcombs, &num); > + if (err) > + return err; > + if (num == 0) > + return -EBUSY; > + > + return 0; > } This also seems a bit pointless - why not just have an int instead of num and set it to -EBUSY outside, and to 0 inside, and then just return it? You don't need the number of available combinations. johannes -- 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