aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>2011-10-25 10:03:57 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2011-11-11 05:58:45 -0500
commitbe98e3a48cb9b9e63da8537a378f656af2a9f2c6 (patch)
tree44c0b5c04895d8164757315b6814357ae31f4aeb
parent521dffcc8ae90ad08e9d9f12d9f9acc9db562194 (diff)
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: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c50
-rw-r--r--drivers/net/wireless/ath/ath6kl/core.h1
-rw-r--r--drivers/net/wireless/ath/ath6kl/debug.c2
-rw-r--r--drivers/net/wireless/ath/ath6kl/init.c8
-rw-r--r--drivers/net/wireless/ath/ath6kl/main.c8
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.c10
6 files changed, 40 insertions, 39 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 16258c2ec403..4fee927770fc 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -481,7 +481,7 @@ static int ath6kl_add_bss_if_needed(struct ath6kl *ar, const u8 *bssid,
481 struct cfg80211_bss *bss; 481 struct cfg80211_bss *bss;
482 u8 *ie; 482 u8 *ie;
483 483
484 bss = cfg80211_get_bss(ar->wdev->wiphy, chan, bssid, 484 bss = cfg80211_get_bss(ar->wiphy, chan, bssid,
485 ar->ssid, ar->ssid_len, WLAN_CAPABILITY_ESS, 485 ar->ssid, ar->ssid_len, WLAN_CAPABILITY_ESS,
486 WLAN_CAPABILITY_ESS); 486 WLAN_CAPABILITY_ESS);
487 if (bss == NULL) { 487 if (bss == NULL) {
@@ -500,7 +500,7 @@ static int ath6kl_add_bss_if_needed(struct ath6kl *ar, const u8 *bssid,
500 ie[1] = ar->ssid_len; 500 ie[1] = ar->ssid_len;
501 memcpy(ie + 2, ar->ssid, ar->ssid_len); 501 memcpy(ie + 2, ar->ssid, ar->ssid_len);
502 memcpy(ie + 2 + ar->ssid_len, beacon_ie, beacon_ie_len); 502 memcpy(ie + 2 + ar->ssid_len, beacon_ie, beacon_ie_len);
503 bss = cfg80211_inform_bss(ar->wdev->wiphy, chan, 503 bss = cfg80211_inform_bss(ar->wiphy, chan,
504 bssid, 0, WLAN_CAPABILITY_ESS, 100, 504 bssid, 0, WLAN_CAPABILITY_ESS, 100,
505 ie, 2 + ar->ssid_len + beacon_ie_len, 505 ie, 2 + ar->ssid_len + beacon_ie_len,
506 0, GFP_KERNEL); 506 0, GFP_KERNEL);
@@ -567,7 +567,7 @@ void ath6kl_cfg80211_connect_event(struct ath6kl *ar, u16 channel,
567 } 567 }
568 } 568 }
569 569
570 chan = ieee80211_get_channel(ar->wdev->wiphy, (int) channel); 570 chan = ieee80211_get_channel(ar->wiphy, (int) channel);
571 571
572 572
573 if (nw_type & ADHOC_NETWORK) { 573 if (nw_type & ADHOC_NETWORK) {
@@ -1924,6 +1924,7 @@ struct wireless_dev *ath6kl_cfg80211_init(struct device *dev)
1924 int ret = 0; 1924 int ret = 0;
1925 struct wireless_dev *wdev; 1925 struct wireless_dev *wdev;
1926 struct ath6kl *ar; 1926 struct ath6kl *ar;
1927 struct wiphy *wiphy;
1927 1928
1928 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); 1929 wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
1929 if (!wdev) { 1930 if (!wdev) {
@@ -1932,43 +1933,45 @@ struct wireless_dev *ath6kl_cfg80211_init(struct device *dev)
1932 } 1933 }
1933 1934
1934 /* create a new wiphy for use with cfg80211 */ 1935 /* create a new wiphy for use with cfg80211 */
1935 wdev->wiphy = wiphy_new(&ath6kl_cfg80211_ops, sizeof(struct ath6kl)); 1936 wiphy = wiphy_new(&ath6kl_cfg80211_ops, sizeof(struct ath6kl));
1936 if (!wdev->wiphy) { 1937 if (!wiphy) {
1937 ath6kl_err("couldn't allocate wiphy device\n"); 1938 ath6kl_err("couldn't allocate wiphy device\n");
1938 kfree(wdev); 1939 kfree(wdev);
1939 return NULL; 1940 return NULL;
1940 } 1941 }
1941 1942
1942 ar = wiphy_priv(wdev->wiphy); 1943 ar = wiphy_priv(wiphy);
1943 ar->p2p = !!ath6kl_p2p; 1944 ar->p2p = !!ath6kl_p2p;
1945 ar->wiphy = wiphy;
1946 wdev->wiphy = wiphy;
1944 1947
1945 wdev->wiphy->mgmt_stypes = ath6kl_mgmt_stypes; 1948 wiphy->mgmt_stypes = ath6kl_mgmt_stypes;
1946 1949
1947 wdev->wiphy->max_remain_on_channel_duration = 5000; 1950 wiphy->max_remain_on_channel_duration = 5000;
1948 1951
1949 /* set device pointer for wiphy */ 1952 /* set device pointer for wiphy */
1950 set_wiphy_dev(wdev->wiphy, dev); 1953 set_wiphy_dev(wiphy, dev);
1951 1954
1952 wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | 1955 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
1953 BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); 1956 BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP);
1954 if (ar->p2p) { 1957 if (ar->p2p) {
1955 wdev->wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO) | 1958 wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO) |
1956 BIT(NL80211_IFTYPE_P2P_CLIENT); 1959 BIT(NL80211_IFTYPE_P2P_CLIENT);
1957 } 1960 }
1958 /* max num of ssids that can be probed during scanning */ 1961 /* max num of ssids that can be probed during scanning */
1959 wdev->wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX; 1962 wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX;
1960 wdev->wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */ 1963 wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */
1961 wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz; 1964 wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz;
1962 wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &ath6kl_band_5ghz; 1965 wiphy->bands[IEEE80211_BAND_5GHZ] = &ath6kl_band_5ghz;
1963 wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; 1966 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
1964 1967
1965 wdev->wiphy->cipher_suites = cipher_suites; 1968 wiphy->cipher_suites = cipher_suites;
1966 wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); 1969 wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
1967 1970
1968 ret = wiphy_register(wdev->wiphy); 1971 ret = wiphy_register(wiphy);
1969 if (ret < 0) { 1972 if (ret < 0) {
1970 ath6kl_err("couldn't register wiphy device\n"); 1973 ath6kl_err("couldn't register wiphy device\n");
1971 wiphy_free(wdev->wiphy); 1974 wiphy_free(wiphy);
1972 kfree(wdev); 1975 kfree(wdev);
1973 return NULL; 1976 return NULL;
1974 } 1977 }
@@ -1985,10 +1988,7 @@ void ath6kl_cfg80211_deinit(struct ath6kl *ar)
1985 ar->scan_req = NULL; 1988 ar->scan_req = NULL;
1986 } 1989 }
1987 1990
1988 if (!wdev) 1991 wiphy_unregister(ar->wiphy);
1989 return; 1992 wiphy_free(ar->wiphy);
1990
1991 wiphy_unregister(wdev->wiphy);
1992 wiphy_free(wdev->wiphy);
1993 kfree(wdev); 1993 kfree(wdev);
1994} 1994}
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index 31e5c7ea1ce1..fb5a32280a7b 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -402,6 +402,7 @@ struct ath6kl_req_key {
402struct ath6kl { 402struct ath6kl {
403 struct device *dev; 403 struct device *dev;
404 struct net_device *net_dev; 404 struct net_device *net_dev;
405 struct wiphy *wiphy;
405 struct ath6kl_bmi bmi; 406 struct ath6kl_bmi bmi;
406 const struct ath6kl_hif_ops *hif_ops; 407 const struct ath6kl_hif_ops *hif_ops;
407 struct wmi *wmi; 408 struct wmi *wmi;
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index bafc81058dcb..f067c7b1b121 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -1509,7 +1509,7 @@ int ath6kl_debug_init(struct ath6kl *ar)
1509 ar->debug.fwlog_mask = 0; 1509 ar->debug.fwlog_mask = 0;
1510 1510
1511 ar->debugfs_phy = debugfs_create_dir("ath6kl", 1511 ar->debugfs_phy = debugfs_create_dir("ath6kl",
1512 ar->wdev->wiphy->debugfsdir); 1512 ar->wiphy->debugfsdir);
1513 if (!ar->debugfs_phy) { 1513 if (!ar->debugfs_phy) {
1514 vfree(ar->debug.fwlog_buf.buf); 1514 vfree(ar->debug.fwlog_buf.buf);
1515 kfree(ar->debug.fwlog_tmp); 1515 kfree(ar->debug.fwlog_tmp);
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 2534e88b252c..1f1ed284cf40 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -584,7 +584,7 @@ struct ath6kl *ath6kl_core_alloc(struct device *sdev)
584 } 584 }
585 585
586 dev->ieee80211_ptr = wdev; 586 dev->ieee80211_ptr = wdev;
587 SET_NETDEV_DEV(dev, wiphy_dev(wdev->wiphy)); 587 SET_NETDEV_DEV(dev, wiphy_dev(ar->wiphy));
588 wdev->netdev = dev; 588 wdev->netdev = dev;
589 ar->sme_state = SME_DISCONNECTED; 589 ar->sme_state = SME_DISCONNECTED;
590 590
@@ -1557,8 +1557,8 @@ static int ath6kl_init(struct ath6kl *ar)
1557 ar->conf_flags = ATH6KL_CONF_IGNORE_ERP_BARKER | 1557 ar->conf_flags = ATH6KL_CONF_IGNORE_ERP_BARKER |
1558 ATH6KL_CONF_ENABLE_11N | ATH6KL_CONF_ENABLE_TX_BURST; 1558 ATH6KL_CONF_ENABLE_11N | ATH6KL_CONF_ENABLE_TX_BURST;
1559 1559
1560 ar->wdev->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM | 1560 ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM |
1561 WIPHY_FLAG_HAVE_AP_SME; 1561 WIPHY_FLAG_HAVE_AP_SME;
1562 1562
1563 status = ath6kl_target_config_wlan_params(ar); 1563 status = ath6kl_target_config_wlan_params(ar);
1564 if (!status) 1564 if (!status)
@@ -1599,7 +1599,7 @@ int ath6kl_core_init(struct ath6kl *ar)
1599 1599
1600 ar->version.target_ver = le32_to_cpu(targ_info.version); 1600 ar->version.target_ver = le32_to_cpu(targ_info.version);
1601 ar->target_type = le32_to_cpu(targ_info.type); 1601 ar->target_type = le32_to_cpu(targ_info.type);
1602 ar->wdev->wiphy->hw_version = le32_to_cpu(targ_info.version); 1602 ar->wiphy->hw_version = le32_to_cpu(targ_info.version);
1603 1603
1604 ret = ath6kl_init_hw_params(ar); 1604 ret = ath6kl_init_hw_params(ar);
1605 if (ret) 1605 if (ret)
diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c
index e6937565a489..4470f6ed0dbc 100644
--- a/drivers/net/wireless/ath/ath6kl/main.c
+++ b/drivers/net/wireless/ath/ath6kl/main.c
@@ -996,8 +996,8 @@ void ath6kl_ready_event(void *devt, u8 *datap, u32 sw_ver, u32 abi_ver)
996 ar->version.wlan_ver = sw_ver; 996 ar->version.wlan_ver = sw_ver;
997 ar->version.abi_ver = abi_ver; 997 ar->version.abi_ver = abi_ver;
998 998
999 snprintf(ar->wdev->wiphy->fw_version, 999 snprintf(ar->wiphy->fw_version,
1000 sizeof(ar->wdev->wiphy->fw_version), 1000 sizeof(ar->wiphy->fw_version),
1001 "%u.%u.%u.%u", 1001 "%u.%u.%u.%u",
1002 (ar->version.wlan_ver & 0xf0000000) >> 28, 1002 (ar->version.wlan_ver & 0xf0000000) >> 28,
1003 (ar->version.wlan_ver & 0x0f000000) >> 24, 1003 (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 wake_up(&ar->event_wq); 1009 wake_up(&ar->event_wq);
1010 1010
1011 ath6kl_info("hw %s fw %s%s\n", 1011 ath6kl_info("hw %s fw %s%s\n",
1012 get_hw_id_string(ar->wdev->wiphy->hw_version), 1012 get_hw_id_string(ar->wiphy->hw_version),
1013 ar->wdev->wiphy->fw_version, 1013 ar->wiphy->fw_version,
1014 test_bit(TESTMODE, &ar->flag) ? " testmode" : ""); 1014 test_bit(TESTMODE, &ar->flag) ? " testmode" : "");
1015} 1015}
1016 1016
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index 7b6bfdde119c..7f4c2c2ab71b 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -431,7 +431,7 @@ static int ath6kl_wmi_remain_on_chnl_event_rx(struct wmi *wmi, u8 *datap,
431 dur = le32_to_cpu(ev->duration); 431 dur = le32_to_cpu(ev->duration);
432 ath6kl_dbg(ATH6KL_DBG_WMI, "remain_on_chnl: freq=%u dur=%u\n", 432 ath6kl_dbg(ATH6KL_DBG_WMI, "remain_on_chnl: freq=%u dur=%u\n",
433 freq, dur); 433 freq, dur);
434 chan = ieee80211_get_channel(ar->wdev->wiphy, freq); 434 chan = ieee80211_get_channel(ar->wiphy, freq);
435 if (!chan) { 435 if (!chan) {
436 ath6kl_dbg(ATH6KL_DBG_WMI, "remain_on_chnl: Unknown channel " 436 ath6kl_dbg(ATH6KL_DBG_WMI, "remain_on_chnl: Unknown channel "
437 "(freq=%u)\n", freq); 437 "(freq=%u)\n", freq);
@@ -460,7 +460,7 @@ static int ath6kl_wmi_cancel_remain_on_chnl_event_rx(struct wmi *wmi,
460 dur = le32_to_cpu(ev->duration); 460 dur = le32_to_cpu(ev->duration);
461 ath6kl_dbg(ATH6KL_DBG_WMI, "cancel_remain_on_chnl: freq=%u dur=%u " 461 ath6kl_dbg(ATH6KL_DBG_WMI, "cancel_remain_on_chnl: freq=%u dur=%u "
462 "status=%u\n", freq, dur, ev->status); 462 "status=%u\n", freq, dur, ev->status);
463 chan = ieee80211_get_channel(ar->wdev->wiphy, freq); 463 chan = ieee80211_get_channel(ar->wiphy, freq);
464 if (!chan) { 464 if (!chan) {
465 ath6kl_dbg(ATH6KL_DBG_WMI, "cancel_remain_on_chnl: Unknown " 465 ath6kl_dbg(ATH6KL_DBG_WMI, "cancel_remain_on_chnl: Unknown "
466 "channel (freq=%u)\n", freq); 466 "channel (freq=%u)\n", freq);
@@ -878,7 +878,7 @@ static void ath6kl_wmi_regdomain_event(struct wmi *wmi, u8 *datap, int len)
878 alpha2[0] = country->isoName[0]; 878 alpha2[0] = country->isoName[0];
879 alpha2[1] = country->isoName[1]; 879 alpha2[1] = country->isoName[1];
880 880
881 regulatory_hint(wmi->parent_dev->wdev->wiphy, alpha2); 881 regulatory_hint(wmi->parent_dev->wiphy, alpha2);
882 882
883 ath6kl_dbg(ATH6KL_DBG_WMI, "Country alpha2 being used: %c%c\n", 883 ath6kl_dbg(ATH6KL_DBG_WMI, "Country alpha2 being used: %c%c\n",
884 alpha2[0], alpha2[1]); 884 alpha2[0], alpha2[1]);
@@ -974,7 +974,7 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len)
974 ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0); 974 ath6kl_wmi_bssfilter_cmd(ar->wmi, NONE_BSS_FILTER, 0);
975 } 975 }
976 976
977 channel = ieee80211_get_channel(ar->wdev->wiphy, le16_to_cpu(bih->ch)); 977 channel = ieee80211_get_channel(ar->wiphy, le16_to_cpu(bih->ch));
978 if (channel == NULL) 978 if (channel == NULL)
979 return -EINVAL; 979 return -EINVAL;
980 980
@@ -1021,7 +1021,7 @@ static int ath6kl_wmi_bssinfo_event_rx(struct wmi *wmi, u8 *datap, int len)
1021 1021
1022 memcpy(&mgmt->u.beacon, buf, len); 1022 memcpy(&mgmt->u.beacon, buf, len);
1023 1023
1024 bss = cfg80211_inform_bss_frame(ar->wdev->wiphy, channel, mgmt, 1024 bss = cfg80211_inform_bss_frame(ar->wiphy, channel, mgmt,
1025 24 + len, (bih->snr - 95) * 100, 1025 24 + len, (bih->snr - 95) * 100,
1026 GFP_ATOMIC); 1026 GFP_ATOMIC);
1027 kfree(mgmt); 1027 kfree(mgmt);