浏览代码

brcmfmac: check all combinations when setting wiphy's addresses

Broadcom is working on better reflection of interface combinations. With
upcoming patches we may have 1st combination supporting less interfaces
than others.
To don't run out of addresses check all combinations to find the one
with the greatest max_interfaces value.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Rafał Miłecki 10 年之前
父节点
当前提交
50f32e2d10
共有 1 个文件被更改,包括 9 次插入2 次删除
  1. 9 2
      drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c

+ 9 - 2
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c

@@ -5786,7 +5786,9 @@ static void brcmf_wiphy_wowl_params(struct wiphy *wiphy)
 static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
 static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
 {
 {
 	struct brcmf_pub *drvr = ifp->drvr;
 	struct brcmf_pub *drvr = ifp->drvr;
+	const struct ieee80211_iface_combination *combo;
 	struct ieee80211_supported_band *band;
 	struct ieee80211_supported_band *band;
+	u16 max_interfaces = 0;
 	__le32 bandlist[3];
 	__le32 bandlist[3];
 	u32 n_bands;
 	u32 n_bands;
 	int err, i;
 	int err, i;
@@ -5799,8 +5801,13 @@ static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
 	if (err)
 	if (err)
 		return err;
 		return err;
 
 
-	for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
-	     i < ARRAY_SIZE(drvr->addresses); i++) {
+	for (i = 0, combo = wiphy->iface_combinations;
+	     i < wiphy->n_iface_combinations; i++, combo++) {
+		max_interfaces = max(max_interfaces, combo->max_interfaces);
+	}
+
+	for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses);
+	     i++) {
 		u8 *addr = drvr->addresses[i].addr;
 		u8 *addr = drvr->addresses[i].addr;
 
 
 		memcpy(addr, drvr->mac, ETH_ALEN);
 		memcpy(addr, drvr->mac, ETH_ALEN);