summaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2014-04-09 15:29:22 +0200
committerJohannes Berg <johannes.berg@intel.com>2014-04-25 17:08:14 +0200
commit65a124dd719d6e90591e4756bb04e1719489705e (patch)
tree6316d4354f73687799b3f53f29fe513bd627161b /net/wireless
parent46d537245d8db96a4c282b449f8b582a71e5ec13 (diff)
downloadop-kernel-dev-65a124dd719d6e90591e4756bb04e1719489705e.zip
op-kernel-dev-65a124dd719d6e90591e4756bb04e1719489705e.tar.gz
cfg80211: allow drivers to iterate over matching combinations
The patch splits cfg80211_check_combinations() into an iterator function and a simple iteration user. This makes it possible for drivers to asses how many channels can use given iftype setup. This in turn can be used for future multi-interface/multi-channel channel switching. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/util.c44
1 files changed, 37 insertions, 7 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index d032a31..d8b5995 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1263,10 +1263,13 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
return res;
}
-int cfg80211_check_combinations(struct wiphy *wiphy,
- const int num_different_channels,
- const u8 radar_detect,
- const int iftype_num[NUM_NL80211_IFTYPES])
+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)
{
int i, j, iftype;
int num_interfaces = 0;
@@ -1323,13 +1326,40 @@ int cfg80211_check_combinations(struct wiphy *wiphy,
/* This combination covered all interface types and
* supported the requested numbers, so we're good.
*/
- kfree(limits);
- return 0;
+
+ (*iter)(c, data);
cont:
kfree(limits);
}
- return -EBUSY;
+ return 0;
+}
+EXPORT_SYMBOL(cfg80211_iter_combinations);
+
+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;
}
EXPORT_SYMBOL(cfg80211_check_combinations);
OpenPOWER on IntegriCloud