Skip to content

Commit

Permalink
ath6kl: unify cfg80211 init/cleanup functions
Browse files Browse the repository at this point in the history
Group them together and change the naming to follow the common style in
ath6kl. No functional changes.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
  • Loading branch information
Kalle Valo committed Jan 18, 2012
1 parent c25889e commit 46d33a2
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 57 deletions.
109 changes: 57 additions & 52 deletions drivers/net/wireless/ath/ath6kl/cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -2755,57 +2755,6 @@ struct ath6kl *ath6kl_core_alloc(struct device *dev)
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)
{
vif->aggr_cntxt = aggr_init(vif->ndev);
Expand Down Expand Up @@ -2907,8 +2856,64 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
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);

/*
* FIXME: should be removed as we remove wiphy in
* ath6kl_core_free(). Most likely this causes a use after free.
*/
wiphy_free(ar->wiphy);
}
6 changes: 3 additions & 3 deletions drivers/net/wireless/ath/ath6kl/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ enum ath6kl_cfg_suspend_mode {
struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
enum nl80211_iftype type,
u8 fw_vif_idx, u8 nw_type);
int ath6kl_register_ieee80211_hw(struct ath6kl *ar);
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_connect_event(struct ath6kl_vif *vif, u16 channel,
Expand Down Expand Up @@ -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_all(struct ath6kl *ar);

int ath6kl_cfg80211_init(struct ath6kl *ar);
void ath6kl_cfg80211_cleanup(struct ath6kl *ar);

#endif /* ATH6KL_CFG80211_H */
4 changes: 2 additions & 2 deletions drivers/net/wireless/ath/ath6kl/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ void ath6kl_core_cleanup(struct ath6kl *ar)
kfree(ar->fw_patch);
kfree(ar->fw_testscript);

ath6kl_deinit_ieee80211_hw(ar);
ath6kl_cfg80211_cleanup(ar);
}

/* firmware upload */
Expand Down Expand Up @@ -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);

ret = ath6kl_register_ieee80211_hw(ar);
ret = ath6kl_cfg80211_init(ar);
if (ret)
goto err_node_cleanup;

Expand Down

0 comments on commit 46d33a2

Please sign in to comment.