Commit 46d33a21 authored by Kalle Valo's avatar Kalle Valo

ath6kl: unify cfg80211 init/cleanup functions

Group them together and change the naming to follow the common style in
ath6kl. No functional changes.
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent c25889e8
...@@ -2755,57 +2755,6 @@ struct ath6kl *ath6kl_core_alloc(struct device *dev) ...@@ -2755,57 +2755,6 @@ struct ath6kl *ath6kl_core_alloc(struct device *dev)
return ar; return ar;
} }
int ath6kl_register_ieee80211_hw(struct ath6kl *ar)
{
struct wiphy *wiphy = ar->wiphy;
int ret;
wiphy->mgmt_stypes = ath6kl_mgmt_stypes;
wiphy->max_remain_on_channel_duration = 5000;
/* set device pointer for wiphy */
set_wiphy_dev(wiphy, ar->dev);
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_ADHOC) |
BIT(NL80211_IFTYPE_AP);
if (ar->p2p) {
wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO) |
BIT(NL80211_IFTYPE_P2P_CLIENT);
}
/* max num of ssids that can be probed during scanning */
wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX;
wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */
wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz;
wiphy->bands[IEEE80211_BAND_5GHZ] = &ath6kl_band_5ghz;
wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
wiphy->cipher_suites = cipher_suites;
wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
WIPHY_WOWLAN_DISCONNECT |
WIPHY_WOWLAN_GTK_REKEY_FAILURE |
WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
WIPHY_WOWLAN_EAP_IDENTITY_REQ |
WIPHY_WOWLAN_4WAY_HANDSHAKE;
wiphy->wowlan.n_patterns = WOW_MAX_FILTERS_PER_LIST;
wiphy->wowlan.pattern_min_len = 1;
wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE;
wiphy->max_sched_scan_ssids = 10;
ret = wiphy_register(wiphy);
if (ret < 0) {
ath6kl_err("couldn't register wiphy device\n");
return ret;
}
return 0;
}
static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif) static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif)
{ {
vif->aggr_cntxt = aggr_init(vif->ndev); vif->aggr_cntxt = aggr_init(vif->ndev);
...@@ -2907,8 +2856,64 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, ...@@ -2907,8 +2856,64 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
return NULL; return NULL;
} }
void ath6kl_deinit_ieee80211_hw(struct ath6kl *ar) int ath6kl_cfg80211_init(struct ath6kl *ar)
{
struct wiphy *wiphy = ar->wiphy;
int ret;
wiphy->mgmt_stypes = ath6kl_mgmt_stypes;
wiphy->max_remain_on_channel_duration = 5000;
/* set device pointer for wiphy */
set_wiphy_dev(wiphy, ar->dev);
wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_ADHOC) |
BIT(NL80211_IFTYPE_AP);
if (ar->p2p) {
wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO) |
BIT(NL80211_IFTYPE_P2P_CLIENT);
}
/* max num of ssids that can be probed during scanning */
wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX;
wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */
wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz;
wiphy->bands[IEEE80211_BAND_5GHZ] = &ath6kl_band_5ghz;
wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
wiphy->cipher_suites = cipher_suites;
wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
WIPHY_WOWLAN_DISCONNECT |
WIPHY_WOWLAN_GTK_REKEY_FAILURE |
WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
WIPHY_WOWLAN_EAP_IDENTITY_REQ |
WIPHY_WOWLAN_4WAY_HANDSHAKE;
wiphy->wowlan.n_patterns = WOW_MAX_FILTERS_PER_LIST;
wiphy->wowlan.pattern_min_len = 1;
wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE;
wiphy->max_sched_scan_ssids = 10;
ret = wiphy_register(wiphy);
if (ret < 0) {
ath6kl_err("couldn't register wiphy device\n");
return ret;
}
return 0;
}
void ath6kl_cfg80211_cleanup(struct ath6kl *ar)
{ {
wiphy_unregister(ar->wiphy); wiphy_unregister(ar->wiphy);
/*
* FIXME: should be removed as we remove wiphy in
* ath6kl_core_free(). Most likely this causes a use after free.
*/
wiphy_free(ar->wiphy); wiphy_free(ar->wiphy);
} }
...@@ -27,10 +27,7 @@ enum ath6kl_cfg_suspend_mode { ...@@ -27,10 +27,7 @@ enum ath6kl_cfg_suspend_mode {
struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
enum nl80211_iftype type, enum nl80211_iftype type,
u8 fw_vif_idx, u8 nw_type); u8 fw_vif_idx, u8 nw_type);
int ath6kl_register_ieee80211_hw(struct ath6kl *ar);
struct ath6kl *ath6kl_core_alloc(struct device *dev); struct ath6kl *ath6kl_core_alloc(struct device *dev);
void ath6kl_deinit_ieee80211_hw(struct ath6kl *ar);
void ath6kl_cfg80211_scan_complete_event(struct ath6kl_vif *vif, bool aborted); void ath6kl_cfg80211_scan_complete_event(struct ath6kl_vif *vif, bool aborted);
void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel, void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
...@@ -58,4 +55,7 @@ void ath6kl_cfg80211_vif_cleanup(struct ath6kl_vif *vif); ...@@ -58,4 +55,7 @@ void ath6kl_cfg80211_vif_cleanup(struct ath6kl_vif *vif);
void ath6kl_cfg80211_stop(struct ath6kl_vif *vif); void ath6kl_cfg80211_stop(struct ath6kl_vif *vif);
void ath6kl_cfg80211_stop_all(struct ath6kl *ar); void ath6kl_cfg80211_stop_all(struct ath6kl *ar);
int ath6kl_cfg80211_init(struct ath6kl *ar);
void ath6kl_cfg80211_cleanup(struct ath6kl *ar);
#endif /* ATH6KL_CFG80211_H */ #endif /* ATH6KL_CFG80211_H */
...@@ -625,7 +625,7 @@ void ath6kl_core_cleanup(struct ath6kl *ar) ...@@ -625,7 +625,7 @@ void ath6kl_core_cleanup(struct ath6kl *ar)
kfree(ar->fw_patch); kfree(ar->fw_patch);
kfree(ar->fw_testscript); kfree(ar->fw_testscript);
ath6kl_deinit_ieee80211_hw(ar); ath6kl_cfg80211_cleanup(ar);
} }
/* firmware upload */ /* firmware upload */
...@@ -1722,7 +1722,7 @@ int ath6kl_core_init(struct ath6kl *ar) ...@@ -1722,7 +1722,7 @@ int ath6kl_core_init(struct ath6kl *ar)
ath6kl_dbg(ATH6KL_DBG_TRC, "%s: got wmi @ 0x%p.\n", __func__, ar->wmi); ath6kl_dbg(ATH6KL_DBG_TRC, "%s: got wmi @ 0x%p.\n", __func__, ar->wmi);
ret = ath6kl_register_ieee80211_hw(ar); ret = ath6kl_cfg80211_init(ar);
if (ret) if (ret)
goto err_node_cleanup; goto err_node_cleanup;
......
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