/* @cfg: driver private data for cfg80211 interface. @p2pdev_forced: create p2p device interface at attach.  */
s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
/* @cfg: driver private data for cfg80211 interface. @p2pdev_forced: create p2p device interface at attach.  */
s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
{
	struct brcmf_p2p_info *p2p;
	struct brcmf_if *pri_ifp;
	s32 err = 0;
	void *err_ptr;
	p2p = &cfg->p2p;
	p2p->cfg = cfg;
	pri_ifp = brcmf_get_ifp(cfg->pub, 0);
	p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
	if (p2pdev_forced) {
		err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL);
		if (IS_ERR(err_ptr)) {
			brcmf_err("P2P device creation failed.\n");
			err = PTR_ERR(err_ptr);
		}
	} else {
		p2p->p2pdev_dynamically = true;
	}
	return err;
}