struct wireless_dev *wil_cfg80211_init(struct device *dev) { int rc = 0; struct wireless_dev *wdev; wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); if (!wdev) return ERR_PTR(-ENOMEM); wdev->wiphy = wiphy_new(&wil_cfg80211_ops, sizeof(struct wil6210_priv)); if (!wdev->wiphy) { rc = -ENOMEM; goto out; } set_wiphy_dev(wdev->wiphy, dev); wil_wiphy_init(wdev->wiphy); rc = wiphy_register(wdev->wiphy); if (rc < 0) goto out_failed_reg; return wdev; out_failed_reg: wiphy_free(wdev->wiphy); out: kfree(wdev); return ERR_PTR(rc); }
/* Functions to create/free wiphy interface */ struct wiphy *wlan_create_wiphy(struct device *dev, wlandevice_t *wlandev) { struct wiphy *wiphy; struct prism2_wiphy_private *priv; wiphy = wiphy_new(&prism2_usb_cfg_ops, sizeof(struct prism2_wiphy_private)); if (!wiphy) return NULL; priv = wiphy_priv(wiphy); priv->wlandev = wlandev; memcpy(priv->channels, prism2_channels, sizeof(prism2_channels)); memcpy(priv->rates, prism2_rates, sizeof(prism2_rates)); priv->band.channels = priv->channels; priv->band.n_channels = ARRAY_SIZE(prism2_channels); priv->band.bitrates = priv->rates; priv->band.n_bitrates = ARRAY_SIZE(prism2_rates); priv->band.band = IEEE80211_BAND_2GHZ; priv->band.ht_cap.ht_supported = false; wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band; set_wiphy_dev(wiphy, dev); wiphy->privid = prism2_wiphy_privid; wiphy->max_scan_ssids = 1; wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; wiphy->n_cipher_suites = PRISM2_NUM_CIPHER_SUITES; wiphy->cipher_suites = prism2_cipher_suites; if (wiphy_register(wiphy) < 0) return NULL; return wiphy; }
/* Called after orinoco_private is allocated. */ void orinoco_wiphy_init(struct wiphy *wiphy) { struct orinoco_private *priv = wiphy_priv(wiphy); wiphy->privid = orinoco_wiphy_privid; set_wiphy_dev(wiphy, priv->dev); }
struct wireless_dev *ath6kl_cfg80211_init(struct device *dev) { int ret = 0; struct wireless_dev *wdev; struct ath6kl *ar; wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); if (!wdev) { ath6kl_err("couldn't allocate wireless device\n"); return NULL; } /* create a new wiphy for use with cfg80211 */ wdev->wiphy = wiphy_new(&ath6kl_cfg80211_ops, sizeof(struct ath6kl)); if (!wdev->wiphy) { ath6kl_err("couldn't allocate wiphy device\n"); kfree(wdev); return NULL; } ar = wiphy_priv(wdev->wiphy); ar->p2p = !!ath6kl_p2p; wdev->wiphy->mgmt_stypes = ath6kl_mgmt_stypes; wdev->wiphy->max_remain_on_channel_duration = 5000; /* set device pointer for wiphy */ set_wiphy_dev(wdev->wiphy, dev); wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); if (ar->p2p) { wdev->wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO) | BIT(NL80211_IFTYPE_P2P_CLIENT); } /* max num of ssids that can be probed during scanning */ wdev->wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX; wdev->wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */ wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz; wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &ath6kl_band_5ghz; wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; wdev->wiphy->cipher_suites = cipher_suites; wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); ret = wiphy_register(wdev->wiphy); if (ret < 0) { ath6kl_err("couldn't register wiphy device\n"); wiphy_free(wdev->wiphy); kfree(wdev); return NULL; } return wdev; }
struct wiphy *qtnf_wiphy_allocate(struct qtnf_bus *bus) { struct wiphy *wiphy; wiphy = wiphy_new(&qtn_cfg80211_ops, sizeof(struct qtnf_wmac)); if (!wiphy) return NULL; set_wiphy_dev(wiphy, bus->dev); return wiphy; }
int netdev_sysfs_reinit(VOID **ppAd, struct usb_device *usb_dev) { VOID *pAd = *ppAd; struct net_device *net_dev = NULL; #ifdef RT_CFG80211_P2P_SUPPORT struct net_device *dummy_net_dev = NULL; #endif /* RT_CFG80211_P2P_SUPPORT */ RTMP_DRIVER_NET_DEV_GET(pAd, &net_dev); /* Sansity check for avoiding null pointer */ if (!net_dev || !net_dev->ieee80211_ptr || !usb_dev) { DBGPRINT(RT_DEBUG_ERROR, ("%s(): Ignore invalid dev pointer.\n", __func__)); return 0; } /* Link usb's dev to wiphy's dev */ set_wiphy_dev(net_dev->ieee80211_ptr->wiphy, &(usb_dev->dev)); /* main net device(wlan0) */ SET_NETDEV_DEV(net_dev, &(usb_dev->dev)); device_del(&(net_dev->dev)); if (device_add(&(net_dev->dev)) != 0) DBGPRINT(RT_DEBUG_OFF, ("%s(): device_add fail for main net device\n", __func__)); #ifdef RT_CFG80211_P2P_SUPPORT RTMP_DRIVER_DUMMY_NET_DEV_GET(pAd, &dummy_net_dev); if (!dummy_net_dev) { DBGPRINT(RT_DEBUG_ERROR, ("%s(): Ignore dummy net device\n", __func__)); return 0; } /* dummy net device(p2p0) */ SET_NETDEV_DEV(dummy_net_dev, &(usb_dev->dev)); device_del(&(dummy_net_dev->dev)); if (device_add(&(dummy_net_dev->dev)) != 0) DBGPRINT(RT_DEBUG_OFF, ("%s(): device_add fail for dummy net device\n", __func__)); #endif /* RT_CFG80211_P2P_SUPPORT */ return 0; }
int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) { int ret; void *wdev_priv; struct wiphy *wiphy; struct mwifiex_private *priv = adapter->priv[MWIFIEX_BSS_TYPE_STA]; u8 *country_code; /* create a new wiphy for use with cfg80211 */ wiphy = wiphy_new(&mwifiex_cfg80211_ops, sizeof(struct mwifiex_adapter *)); if (!wiphy) { dev_err(adapter->dev, "%s: creating new wiphy\n", __func__); return -ENOMEM; } wiphy->max_scan_ssids = MWIFIEX_MAX_SSID_LIST_LENGTH; wiphy->max_scan_ie_len = MWIFIEX_MAX_VSIE_LEN; wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); wiphy->bands[IEEE80211_BAND_2GHZ] = &mwifiex_band_2ghz; if (adapter->config_bands & BAND_A) wiphy->bands[IEEE80211_BAND_5GHZ] = &mwifiex_band_5ghz; else wiphy->bands[IEEE80211_BAND_5GHZ] = NULL; wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta; wiphy->n_iface_combinations = 1; /* Initialize cipher suits */ wiphy->cipher_suites = mwifiex_cipher_suites; wiphy->n_cipher_suites = ARRAY_SIZE(mwifiex_cipher_suites); memcpy(wiphy->perm_addr, priv->curr_addr, ETH_ALEN); wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME | WIPHY_FLAG_CUSTOM_REGULATORY; /* Reserve space for mwifiex specific private data for BSS */ wiphy->bss_priv_size = sizeof(struct mwifiex_bss_priv); wiphy->reg_notifier = mwifiex_reg_notifier; /* Set struct mwifiex_adapter pointer in wiphy_priv */ wdev_priv = wiphy_priv(wiphy); *(unsigned long *)wdev_priv = (unsigned long)adapter; set_wiphy_dev(wiphy, (struct device *)priv->adapter->dev); ret = wiphy_register(wiphy); if (ret < 0) { dev_err(adapter->dev, "%s: wiphy_register failed: %d\n", __func__, ret); wiphy_free(wiphy); return ret; } country_code = mwifiex_11d_code_2_region(priv->adapter->region_code); if (country_code && regulatory_hint(wiphy, country_code)) dev_err(adapter->dev, "regulatory_hint() failed\n"); adapter->wiphy = wiphy; return ret; }
struct r92su *r92su_alloc(struct device *main_dev) { struct r92su *r92su = NULL; struct wiphy *wiphy; int err; wiphy = wiphy_new(&r92su_cfg80211_ops, sizeof(struct r92su)); if (!wiphy) { err = -ENOMEM; goto err_out; } r92su = wiphy_priv(wiphy); r92su->wdev.wiphy = wiphy; mutex_init(&r92su->lock); spin_lock_init(&r92su->rx_path); if (modparam_noht) r92su->disable_ht = true; INIT_LIST_HEAD(&r92su->sta_list); /* Note: The sta_lock is only needed, if an entry in the * station list is updated. The station data itself is * protected by RCU. */ spin_lock_init(&r92su->sta_lock); set_wiphy_dev(r92su->wdev.wiphy, main_dev); r92su->wdev.iftype = NL80211_IFTYPE_STATION; wiphy->privid = r92su_priv_id; wiphy->mgmt_stypes = r92su_default_mgmt_stypes; wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_MONITOR); wiphy->max_scan_ssids = 1; wiphy->max_scan_ie_len = 256; wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; wiphy->cipher_suites = r92su_chiper_suites; wiphy->n_cipher_suites = ARRAY_SIZE(r92su_chiper_suites); wiphy->bss_priv_size = sizeof(struct r92su_bss_priv); init_completion(&r92su->scan_done); init_llist_head(&r92su->add_bss_list); INIT_WORK(&r92su->add_bss_work, r92su_bss_add_work); INIT_WORK(&r92su->connect_bss_work, r92su_bss_connect_work); INIT_WORK(&r92su->disconnect_work, r92su_disconnect_work); INIT_DELAYED_WORK(&r92su->survey_done_work, r92su_survey_done_work); r92su_hw_init(r92su); r92su->wq = create_singlethread_workqueue(R92SU_DRVNAME); if (!r92su->wq) { err = -ENOMEM; goto err_out; } return r92su; err_out: r92su_unregister(r92su); r92su_free(r92su); return ERR_PTR(err); }
void prism2_roamed(struct wlandevice *wlandev) { struct cfg80211_roam_info roam_info = { .bssid = wlandev->bssid, }; cfg80211_roamed(wlandev->netdev, &roam_info, GFP_KERNEL); } /* Structures for declaring wiphy interface */ static const struct cfg80211_ops prism2_usb_cfg_ops = { .change_virtual_intf = prism2_change_virtual_intf, .add_key = prism2_add_key, .get_key = prism2_get_key, .del_key = prism2_del_key, .set_default_key = prism2_set_default_key, .get_station = prism2_get_station, .scan = prism2_scan, .set_wiphy_params = prism2_set_wiphy_params, .connect = prism2_connect, .disconnect = prism2_disconnect, .join_ibss = prism2_join_ibss, .leave_ibss = prism2_leave_ibss, .set_tx_power = prism2_set_tx_power, .get_tx_power = prism2_get_tx_power, }; /* Functions to create/free wiphy interface */ static struct wiphy *wlan_create_wiphy(struct device *dev, struct wlandevice *wlandev) { struct wiphy *wiphy; struct prism2_wiphy_private *priv; wiphy = wiphy_new(&prism2_usb_cfg_ops, sizeof(*priv)); if (!wiphy) return NULL; priv = wiphy_priv(wiphy); priv->wlandev = wlandev; memcpy(priv->channels, prism2_channels, sizeof(prism2_channels)); memcpy(priv->rates, prism2_rates, sizeof(prism2_rates)); priv->band.channels = priv->channels; priv->band.n_channels = ARRAY_SIZE(prism2_channels); priv->band.bitrates = priv->rates; priv->band.n_bitrates = ARRAY_SIZE(prism2_rates); priv->band.band = NL80211_BAND_2GHZ; priv->band.ht_cap.ht_supported = false; wiphy->bands[NL80211_BAND_2GHZ] = &priv->band; set_wiphy_dev(wiphy, dev); wiphy->privid = prism2_wiphy_privid; wiphy->max_scan_ssids = 1; wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; wiphy->n_cipher_suites = PRISM2_NUM_CIPHER_SUITES; wiphy->cipher_suites = prism2_cipher_suites; if (wiphy_register(wiphy) < 0) { wiphy_free(wiphy); return NULL; } return wiphy; } static void wlan_free_wiphy(struct wiphy *wiphy) { wiphy_unregister(wiphy); wiphy_free(wiphy); }
/* * This function registers the device with CFG802.11 subsystem. * * The function creates the wireless device/wiphy, populates it with * default parameters and handler function pointers, and finally * registers the device. */ int mwifiex_register_cfg80211(struct net_device *dev, u8 *mac, struct mwifiex_private *priv) { int ret; void *wdev_priv; struct wireless_dev *wdev; wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); if (!wdev) { dev_err(priv->adapter->dev, "%s: allocating wireless device\n", __func__); return -ENOMEM; } wdev->wiphy = wiphy_new(&mwifiex_cfg80211_ops, sizeof(struct mwifiex_private *)); if (!wdev->wiphy) { kfree(wdev); return -ENOMEM; } wdev->iftype = NL80211_IFTYPE_STATION; wdev->wiphy->max_scan_ssids = 10; wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &mwifiex_band_2ghz; mwifiex_setup_ht_caps( &wdev->wiphy->bands[IEEE80211_BAND_2GHZ]->ht_cap, priv); if (priv->adapter->config_bands & BAND_A) { wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &mwifiex_band_5ghz; mwifiex_setup_ht_caps( &wdev->wiphy->bands[IEEE80211_BAND_5GHZ]->ht_cap, priv); } else { wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL; } /* Initialize cipher suits */ wdev->wiphy->cipher_suites = mwifiex_cipher_suites; wdev->wiphy->n_cipher_suites = ARRAY_SIZE(mwifiex_cipher_suites); memcpy(wdev->wiphy->perm_addr, mac, 6); wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; /* We are using custom domains */ wdev->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; wdev->wiphy->reg_notifier = mwifiex_reg_notifier; /* Set struct mwifiex_private pointer in wiphy_priv */ wdev_priv = wiphy_priv(wdev->wiphy); *(unsigned long *) wdev_priv = (unsigned long) priv; set_wiphy_dev(wdev->wiphy, (struct device *) priv->adapter->dev); ret = wiphy_register(wdev->wiphy); if (ret < 0) { dev_err(priv->adapter->dev, "%s: registering cfg80211 device\n", __func__); wiphy_free(wdev->wiphy); kfree(wdev); return ret; } else { dev_dbg(priv->adapter->dev, "info: successfully registered wiphy device\n"); } dev_net_set(dev, wiphy_net(wdev->wiphy)); dev->ieee80211_ptr = wdev; memcpy(dev->dev_addr, wdev->wiphy->perm_addr, 6); memcpy(dev->perm_addr, wdev->wiphy->perm_addr, 6); SET_NETDEV_DEV(dev, wiphy_dev(wdev->wiphy)); priv->wdev = wdev; dev->flags |= IFF_BROADCAST | IFF_MULTICAST; dev->watchdog_timeo = MWIFIEX_DEFAULT_WATCHDOG_TIMEOUT; dev->hard_header_len += MWIFIEX_MIN_DATA_HEADER_LEN; return ret; }
/* ======================================================================== Routine Description: Allocate a wireless device. Arguments: pAd - WLAN control block pointer pDev - Generic device interface Return Value: wireless device Note: ======================================================================== */ static struct wireless_dev *CFG80211_WdevAlloc( IN CFG80211_CB *pCfg80211_CB, IN CFG80211_BAND *pBandInfo, IN void *pAd, IN struct device *pDev) { struct wireless_dev *pWdev; ULONG *pPriv; /* * We're trying to have the following memory layout: * * +------------------------+ * | struct wiphy | * +------------------------+ * | pAd pointer | * +------------------------+ */ pWdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); if (pWdev == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("80211> Wireless device allocation fail!\n")); return NULL; } /* End of if */ pWdev->wiphy = wiphy_new(&CFG80211_Ops, sizeof(ULONG *)); if (pWdev->wiphy == NULL) { DBGPRINT(RT_DEBUG_ERROR, ("80211> Wiphy device allocation fail!\n")); goto LabelErrWiphyNew; } /* End of if */ /* keep pAd pointer */ pPriv = (ULONG *)(wiphy_priv(pWdev->wiphy)); *pPriv = (ULONG)pAd; set_wiphy_dev(pWdev->wiphy, pDev); pWdev->wiphy->max_scan_ssids = pBandInfo->MaxBssTable; #ifdef CONFIG_STA_SUPPORT pWdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_MONITOR); #endif /* CONFIG_STA_SUPPORT */ pWdev->wiphy->reg_notifier = CFG80211_RegNotifier; /* init channel information */ CFG80211_SupBandInit(pCfg80211_CB, pBandInfo, pWdev->wiphy, NULL, NULL); /* CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) */ pWdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; pWdev->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; pWdev->wiphy->cipher_suites = CipherSuites; pWdev->wiphy->n_cipher_suites = ARRAY_SIZE(CipherSuites); if (wiphy_register(pWdev->wiphy) < 0) { DBGPRINT(RT_DEBUG_ERROR, ("80211> Register wiphy device fail!\n")); goto LabelErrReg; } /* End of if */ return pWdev; LabelErrReg: wiphy_free(pWdev->wiphy); LabelErrWiphyNew: kfree(pWdev); return NULL; } /* End of CFG80211_WdevAlloc */
/* * This function registers the device with CFG802.11 subsystem. * * The function creates the wireless device/wiphy, populates it with * default parameters and handler function pointers, and finally * registers the device. */ int mwifiex_register_cfg80211(struct mwifiex_private *priv) { int ret; void *wdev_priv; struct wireless_dev *wdev; wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); if (!wdev) { dev_err(priv->adapter->dev, "%s: allocating wireless device\n", __func__); return -ENOMEM; } wdev->wiphy = wiphy_new(&mwifiex_cfg80211_ops, sizeof(struct mwifiex_private *)); if (!wdev->wiphy) { kfree(wdev); return -ENOMEM; } wdev->iftype = NL80211_IFTYPE_STATION; wdev->wiphy->max_scan_ssids = 10; wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &mwifiex_band_2ghz; mwifiex_setup_ht_caps( &wdev->wiphy->bands[IEEE80211_BAND_2GHZ]->ht_cap, priv); if (priv->adapter->config_bands & BAND_A) { wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &mwifiex_band_5ghz; mwifiex_setup_ht_caps( &wdev->wiphy->bands[IEEE80211_BAND_5GHZ]->ht_cap, priv); } else { wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL; } /* Initialize cipher suits */ wdev->wiphy->cipher_suites = mwifiex_cipher_suites; wdev->wiphy->n_cipher_suites = ARRAY_SIZE(mwifiex_cipher_suites); memcpy(wdev->wiphy->perm_addr, priv->curr_addr, ETH_ALEN); wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; /* We are using custom domains */ wdev->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; /* Reserve space for bss band information */ wdev->wiphy->bss_priv_size = sizeof(u8); wdev->wiphy->reg_notifier = mwifiex_reg_notifier; /* Set struct mwifiex_private pointer in wiphy_priv */ wdev_priv = wiphy_priv(wdev->wiphy); *(unsigned long *) wdev_priv = (unsigned long) priv; set_wiphy_dev(wdev->wiphy, (struct device *) priv->adapter->dev); ret = wiphy_register(wdev->wiphy); if (ret < 0) { dev_err(priv->adapter->dev, "%s: registering cfg80211 device\n", __func__); wiphy_free(wdev->wiphy); kfree(wdev); return ret; } else { dev_dbg(priv->adapter->dev, "info: successfully registered wiphy device\n"); } priv->wdev = wdev; return ret; }
/** * @brief Register the device with cfg80211 * * @param dev A pointer to net_device structure * @param bss_type BSS type * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ mlan_status woal_register_uap_cfg80211(struct net_device * dev, t_u8 bss_type) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_private *priv = (moal_private *) netdev_priv(dev); void *wdev_priv = NULL; struct wireless_dev *wdev = NULL; mlan_fw_info fw_info; ENTER(); /* Allocate wireless device */ wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); if (!wdev) { PRINTM(MERROR, "Could not allocate wireless device\n"); ret = MLAN_STATUS_FAILURE; goto err_wdev; } /* Allocate wiphy */ wdev->wiphy = wiphy_new(&woal_cfg80211_uap_ops, sizeof(moal_private *)); if (!wdev->wiphy) { PRINTM(MERROR, "Could not allocate wiphy device\n"); ret = MLAN_STATUS_FAILURE; goto err_wdev; } if (bss_type == MLAN_BSS_TYPE_UAP) { dev_set_name(&wdev->wiphy->dev, dev->name); wdev->iftype = NL80211_IFTYPE_AP; wdev->wiphy->interface_modes = MBIT(NL80211_IFTYPE_AP) | MBIT(NL80211_IFTYPE_STATION) | 0; wdev->wiphy->max_scan_ssids = 10; } /* Make this wiphy known to this driver only */ wdev->wiphy->privid = mrvl_wiphy_privid; /* Supported bands */ wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &cfg80211_band_2ghz; if (MLAN_STATUS_SUCCESS == woal_request_get_fw_info(priv, MOAL_CMD_WAIT, &fw_info)) { if (fw_info.fw_bands & BAND_A) wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &cfg80211_band_5ghz; } /* Initialize cipher suits */ wdev->wiphy->cipher_suites = cfg80211_cipher_suites; wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cfg80211_cipher_suites); wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; /* We are using custom domains */ wdev->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; wdev->wiphy->reg_notifier = NULL; // TODO: woal_cfg80211_reg_notifier; /* Set moal_private pointer in wiphy_priv */ wdev_priv = wiphy_priv(wdev->wiphy); *(unsigned long *) wdev_priv = (unsigned long) priv; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39) || defined(COMPAT_WIRELESS) set_wiphy_dev(wdev->wiphy, (struct device *) priv->phandle->hotplug_device); #endif if (wiphy_register(wdev->wiphy) < 0) { PRINTM(MERROR, "Wiphy device registration failed!\n"); ret = MLAN_STATUS_FAILURE; goto err_wdev; } dev_net_set(dev, wiphy_net(wdev->wiphy)); dev->ieee80211_ptr = wdev; SET_NETDEV_DEV(dev, wiphy_dev(wdev->wiphy)); priv->wdev = wdev; if (ret != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "Wiphy device registration failed!\n"); } else { PRINTM(MINFO, "Successfully registered wiphy device\n"); LEAVE(); return ret; } wiphy_unregister(wdev->wiphy); err_wdev: dev->ieee80211_ptr = NULL; if (wdev && wdev->wiphy) wiphy_free(wdev->wiphy); kfree(wdev); LEAVE(); return ret; }