cfg80211: pass struct to interface combination check/iter
Move the growing parameter list to a structure for the interface combination check and iteration functions in cfg80211 and mac80211 to make the code easier to understand. Signed-off-by: Purushottam Kushwaha <pkushwah@qti.qualcomm.com> [edit commit message] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:

committed by
Johannes Berg

parent
32910bb951
commit
e227300c83
@@ -1580,9 +1580,7 @@ int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
|
||||
}
|
||||
|
||||
int cfg80211_iter_combinations(struct wiphy *wiphy,
|
||||
const int num_different_channels,
|
||||
const u8 radar_detect,
|
||||
const int iftype_num[NUM_NL80211_IFTYPES],
|
||||
struct iface_combination_params *params,
|
||||
void (*iter)(const struct ieee80211_iface_combination *c,
|
||||
void *data),
|
||||
void *data)
|
||||
@@ -1593,7 +1591,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
|
||||
int num_interfaces = 0;
|
||||
u32 used_iftypes = 0;
|
||||
|
||||
if (radar_detect) {
|
||||
if (params->radar_detect) {
|
||||
rcu_read_lock();
|
||||
regdom = rcu_dereference(cfg80211_regdomain);
|
||||
if (regdom)
|
||||
@@ -1602,8 +1600,8 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
|
||||
}
|
||||
|
||||
for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) {
|
||||
num_interfaces += iftype_num[iftype];
|
||||
if (iftype_num[iftype] > 0 &&
|
||||
num_interfaces += params->iftype_num[iftype];
|
||||
if (params->iftype_num[iftype] > 0 &&
|
||||
!(wiphy->software_iftypes & BIT(iftype)))
|
||||
used_iftypes |= BIT(iftype);
|
||||
}
|
||||
@@ -1617,7 +1615,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
|
||||
|
||||
if (num_interfaces > c->max_interfaces)
|
||||
continue;
|
||||
if (num_different_channels > c->num_different_channels)
|
||||
if (params->num_different_channels > c->num_different_channels)
|
||||
continue;
|
||||
|
||||
limits = kmemdup(c->limits, sizeof(limits[0]) * c->n_limits,
|
||||
@@ -1632,16 +1630,17 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
|
||||
all_iftypes |= limits[j].types;
|
||||
if (!(limits[j].types & BIT(iftype)))
|
||||
continue;
|
||||
if (limits[j].max < iftype_num[iftype])
|
||||
if (limits[j].max < params->iftype_num[iftype])
|
||||
goto cont;
|
||||
limits[j].max -= iftype_num[iftype];
|
||||
limits[j].max -= params->iftype_num[iftype];
|
||||
}
|
||||
}
|
||||
|
||||
if (radar_detect != (c->radar_detect_widths & radar_detect))
|
||||
if (params->radar_detect !=
|
||||
(c->radar_detect_widths & params->radar_detect))
|
||||
goto cont;
|
||||
|
||||
if (radar_detect && c->radar_detect_regions &&
|
||||
if (params->radar_detect && c->radar_detect_regions &&
|
||||
!(c->radar_detect_regions & BIT(region)))
|
||||
goto cont;
|
||||
|
||||
@@ -1675,14 +1674,11 @@ cfg80211_iter_sum_ifcombs(const struct ieee80211_iface_combination *c,
|
||||
}
|
||||
|
||||
int cfg80211_check_combinations(struct wiphy *wiphy,
|
||||
const int num_different_channels,
|
||||
const u8 radar_detect,
|
||||
const int iftype_num[NUM_NL80211_IFTYPES])
|
||||
struct iface_combination_params *params)
|
||||
{
|
||||
int err, num = 0;
|
||||
|
||||
err = cfg80211_iter_combinations(wiphy, num_different_channels,
|
||||
radar_detect, iftype_num,
|
||||
err = cfg80211_iter_combinations(wiphy, params,
|
||||
cfg80211_iter_sum_ifcombs, &num);
|
||||
if (err)
|
||||
return err;
|
||||
|
Reference in New Issue
Block a user