Commit 24e28bee authored by Arend van Spriel's avatar Arend van Spriel Committed by John W. Linville

brcmfmac: add additional parameter to brcmf_free_vif()

Pass the struct brcmf_cfg80211_info instance instead of obtaining
through vif itself using vif->wdev. This is needed as the netdev
associated with this vif is already unregistered.
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 15a953d0
...@@ -1955,21 +1955,21 @@ s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg) ...@@ -1955,21 +1955,21 @@ s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg)
err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1); err = brcmf_fil_iovar_int_set(pri_ifp, "p2p_disc", 1);
if (err < 0) { if (err < 0) {
brcmf_err("set p2p_disc error\n"); brcmf_err("set p2p_disc error\n");
brcmf_free_vif(p2p_vif); brcmf_free_vif(cfg, p2p_vif);
goto exit; goto exit;
} }
/* obtain bsscfg index for P2P discovery */ /* obtain bsscfg index for P2P discovery */
err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx); err = brcmf_fil_iovar_int_get(pri_ifp, "p2p_dev", &bssidx);
if (err < 0) { if (err < 0) {
brcmf_err("retrieving discover bsscfg index failed\n"); brcmf_err("retrieving discover bsscfg index failed\n");
brcmf_free_vif(p2p_vif); brcmf_free_vif(cfg, p2p_vif);
goto exit; goto exit;
} }
/* Verify that firmware uses same bssidx as driver !! */ /* Verify that firmware uses same bssidx as driver !! */
if (p2p_ifp->bssidx != bssidx) { if (p2p_ifp->bssidx != bssidx) {
brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n", brcmf_err("Incorrect bssidx=%d, compared to p2p_ifp->bssidx=%d\n",
bssidx, p2p_ifp->bssidx); bssidx, p2p_ifp->bssidx);
brcmf_free_vif(p2p_vif); brcmf_free_vif(cfg, p2p_vif);
goto exit; goto exit;
} }
...@@ -1997,7 +1997,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_info *p2p) ...@@ -1997,7 +1997,7 @@ void brcmf_p2p_detach(struct brcmf_p2p_info *p2p)
brcmf_p2p_cancel_remain_on_channel(vif->ifp); brcmf_p2p_cancel_remain_on_channel(vif->ifp);
brcmf_p2p_deinit_discovery(p2p); brcmf_p2p_deinit_discovery(p2p);
/* remove discovery interface */ /* remove discovery interface */
brcmf_free_vif(vif); brcmf_free_vif(p2p->cfg, vif);
p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
} }
/* just set it all to zero */ /* just set it all to zero */
...@@ -2222,7 +2222,7 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p, ...@@ -2222,7 +2222,7 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,
return &p2p_vif->wdev; return &p2p_vif->wdev;
fail: fail:
brcmf_free_vif(p2p_vif); brcmf_free_vif(p2p->cfg, p2p_vif);
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -2231,13 +2231,12 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p, ...@@ -2231,13 +2231,12 @@ static struct wireless_dev *brcmf_p2p_create_p2pdev(struct brcmf_p2p_info *p2p,
* *
* @vif: virtual interface object to delete. * @vif: virtual interface object to delete.
*/ */
static void brcmf_p2p_delete_p2pdev(struct brcmf_cfg80211_vif *vif) static void brcmf_p2p_delete_p2pdev(struct brcmf_cfg80211_info *cfg,
struct brcmf_cfg80211_vif *vif)
{ {
struct brcmf_p2p_info *p2p = &vif->ifp->drvr->config->p2p;
cfg80211_unregister_wdev(&vif->wdev); cfg80211_unregister_wdev(&vif->wdev);
p2p->bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL; cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif = NULL;
brcmf_free_vif(vif); brcmf_free_vif(cfg, vif);
} }
/** /**
...@@ -2328,7 +2327,7 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name, ...@@ -2328,7 +2327,7 @@ struct wireless_dev *brcmf_p2p_add_vif(struct wiphy *wiphy, const char *name,
return &ifp->vif->wdev; return &ifp->vif->wdev;
fail: fail:
brcmf_free_vif(vif); brcmf_free_vif(cfg, vif);
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -2364,7 +2363,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) ...@@ -2364,7 +2363,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
break; break;
case NL80211_IFTYPE_P2P_DEVICE: case NL80211_IFTYPE_P2P_DEVICE:
brcmf_p2p_delete_p2pdev(vif); brcmf_p2p_delete_p2pdev(cfg, vif);
return 0; return 0;
default: default:
return -ENOTSUPP; return -ENOTSUPP;
...@@ -2392,7 +2391,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev) ...@@ -2392,7 +2391,7 @@ int brcmf_p2p_del_vif(struct wiphy *wiphy, struct wireless_dev *wdev)
err = 0; err = 0;
} }
brcmf_cfg80211_arm_vif_event(cfg, NULL); brcmf_cfg80211_arm_vif_event(cfg, NULL);
brcmf_free_vif(vif); brcmf_free_vif(cfg, vif);
p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL; p2p->bss_idx[P2PAPI_BSSCFG_CONNECTION].vif = NULL;
return err; return err;
......
...@@ -4292,20 +4292,16 @@ struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, ...@@ -4292,20 +4292,16 @@ struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
return vif; return vif;
} }
void brcmf_free_vif(struct brcmf_cfg80211_vif *vif) void brcmf_free_vif(struct brcmf_cfg80211_info *cfg,
struct brcmf_cfg80211_vif *vif)
{ {
struct brcmf_cfg80211_info *cfg;
struct wiphy *wiphy;
wiphy = vif->wdev.wiphy;
cfg = wiphy_priv(wiphy);
list_del(&vif->list); list_del(&vif->list);
cfg->vif_cnt--; cfg->vif_cnt--;
kfree(vif); kfree(vif);
if (!cfg->vif_cnt) { if (!cfg->vif_cnt) {
wiphy_unregister(wiphy); wiphy_unregister(cfg->wiphy);
wiphy_free(wiphy); wiphy_free(cfg->wiphy);
} }
} }
...@@ -4888,8 +4884,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, ...@@ -4888,8 +4884,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
wl_deinit_priv(cfg); wl_deinit_priv(cfg);
cfg80211_attach_out: cfg80211_attach_out:
brcmf_free_vif(vif); brcmf_free_vif(cfg, vif);
wiphy_free(wiphy);
return NULL; return NULL;
} }
...@@ -4901,7 +4896,7 @@ void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg) ...@@ -4901,7 +4896,7 @@ void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg)
wl_deinit_priv(cfg); wl_deinit_priv(cfg);
brcmf_btcoex_detach(cfg); brcmf_btcoex_detach(cfg);
list_for_each_entry_safe(vif, tmp, &cfg->vif_list, list) { list_for_each_entry_safe(vif, tmp, &cfg->vif_list, list) {
brcmf_free_vif(vif); brcmf_free_vif(cfg, vif);
} }
} }
......
...@@ -487,7 +487,8 @@ enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp); ...@@ -487,7 +487,8 @@ enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp);
struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
enum nl80211_iftype type, enum nl80211_iftype type,
bool pm_block); bool pm_block);
void brcmf_free_vif(struct brcmf_cfg80211_vif *vif); void brcmf_free_vif(struct brcmf_cfg80211_info *cfg,
struct brcmf_cfg80211_vif *vif);
s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag, s32 brcmf_vif_set_mgmt_ie(struct brcmf_cfg80211_vif *vif, s32 pktflag,
const u8 *vndr_ie_buf, u32 vndr_ie_len); const u8 *vndr_ie_buf, u32 vndr_ie_len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment