提交 be98e3a4 编写于 作者: V Vasanthakumar Thiagarajan 提交者: Kalle Valo

ath6kl: Keep wiphy reference in ath6kl structure

This is to avoid using ar->wdev to get wiphy pointer, this
may need further cleanup for multi vif support.
Signed-off-by: NVasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
上级 521dffcc
...@@ -481,7 +481,7 @@ static int ath6kl_add_bss_if_needed(struct ath6kl *ar, const u8 *bssid, ...@@ -481,7 +481,7 @@ static int ath6kl_add_bss_if_needed(struct ath6kl *ar, const u8 *bssid,
struct cfg80211_bss *bss; struct cfg80211_bss *bss;
u8 *ie; u8 *ie;
bss = cfg80211_get_bss(ar->wdev->wiphy, chan, bssid, bss = cfg80211_get_bss(ar->wiphy, chan, bssid,
ar->ssid, ar->ssid_len, WLAN_CAPABILITY_ESS, ar->ssid, ar->ssid_len, WLAN_CAPABILITY_ESS,
WLAN_CAPABILITY_ESS); WLAN_CAPABILITY_ESS);
if (bss == NULL) { if (bss == NULL) {
...@@ -500,7 +500,7 @@ static int ath6kl_add_bss_if_needed(struct ath6kl *ar, const u8 *bssid, ...@@ -500,7 +500,7 @@ static int ath6kl_add_bss_if_needed(struct ath6kl *ar, const u8 *bssid,
ie[1] = ar->ssid_len; ie[1] = ar->ssid_len;
memcpy(ie + 2, ar->ssid, ar->ssid_len); memcpy(ie + 2, ar->ssid, ar->ssid_len);
memcpy(ie + 2 + ar->ssid_len, beacon_ie, beacon_ie_len); memcpy(ie + 2 + ar->ssid_len, beacon_ie, beacon_ie_len);
bss = cfg80211_inform_bss(ar->wdev->wiphy, chan, bss = cfg80211_inform_bss(ar->wiphy, chan,
bssid, 0, WLAN_CAPABILITY_ESS, 100, bssid, 0, WLAN_CAPABILITY_ESS, 100,
ie, 2 + ar->ssid_len + beacon_ie_len, ie, 2 + ar->ssid_len + beacon_ie_len,
0, GFP_KERNEL); 0, GFP_KERNEL);
...@@ -567,7 +567,7 @@ void ath6kl_cfg80211_connect_event(struct ath6kl *ar, u16 channel, ...@@ -567,7 +567,7 @@ void ath6kl_cfg80211_connect_event(struct ath6kl *ar, u16 channel,
} }
} }
chan = ieee80211_get_channel(ar->wdev->wiphy, (int) channel); chan = ieee80211_get_channel(ar->wiphy, (int) channel);
if (nw_type & ADHOC_NETWORK) { if (nw_type & ADHOC_NETWORK) {
...@@ -1924,6 +1924,7 @@ struct wireless_dev *ath6kl_cfg80211_init(struct device *dev) ...@@ -1924,6 +1924,7 @@ struct wireless_dev *ath6kl_cfg80211_init(struct device *dev)
int ret = 0; int ret = 0;
struct wireless_dev *wdev; struct wireless_dev *wdev;
struct ath6kl *ar; struct ath6kl *ar;
struct wiphy *wiphy;
wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
if (!wdev) { if (!wdev) {
...@@ -1932,43 +1933,45 @@ struct wireless_dev *ath6kl_cfg80211_init(struct device *dev) ...@@ -1932,43 +1933,45 @@ struct wireless_dev *ath6kl_cfg80211_init(struct device *dev)
} }
/* create a new wiphy for use with cfg80211 */ /* create a new wiphy for use with cfg80211 */
wdev->wiphy = wiphy_new(&ath6kl_cfg80211_ops, sizeof(struct ath6kl)); wiphy = wiphy_new(&ath6kl_cfg80211_ops, sizeof(struct ath6kl));
if (!wdev->wiphy) { if (!wiphy) {
ath6kl_err("couldn't allocate wiphy device\n"); ath6kl_err("couldn't allocate wiphy device\n");
kfree(wdev); kfree(wdev);
return NULL; return NULL;
} }
ar = wiphy_priv(wdev->wiphy); ar = wiphy_priv(wiphy);
ar->p2p = !!ath6kl_p2p; ar->p2p = !!ath6kl_p2p;
ar->wiphy = wiphy;
wdev->wiphy = wiphy;
wdev->wiphy->mgmt_stypes = ath6kl_mgmt_stypes; wiphy->mgmt_stypes = ath6kl_mgmt_stypes;
wdev->wiphy->max_remain_on_channel_duration = 5000; wiphy->max_remain_on_channel_duration = 5000;
/* set device pointer for wiphy */ /* set device pointer for wiphy */
set_wiphy_dev(wdev->wiphy, dev); set_wiphy_dev(wiphy, dev);
wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP);
if (ar->p2p) { if (ar->p2p) {
wdev->wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO) | wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO) |
BIT(NL80211_IFTYPE_P2P_CLIENT); BIT(NL80211_IFTYPE_P2P_CLIENT);
} }
/* max num of ssids that can be probed during scanning */ /* max num of ssids that can be probed during scanning */
wdev->wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX; wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX;
wdev->wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */ wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */
wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz; wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz;
wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &ath6kl_band_5ghz; wiphy->bands[IEEE80211_BAND_5GHZ] = &ath6kl_band_5ghz;
wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
wdev->wiphy->cipher_suites = cipher_suites; wiphy->cipher_suites = cipher_suites;
wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
ret = wiphy_register(wdev->wiphy); ret = wiphy_register(wiphy);
if (ret < 0) { if (ret < 0) {
ath6kl_err("couldn't register wiphy device\n"); ath6kl_err("couldn't register wiphy device\n");
wiphy_free(wdev->wiphy); wiphy_free(wiphy);
kfree(wdev); kfree(wdev);
return NULL; return NULL;
} }
...@@ -1985,10 +1988,7 @@ void ath6kl_cfg80211_deinit(struct ath6kl *ar) ...@@ -1985,10 +1988,7 @@ void ath6kl_cfg80211_deinit(struct ath6kl *ar)
ar->scan_req = NULL; ar->scan_req = NULL;
} }
if (!wdev) wiphy_unregister(ar->wiphy);
return; wiphy_free(ar->wiphy);
wiphy_unregister(wdev->wiphy);
wiphy_free(wdev->wiphy);
kfree(wdev); kfree(wdev);
} }
...@@ -402,6 +402,7 @@ struct ath6kl_req_key { ...@@ -402,6 +402,7 @@ struct ath6kl_req_key {
struct ath6kl { struct ath6kl {
struct device *dev; struct device *dev;
struct net_device *net_dev; struct net_device *net_dev;
struct wiphy *wiphy;
struct ath6kl_bmi bmi; struct ath6kl_bmi bmi;
const struct ath6kl_hif_ops *hif_ops; const struct ath6kl_hif_ops *hif_ops;
struct wmi *wmi; struct wmi *wmi;
......
...@@ -1509,7 +1509,7 @@ int ath6kl_debug_init(struct ath6kl *ar) ...@@ -1509,7 +1509,7 @@ int ath6kl_debug_init(struct ath6kl *ar)
ar->debug.fwlog_mask = 0; ar->debug.fwlog_mask = 0;
ar->debugfs_phy = debugfs_create_dir("ath6kl", ar->debugfs_phy = debugfs_create_dir("ath6kl",
ar->wdev->wiphy->debugfsdir); ar->wiphy->debugfsdir);
if (!ar->debugfs_phy) { if (!ar->debugfs_phy) {
vfree(ar->debug.fwlog_buf.buf); vfree(ar->debug.fwlog_buf.buf);
kfree(ar->debug.fwlog_tmp); kfree(ar->debug.fwlog_tmp);
......
...@@ -584,7 +584,7 @@ struct ath6kl *ath6kl_core_alloc(struct device *sdev) ...@@ -584,7 +584,7 @@ struct ath6kl *ath6kl_core_alloc(struct device *sdev)
} }
dev->ieee80211_ptr = wdev; dev->ieee80211_ptr = wdev;
SET_NETDEV_DEV(dev, wiphy_dev(wdev->wiphy)); SET_NETDEV_DEV(dev, wiphy_dev(ar->wiphy));
wdev->netdev = dev; wdev->netdev = dev;
ar->sme_state = SME_DISCONNECTED; ar->sme_state = SME_DISCONNECTED;
...@@ -1557,8 +1557,8 @@ static int ath6kl_init(struct ath6kl *ar) ...@@ -1557,8 +1557,8 @@ static int ath6kl_init(struct ath6kl *ar)
ar->conf_flags = ATH6KL_CONF_IGNORE_ERP_BARKER | ar->conf_flags = ATH6KL_CONF_IGNORE_ERP_BARKER |
ATH6KL_CONF_ENABLE_11N | ATH6KL_CONF_ENABLE_TX_BURST; ATH6KL_CONF_ENABLE_11N | ATH6KL_CONF_ENABLE_TX_BURST;
ar->wdev->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM | ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM |
WIPHY_FLAG_HAVE_AP_SME; WIPHY_FLAG_HAVE_AP_SME;
status = ath6kl_target_config_wlan_params(ar); status = ath6kl_target_config_wlan_params(ar);
if (!status) if (!status)
...@@ -1599,7 +1599,7 @@ int ath6kl_core_init(struct ath6kl *ar) ...@@ -1599,7 +1599,7 @@ int ath6kl_core_init(struct ath6kl *ar)
ar->version.target_ver = le32_to_cpu(targ_info.version); ar->version.target_ver = le32_to_cpu(targ_info.version);
ar->target_type = le32_to_cpu(targ_info.type); ar->target_type = le32_to_cpu(targ_info.type);
ar->wdev->wiphy->hw_version = le32_to_cpu(targ_info.version); ar->wiphy->hw_version = le32_to_cpu(targ_info.version);
ret = ath6kl_init_hw_params(ar); ret = ath6kl_init_hw_params(ar);
if (ret) if (ret)
......
...@@ -996,8 +996,8 @@ void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver) ...@@ -996,8 +996,8 @@ void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver)
ar->version.wlan_ver = sw_ver; ar->version.wlan_ver = sw_ver;
ar->version.abi_ver = abi_ver; ar->version.abi_ver = abi_ver;
snprintf(ar->wdev->wiphy->fw_version, snprintf(ar->wiphy->fw_version,
sizeof(ar->wdev->wiphy->fw_version), sizeof(ar->wiphy->fw_version),
"%u.%u.%u.%u", "%u.%u.%u.%u",
(ar->version.wlan_ver & 0xf0000000) >> 28, (ar->version.wlan_ver & 0xf0000000) >> 28,
(ar->version.wlan_ver & 0x0f000000) >> 24, (ar->version.wlan_ver & 0x0f000000) >> 24,
...@@ -1009,8 +1009,8 @@ void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver) ...@@ -1009,8 +1009,8 @@ void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver)
wake_up(&ar->event_wq); wake_up(&ar->event_wq);
ath6kl_info("hw %s fw %s%s\n", ath6kl_info("hw %s fw %s%s\n",
get_hw_id_string(ar->wdev->wiphy->hw_version), get_hw_id_string(ar->wiphy->hw_version),
ar->wdev->wiphy->fw_version, ar->wiphy->fw_version,
test_bit(TESTMODE, &ar->flag) ? " testmode" : ""); test_bit(TESTMODE, &ar->flag) ? " testmode" : "");
} }
......
...@@ -431,7 +431,7 @@ static int ath6kl_wmi_remain_on_chnl_event_rx(struct wmi *wmi, u8 *datap, ...@@ -431,7 +431,7 @@ static int ath6kl_wmi_remain_on_chnl_event_rx(struct wmi *wmi, u8 *datap,
dur = le32_to_cpu(ev->duration); dur = le32_to_cpu(ev->duration);
ath6kl_dbg(ATH6KL_DBG_WMI, "remain_on_chnl: freq=%u dur=%u\n", ath6kl_dbg(ATH6KL_DBG_WMI, "remain_on_chnl: freq=%u dur=%u\n",
freq, dur); freq, dur);
chan = ieee80211_get_channel(ar->wdev->wiphy, freq); chan = ieee80211_get_channel(ar->wiphy, freq);
if (!chan) { if (!chan) {
ath6kl_dbg(ATH6KL_DBG_WMI, "remain_on_chnl: Unknown channel " ath6kl_dbg(ATH6KL_DBG_WMI, "remain_on_chnl: Unknown channel "
"(freq=%u)\n", freq); "(freq=%u)\n", freq);
...@@ -460,7 +460,7 @@ static int ath6kl_wmi_cancel_remain_on_chnl_event_rx(struct wmi *wmi, ...@@ -460,7 +460,7 @@ static int ath6kl_wmi_cancel_remain_on_chnl_event_rx(struct wmi *wmi,
dur = le32_to_cpu(ev->duration); dur = le32_to_cpu(ev->duration);
ath6kl_dbg(ATH6KL_DBG_WMI, "cancel_remain_on_chnl: freq=%u dur=%u " ath6kl_dbg(ATH6KL_DBG_WMI, "cancel_remain_on_chnl: freq=%u dur=%u "
"status=%u\n", freq, dur, ev->status); "status=%u\n", freq, dur, ev->status);
chan = ieee80211_get_channel(ar->wdev->wiphy, freq); chan = ieee80211_get_channel(ar->wiphy, freq);
if (!chan) { if (!chan) {
ath6kl_dbg(ATH6KL_DBG_WMI, "cancel_remain_on_chnl: Unknown " ath6kl_dbg(ATH6KL_DBG_WMI, "cancel_remain_on_chnl: Unknown "
"channel (freq=%u)\n", freq); "channel (freq=%u)\n", freq);
...@@ -878,7 +878,7 @@ static void ath6kl_wmi_regdomain_event(struct wmi *wmi, u8 *datap, int len) ...@@ -878,7 +878,7 @@ static void ath6kl_wmi_regdomain_event(struct wmi *wmi, u8 *datap, int len)
alpha2[0] = country->isoName[0]; alpha2[0] = country->isoName[0];
alpha2[1] = country->isoName[1]; alpha2[1] = country->isoName[1];
regulatory_hint(wmi->parent_dev->wdev->wiphy, alpha2); regulatory_hint(wmi->parent_dev->wiphy, alpha2);
ath6kl_dbg(ATH6KL_DBG_WMI, "Country alpha2 being used: %c%c\n", ath6kl_dbg(ATH6KL_DBG_WMI, "Country alpha2 being used: %c%c\n",
alpha2[0], alpha2[1]); alpha2[0], alpha2[1]);
...@@ -974,7 +974,7 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len) ...@@ -974,7 +974,7 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len)
ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0); ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0);
} }
channel = ieee80211_get_channel(ar->wdev->wiphy, le16_to_cpu(bih->ch)); channel = ieee80211_get_channel(ar->wiphy, le16_to_cpu(bih->ch));
if (channel == NULL) if (channel == NULL)
return -EINVAL; return -EINVAL;
...@@ -1021,7 +1021,7 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len) ...@@ -1021,7 +1021,7 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len)
memcpy(&mgmt->u.beacon, buf, len); memcpy(&mgmt->u.beacon, buf, len);
bss = cfg80211_inform_bss_frame(ar->wdev->wiphy, channel, mgmt, bss = cfg80211_inform_bss_frame(ar->wiphy, channel, mgmt,
24 + len, (bih->snr - 95) * 100, 24 + len, (bih->snr - 95) * 100,
GFP_ATOMIC); GFP_ATOMIC);
kfree(mgmt); kfree(mgmt);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册