aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorArend van Spriel <arend@broadcom.com>2012-09-27 08:17:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-09-28 13:54:09 -0400
commit27a68fe391231b26e1143d67ac368053b1bf5a37 (patch)
tree6905c03e083c609358908de20a148ec10d3dcccb /drivers/net/wireless
parent1a87334239757b69eb9885979c32bbf871b3ec88 (diff)
brcmfmac: rename structure brcmf_cfg80211_priv
Renamed structure to brcmf_cfg80211_info as it is not really a private structure since it is exposed in header file. Reviewed-by: Hante Meuleman <meuleman@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd.h2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c1193
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h36
3 files changed, 615 insertions, 616 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
index eed695a97323..17e7ae73e008 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd.h
@@ -614,7 +614,7 @@ struct brcmf_pub {
614 /* Linkage ponters */ 614 /* Linkage ponters */
615 struct brcmf_bus *bus_if; 615 struct brcmf_bus *bus_if;
616 struct brcmf_proto *prot; 616 struct brcmf_proto *prot;
617 struct brcmf_cfg80211_priv *config; 617 struct brcmf_cfg80211_info *config;
618 struct device *dev; /* fullmac dongle device pointer */ 618 struct device *dev; /* fullmac dongle device pointer */
619 619
620 /* Internal brcmf items */ 620 /* Internal brcmf items */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 0ecd0dfa6557..a0125d57c6c1 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -97,10 +97,10 @@ static u32 brcmf_dbg_level = WL_DBG_ERR;
97 97
98static bool check_sys_up(struct wiphy *wiphy) 98static bool check_sys_up(struct wiphy *wiphy)
99{ 99{
100 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 100 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
101 if (!test_bit(WL_STATUS_READY, &cfg_priv->status)) { 101 if (!test_bit(WL_STATUS_READY, &cfg->status)) {
102 WL_INFO("device is not ready : status (%d)\n", 102 WL_INFO("device is not ready : status (%d)\n",
103 (int)cfg_priv->status); 103 (int)cfg->status);
104 return false; 104 return false;
105 } 105 }
106 return true; 106 return true;
@@ -457,7 +457,7 @@ static void convert_key_from_CPU(struct brcmf_wsec_key *key,
457} 457}
458 458
459static int 459static int
460send_key_to_dongle(struct brcmf_cfg80211_priv *cfg_priv, s32 bssidx, 460send_key_to_dongle(struct brcmf_cfg80211_info *cfg, s32 bssidx,
461 struct net_device *ndev, struct brcmf_wsec_key *key) 461 struct net_device *ndev, struct brcmf_wsec_key *key)
462{ 462{
463 int err; 463 int err;
@@ -467,7 +467,7 @@ send_key_to_dongle(struct brcmf_cfg80211_priv *cfg_priv, s32 bssidx,
467 467
468 err = brcmf_dev_iovar_setbuf_bsscfg(ndev, "wsec_key", &key_le, 468 err = brcmf_dev_iovar_setbuf_bsscfg(ndev, "wsec_key", &key_le,
469 sizeof(key_le), 469 sizeof(key_le),
470 cfg_priv->extra_buf, 470 cfg->extra_buf,
471 WL_EXTRA_BUF_MAX, bssidx); 471 WL_EXTRA_BUF_MAX, bssidx);
472 472
473 if (err) 473 if (err)
@@ -480,7 +480,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
480 enum nl80211_iftype type, u32 *flags, 480 enum nl80211_iftype type, u32 *flags,
481 struct vif_params *params) 481 struct vif_params *params)
482{ 482{
483 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 483 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
484 s32 infra = 0; 484 s32 infra = 0;
485 s32 ap = 0; 485 s32 ap = 0;
486 s32 err = 0; 486 s32 err = 0;
@@ -494,15 +494,15 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
494 type); 494 type);
495 return -EOPNOTSUPP; 495 return -EOPNOTSUPP;
496 case NL80211_IFTYPE_ADHOC: 496 case NL80211_IFTYPE_ADHOC:
497 cfg_priv->conf->mode = WL_MODE_IBSS; 497 cfg->conf->mode = WL_MODE_IBSS;
498 infra = 0; 498 infra = 0;
499 break; 499 break;
500 case NL80211_IFTYPE_STATION: 500 case NL80211_IFTYPE_STATION:
501 cfg_priv->conf->mode = WL_MODE_BSS; 501 cfg->conf->mode = WL_MODE_BSS;
502 infra = 1; 502 infra = 1;
503 break; 503 break;
504 case NL80211_IFTYPE_AP: 504 case NL80211_IFTYPE_AP:
505 cfg_priv->conf->mode = WL_MODE_AP; 505 cfg->conf->mode = WL_MODE_AP;
506 ap = 1; 506 ap = 1;
507 break; 507 break;
508 default: 508 default:
@@ -511,11 +511,11 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
511 } 511 }
512 512
513 if (ap) { 513 if (ap) {
514 set_bit(WL_STATUS_AP_CREATING, &cfg_priv->status); 514 set_bit(WL_STATUS_AP_CREATING, &cfg->status);
515 if (!cfg_priv->ap_info) 515 if (!cfg->ap_info)
516 cfg_priv->ap_info = kzalloc(sizeof(*cfg_priv->ap_info), 516 cfg->ap_info = kzalloc(sizeof(*cfg->ap_info),
517 GFP_KERNEL); 517 GFP_KERNEL);
518 if (!cfg_priv->ap_info) { 518 if (!cfg->ap_info) {
519 err = -ENOMEM; 519 err = -ENOMEM;
520 goto done; 520 goto done;
521 } 521 }
@@ -528,7 +528,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
528 goto done; 528 goto done;
529 } 529 }
530 WL_INFO("IF Type = %s\n", 530 WL_INFO("IF Type = %s\n",
531 (cfg_priv->conf->mode == WL_MODE_IBSS) ? 531 (cfg->conf->mode == WL_MODE_IBSS) ?
532 "Adhoc" : "Infra"); 532 "Adhoc" : "Infra");
533 } 533 }
534 ndev->ieee80211_ptr->iftype = type; 534 ndev->ieee80211_ptr->iftype = type;
@@ -620,7 +620,7 @@ brcmf_dev_intvar_get_bsscfg(struct net_device *ndev, s8 *name, s32 *val,
620 * should return the ndev matching bssidx. 620 * should return the ndev matching bssidx.
621 */ 621 */
622static s32 622static s32
623brcmf_find_bssidx(struct brcmf_cfg80211_priv *cfg_priv, struct net_device *ndev) 623brcmf_find_bssidx(struct brcmf_cfg80211_info *cfg, struct net_device *ndev)
624{ 624{
625 return 0; 625 return 0;
626} 626}
@@ -628,9 +628,9 @@ brcmf_find_bssidx(struct brcmf_cfg80211_priv *cfg_priv, struct net_device *ndev)
628static void brcmf_set_mpc(struct net_device *ndev, int mpc) 628static void brcmf_set_mpc(struct net_device *ndev, int mpc)
629{ 629{
630 s32 err = 0; 630 s32 err = 0;
631 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); 631 struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
632 632
633 if (test_bit(WL_STATUS_READY, &cfg_priv->status)) { 633 if (test_bit(WL_STATUS_READY, &cfg->status)) {
634 err = brcmf_dev_intvar_set(ndev, "mpc", mpc); 634 err = brcmf_dev_intvar_set(ndev, "mpc", mpc);
635 if (err) { 635 if (err) {
636 WL_ERR("fail to set mpc\n"); 636 WL_ERR("fail to set mpc\n");
@@ -714,10 +714,10 @@ brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
714 return err; 714 return err;
715} 715}
716 716
717static s32 brcmf_do_iscan(struct brcmf_cfg80211_priv *cfg_priv) 717static s32 brcmf_do_iscan(struct brcmf_cfg80211_info *cfg)
718{ 718{
719 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg_priv); 719 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg);
720 struct net_device *ndev = cfg_to_ndev(cfg_priv); 720 struct net_device *ndev = cfg_to_ndev(cfg);
721 struct brcmf_ssid ssid; 721 struct brcmf_ssid ssid;
722 __le32 passive_scan; 722 __le32 passive_scan;
723 s32 err = 0; 723 s32 err = 0;
@@ -727,19 +727,19 @@ static s32 brcmf_do_iscan(struct brcmf_cfg80211_priv *cfg_priv)
727 727
728 iscan->state = WL_ISCAN_STATE_SCANING; 728 iscan->state = WL_ISCAN_STATE_SCANING;
729 729
730 passive_scan = cfg_priv->active_scan ? 0 : cpu_to_le32(1); 730 passive_scan = cfg->active_scan ? 0 : cpu_to_le32(1);
731 err = brcmf_exec_dcmd(cfg_to_ndev(cfg_priv), BRCMF_C_SET_PASSIVE_SCAN, 731 err = brcmf_exec_dcmd(cfg_to_ndev(cfg), BRCMF_C_SET_PASSIVE_SCAN,
732 &passive_scan, sizeof(passive_scan)); 732 &passive_scan, sizeof(passive_scan));
733 if (err) { 733 if (err) {
734 WL_ERR("error (%d)\n", err); 734 WL_ERR("error (%d)\n", err);
735 return err; 735 return err;
736 } 736 }
737 brcmf_set_mpc(ndev, 0); 737 brcmf_set_mpc(ndev, 0);
738 cfg_priv->iscan_kickstart = true; 738 cfg->iscan_kickstart = true;
739 err = brcmf_run_iscan(iscan, &ssid, BRCMF_SCAN_ACTION_START); 739 err = brcmf_run_iscan(iscan, &ssid, BRCMF_SCAN_ACTION_START);
740 if (err) { 740 if (err) {
741 brcmf_set_mpc(ndev, 1); 741 brcmf_set_mpc(ndev, 1);
742 cfg_priv->iscan_kickstart = false; 742 cfg->iscan_kickstart = false;
743 return err; 743 return err;
744 } 744 }
745 mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000); 745 mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
@@ -752,27 +752,27 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev,
752 struct cfg80211_scan_request *request, 752 struct cfg80211_scan_request *request,
753 struct cfg80211_ssid *this_ssid) 753 struct cfg80211_ssid *this_ssid)
754{ 754{
755 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); 755 struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
756 struct cfg80211_ssid *ssids; 756 struct cfg80211_ssid *ssids;
757 struct brcmf_cfg80211_scan_req *sr = cfg_priv->scan_req_int; 757 struct brcmf_cfg80211_scan_req *sr = cfg->scan_req_int;
758 __le32 passive_scan; 758 __le32 passive_scan;
759 bool iscan_req; 759 bool iscan_req;
760 bool spec_scan; 760 bool spec_scan;
761 s32 err = 0; 761 s32 err = 0;
762 u32 SSID_len; 762 u32 SSID_len;
763 763
764 if (test_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { 764 if (test_bit(WL_STATUS_SCANNING, &cfg->status)) {
765 WL_ERR("Scanning already : status (%lu)\n", cfg_priv->status); 765 WL_ERR("Scanning already : status (%lu)\n", cfg->status);
766 return -EAGAIN; 766 return -EAGAIN;
767 } 767 }
768 if (test_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status)) { 768 if (test_bit(WL_STATUS_SCAN_ABORTING, &cfg->status)) {
769 WL_ERR("Scanning being aborted : status (%lu)\n", 769 WL_ERR("Scanning being aborted : status (%lu)\n",
770 cfg_priv->status); 770 cfg->status);
771 return -EAGAIN; 771 return -EAGAIN;
772 } 772 }
773 if (test_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) { 773 if (test_bit(WL_STATUS_CONNECTING, &cfg->status)) {
774 WL_ERR("Connecting : status (%lu)\n", 774 WL_ERR("Connecting : status (%lu)\n",
775 cfg_priv->status); 775 cfg->status);
776 return -EAGAIN; 776 return -EAGAIN;
777 } 777 }
778 778
@@ -781,7 +781,7 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev,
781 if (request) { 781 if (request) {
782 /* scan bss */ 782 /* scan bss */
783 ssids = request->ssids; 783 ssids = request->ssids;
784 if (cfg_priv->iscan_on && (!ssids || !ssids->ssid_len)) 784 if (cfg->iscan_on && (!ssids || !ssids->ssid_len))
785 iscan_req = true; 785 iscan_req = true;
786 } else { 786 } else {
787 /* scan in ibss */ 787 /* scan in ibss */
@@ -789,10 +789,10 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev,
789 ssids = this_ssid; 789 ssids = this_ssid;
790 } 790 }
791 791
792 cfg_priv->scan_request = request; 792 cfg->scan_request = request;
793 set_bit(WL_STATUS_SCANNING, &cfg_priv->status); 793 set_bit(WL_STATUS_SCANNING, &cfg->status);
794 if (iscan_req) { 794 if (iscan_req) {
795 err = brcmf_do_iscan(cfg_priv); 795 err = brcmf_do_iscan(cfg);
796 if (!err) 796 if (!err)
797 return err; 797 return err;
798 else 798 else
@@ -811,7 +811,7 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev,
811 WL_SCAN("Broadcast scan\n"); 811 WL_SCAN("Broadcast scan\n");
812 } 812 }
813 813
814 passive_scan = cfg_priv->active_scan ? 0 : cpu_to_le32(1); 814 passive_scan = cfg->active_scan ? 0 : cpu_to_le32(1);
815 err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_PASSIVE_SCAN, 815 err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_PASSIVE_SCAN,
816 &passive_scan, sizeof(passive_scan)); 816 &passive_scan, sizeof(passive_scan));
817 if (err) { 817 if (err) {
@@ -836,8 +836,8 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev,
836 return 0; 836 return 0;
837 837
838scan_out: 838scan_out:
839 clear_bit(WL_STATUS_SCANNING, &cfg_priv->status); 839 clear_bit(WL_STATUS_SCANNING, &cfg->status);
840 cfg_priv->scan_request = NULL; 840 cfg->scan_request = NULL;
841 return err; 841 return err;
842} 842}
843 843
@@ -942,7 +942,7 @@ static void brcmf_escan_prep(struct brcmf_scan_params_le *params_le,
942} 942}
943 943
944static s32 944static s32
945brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv, 945brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
946 struct net_device *ndev, 946 struct net_device *ndev,
947 bool aborted, bool fw_abort) 947 bool aborted, bool fw_abort)
948{ 948{
@@ -954,11 +954,11 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv,
954 954
955 /* clear scan request, because the FW abort can cause a second call */ 955 /* clear scan request, because the FW abort can cause a second call */
956 /* to this functon and might cause a double cfg80211_scan_done */ 956 /* to this functon and might cause a double cfg80211_scan_done */
957 scan_request = cfg_priv->scan_request; 957 scan_request = cfg->scan_request;
958 cfg_priv->scan_request = NULL; 958 cfg->scan_request = NULL;
959 959
960 if (timer_pending(&cfg_priv->escan_timeout)) 960 if (timer_pending(&cfg->escan_timeout))
961 del_timer_sync(&cfg_priv->escan_timeout); 961 del_timer_sync(&cfg->escan_timeout);
962 962
963 if (fw_abort) { 963 if (fw_abort) {
964 /* Do a scan abort to stop the driver's scan engine */ 964 /* Do a scan abort to stop the driver's scan engine */
@@ -984,11 +984,11 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv,
984 * e-scan can be initiated by scheduled scan 984 * e-scan can be initiated by scheduled scan
985 * which takes precedence. 985 * which takes precedence.
986 */ 986 */
987 if (cfg_priv->sched_escan) { 987 if (cfg->sched_escan) {
988 WL_SCAN("scheduled scan completed\n"); 988 WL_SCAN("scheduled scan completed\n");
989 cfg_priv->sched_escan = false; 989 cfg->sched_escan = false;
990 if (!aborted) 990 if (!aborted)
991 cfg80211_sched_scan_results(cfg_to_wiphy(cfg_priv)); 991 cfg80211_sched_scan_results(cfg_to_wiphy(cfg));
992 brcmf_set_mpc(ndev, 1); 992 brcmf_set_mpc(ndev, 1);
993 } else if (scan_request) { 993 } else if (scan_request) {
994 WL_SCAN("ESCAN Completed scan: %s\n", 994 WL_SCAN("ESCAN Completed scan: %s\n",
@@ -996,7 +996,7 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv,
996 cfg80211_scan_done(scan_request, aborted); 996 cfg80211_scan_done(scan_request, aborted);
997 brcmf_set_mpc(ndev, 1); 997 brcmf_set_mpc(ndev, 1);
998 } 998 }
999 if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { 999 if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg->status)) {
1000 WL_ERR("Scan complete while device not scanning\n"); 1000 WL_ERR("Scan complete while device not scanning\n");
1001 return -EPERM; 1001 return -EPERM;
1002 } 1002 }
@@ -1005,7 +1005,7 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv,
1005} 1005}
1006 1006
1007static s32 1007static s32
1008brcmf_run_escan(struct brcmf_cfg80211_priv *cfg_priv, struct net_device *ndev, 1008brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct net_device *ndev,
1009 struct cfg80211_scan_request *request, u16 action) 1009 struct cfg80211_scan_request *request, u16 action)
1010{ 1010{
1011 s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE + 1011 s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE +
@@ -1035,7 +1035,7 @@ brcmf_run_escan(struct brcmf_cfg80211_priv *cfg_priv, struct net_device *ndev,
1035 params->sync_id = cpu_to_le16(0x1234); 1035 params->sync_id = cpu_to_le16(0x1234);
1036 1036
1037 err = brcmf_dev_iovar_setbuf(ndev, "escan", params, params_size, 1037 err = brcmf_dev_iovar_setbuf(ndev, "escan", params, params_size,
1038 cfg_priv->escan_ioctl_buf, BRCMF_DCMD_MEDLEN); 1038 cfg->escan_ioctl_buf, BRCMF_DCMD_MEDLEN);
1039 if (err) { 1039 if (err) {
1040 if (err == -EBUSY) 1040 if (err == -EBUSY)
1041 WL_INFO("system busy : escan canceled\n"); 1041 WL_INFO("system busy : escan canceled\n");
@@ -1049,7 +1049,7 @@ exit:
1049} 1049}
1050 1050
1051static s32 1051static s32
1052brcmf_do_escan(struct brcmf_cfg80211_priv *cfg_priv, struct wiphy *wiphy, 1052brcmf_do_escan(struct brcmf_cfg80211_info *cfg, struct wiphy *wiphy,
1053 struct net_device *ndev, struct cfg80211_scan_request *request) 1053 struct net_device *ndev, struct cfg80211_scan_request *request)
1054{ 1054{
1055 s32 err; 1055 s32 err;
@@ -1057,10 +1057,10 @@ brcmf_do_escan(struct brcmf_cfg80211_priv *cfg_priv, struct wiphy *wiphy,
1057 struct brcmf_scan_results *results; 1057 struct brcmf_scan_results *results;
1058 1058
1059 WL_SCAN("Enter\n"); 1059 WL_SCAN("Enter\n");
1060 cfg_priv->escan_info.ndev = ndev; 1060 cfg->escan_info.ndev = ndev;
1061 cfg_priv->escan_info.wiphy = wiphy; 1061 cfg->escan_info.wiphy = wiphy;
1062 cfg_priv->escan_info.escan_state = WL_ESCAN_STATE_SCANNING; 1062 cfg->escan_info.escan_state = WL_ESCAN_STATE_SCANNING;
1063 passive_scan = cfg_priv->active_scan ? 0 : cpu_to_le32(1); 1063 passive_scan = cfg->active_scan ? 0 : cpu_to_le32(1);
1064 err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_PASSIVE_SCAN, 1064 err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_PASSIVE_SCAN,
1065 &passive_scan, sizeof(passive_scan)); 1065 &passive_scan, sizeof(passive_scan));
1066 if (err) { 1066 if (err) {
@@ -1068,12 +1068,12 @@ brcmf_do_escan(struct brcmf_cfg80211_priv *cfg_priv, struct wiphy *wiphy,
1068 return err; 1068 return err;
1069 } 1069 }
1070 brcmf_set_mpc(ndev, 0); 1070 brcmf_set_mpc(ndev, 0);
1071 results = (struct brcmf_scan_results *)cfg_priv->escan_info.escan_buf; 1071 results = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
1072 results->version = 0; 1072 results->version = 0;
1073 results->count = 0; 1073 results->count = 0;
1074 results->buflen = WL_ESCAN_RESULTS_FIXED_SIZE; 1074 results->buflen = WL_ESCAN_RESULTS_FIXED_SIZE;
1075 1075
1076 err = brcmf_run_escan(cfg_priv, ndev, request, WL_ESCAN_ACTION_START); 1076 err = brcmf_run_escan(cfg, ndev, request, WL_ESCAN_ACTION_START);
1077 if (err) 1077 if (err)
1078 brcmf_set_mpc(ndev, 1); 1078 brcmf_set_mpc(ndev, 1);
1079 return err; 1079 return err;
@@ -1084,9 +1084,9 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
1084 struct cfg80211_scan_request *request, 1084 struct cfg80211_scan_request *request,
1085 struct cfg80211_ssid *this_ssid) 1085 struct cfg80211_ssid *this_ssid)
1086{ 1086{
1087 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); 1087 struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
1088 struct cfg80211_ssid *ssids; 1088 struct cfg80211_ssid *ssids;
1089 struct brcmf_cfg80211_scan_req *sr = cfg_priv->scan_req_int; 1089 struct brcmf_cfg80211_scan_req *sr = cfg->scan_req_int;
1090 __le32 passive_scan; 1090 __le32 passive_scan;
1091 bool escan_req; 1091 bool escan_req;
1092 bool spec_scan; 1092 bool spec_scan;
@@ -1095,23 +1095,23 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
1095 1095
1096 WL_SCAN("START ESCAN\n"); 1096 WL_SCAN("START ESCAN\n");
1097 1097
1098 if (test_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { 1098 if (test_bit(WL_STATUS_SCANNING, &cfg->status)) {
1099 WL_ERR("Scanning already : status (%lu)\n", cfg_priv->status); 1099 WL_ERR("Scanning already : status (%lu)\n", cfg->status);
1100 return -EAGAIN; 1100 return -EAGAIN;
1101 } 1101 }
1102 if (test_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status)) { 1102 if (test_bit(WL_STATUS_SCAN_ABORTING, &cfg->status)) {
1103 WL_ERR("Scanning being aborted : status (%lu)\n", 1103 WL_ERR("Scanning being aborted : status (%lu)\n",
1104 cfg_priv->status); 1104 cfg->status);
1105 return -EAGAIN; 1105 return -EAGAIN;
1106 } 1106 }
1107 if (test_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) { 1107 if (test_bit(WL_STATUS_CONNECTING, &cfg->status)) {
1108 WL_ERR("Connecting : status (%lu)\n", 1108 WL_ERR("Connecting : status (%lu)\n",
1109 cfg_priv->status); 1109 cfg->status);
1110 return -EAGAIN; 1110 return -EAGAIN;
1111 } 1111 }
1112 1112
1113 /* Arm scan timeout timer */ 1113 /* Arm scan timeout timer */
1114 mod_timer(&cfg_priv->escan_timeout, jiffies + 1114 mod_timer(&cfg->escan_timeout, jiffies +
1115 WL_ESCAN_TIMER_INTERVAL_MS * HZ / 1000); 1115 WL_ESCAN_TIMER_INTERVAL_MS * HZ / 1000);
1116 1116
1117 escan_req = false; 1117 escan_req = false;
@@ -1125,10 +1125,10 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
1125 ssids = this_ssid; 1125 ssids = this_ssid;
1126 } 1126 }
1127 1127
1128 cfg_priv->scan_request = request; 1128 cfg->scan_request = request;
1129 set_bit(WL_STATUS_SCANNING, &cfg_priv->status); 1129 set_bit(WL_STATUS_SCANNING, &cfg->status);
1130 if (escan_req) { 1130 if (escan_req) {
1131 err = brcmf_do_escan(cfg_priv, wiphy, ndev, request); 1131 err = brcmf_do_escan(cfg, wiphy, ndev, request);
1132 if (!err) 1132 if (!err)
1133 return err; 1133 return err;
1134 else 1134 else
@@ -1147,7 +1147,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
1147 } else 1147 } else
1148 WL_SCAN("Broadcast scan\n"); 1148 WL_SCAN("Broadcast scan\n");
1149 1149
1150 passive_scan = cfg_priv->active_scan ? 0 : cpu_to_le32(1); 1150 passive_scan = cfg->active_scan ? 0 : cpu_to_le32(1);
1151 err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_PASSIVE_SCAN, 1151 err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_PASSIVE_SCAN,
1152 &passive_scan, sizeof(passive_scan)); 1152 &passive_scan, sizeof(passive_scan));
1153 if (err) { 1153 if (err) {
@@ -1172,10 +1172,10 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
1172 return 0; 1172 return 0;
1173 1173
1174scan_out: 1174scan_out:
1175 clear_bit(WL_STATUS_SCANNING, &cfg_priv->status); 1175 clear_bit(WL_STATUS_SCANNING, &cfg->status);
1176 if (timer_pending(&cfg_priv->escan_timeout)) 1176 if (timer_pending(&cfg->escan_timeout))
1177 del_timer_sync(&cfg_priv->escan_timeout); 1177 del_timer_sync(&cfg->escan_timeout);
1178 cfg_priv->scan_request = NULL; 1178 cfg->scan_request = NULL;
1179 return err; 1179 return err;
1180} 1180}
1181 1181
@@ -1184,7 +1184,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
1184 struct cfg80211_scan_request *request) 1184 struct cfg80211_scan_request *request)
1185{ 1185{
1186 struct net_device *ndev = request->wdev->netdev; 1186 struct net_device *ndev = request->wdev->netdev;
1187 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); 1187 struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
1188 s32 err = 0; 1188 s32 err = 0;
1189 1189
1190 WL_TRACE("Enter\n"); 1190 WL_TRACE("Enter\n");
@@ -1192,9 +1192,9 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
1192 if (!check_sys_up(wiphy)) 1192 if (!check_sys_up(wiphy))
1193 return -EIO; 1193 return -EIO;
1194 1194
1195 if (cfg_priv->iscan_on) 1195 if (cfg->iscan_on)
1196 err = brcmf_cfg80211_iscan(wiphy, ndev, request, NULL); 1196 err = brcmf_cfg80211_iscan(wiphy, ndev, request, NULL);
1197 else if (cfg_priv->escan_on) 1197 else if (cfg->escan_on)
1198 err = brcmf_cfg80211_escan(wiphy, ndev, request, NULL); 1198 err = brcmf_cfg80211_escan(wiphy, ndev, request, NULL);
1199 1199
1200 if (err) 1200 if (err)
@@ -1241,8 +1241,8 @@ static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
1241 1241
1242static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) 1242static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
1243{ 1243{
1244 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 1244 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1245 struct net_device *ndev = cfg_to_ndev(cfg_priv); 1245 struct net_device *ndev = cfg_to_ndev(cfg);
1246 s32 err = 0; 1246 s32 err = 0;
1247 1247
1248 WL_TRACE("Enter\n"); 1248 WL_TRACE("Enter\n");
@@ -1250,30 +1250,30 @@ static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
1250 return -EIO; 1250 return -EIO;
1251 1251
1252 if (changed & WIPHY_PARAM_RTS_THRESHOLD && 1252 if (changed & WIPHY_PARAM_RTS_THRESHOLD &&
1253 (cfg_priv->conf->rts_threshold != wiphy->rts_threshold)) { 1253 (cfg->conf->rts_threshold != wiphy->rts_threshold)) {
1254 cfg_priv->conf->rts_threshold = wiphy->rts_threshold; 1254 cfg->conf->rts_threshold = wiphy->rts_threshold;
1255 err = brcmf_set_rts(ndev, cfg_priv->conf->rts_threshold); 1255 err = brcmf_set_rts(ndev, cfg->conf->rts_threshold);
1256 if (!err) 1256 if (!err)
1257 goto done; 1257 goto done;
1258 } 1258 }
1259 if (changed & WIPHY_PARAM_FRAG_THRESHOLD && 1259 if (changed & WIPHY_PARAM_FRAG_THRESHOLD &&
1260 (cfg_priv->conf->frag_threshold != wiphy->frag_threshold)) { 1260 (cfg->conf->frag_threshold != wiphy->frag_threshold)) {
1261 cfg_priv->conf->frag_threshold = wiphy->frag_threshold; 1261 cfg->conf->frag_threshold = wiphy->frag_threshold;
1262 err = brcmf_set_frag(ndev, cfg_priv->conf->frag_threshold); 1262 err = brcmf_set_frag(ndev, cfg->conf->frag_threshold);
1263 if (!err) 1263 if (!err)
1264 goto done; 1264 goto done;
1265 } 1265 }
1266 if (changed & WIPHY_PARAM_RETRY_LONG 1266 if (changed & WIPHY_PARAM_RETRY_LONG
1267 && (cfg_priv->conf->retry_long != wiphy->retry_long)) { 1267 && (cfg->conf->retry_long != wiphy->retry_long)) {
1268 cfg_priv->conf->retry_long = wiphy->retry_long; 1268 cfg->conf->retry_long = wiphy->retry_long;
1269 err = brcmf_set_retry(ndev, cfg_priv->conf->retry_long, true); 1269 err = brcmf_set_retry(ndev, cfg->conf->retry_long, true);
1270 if (!err) 1270 if (!err)
1271 goto done; 1271 goto done;
1272 } 1272 }
1273 if (changed & WIPHY_PARAM_RETRY_SHORT 1273 if (changed & WIPHY_PARAM_RETRY_SHORT
1274 && (cfg_priv->conf->retry_short != wiphy->retry_short)) { 1274 && (cfg->conf->retry_short != wiphy->retry_short)) {
1275 cfg_priv->conf->retry_short = wiphy->retry_short; 1275 cfg->conf->retry_short = wiphy->retry_short;
1276 err = brcmf_set_retry(ndev, cfg_priv->conf->retry_short, false); 1276 err = brcmf_set_retry(ndev, cfg->conf->retry_short, false);
1277 if (!err) 1277 if (!err)
1278 goto done; 1278 goto done;
1279 } 1279 }
@@ -1283,22 +1283,22 @@ done:
1283 return err; 1283 return err;
1284} 1284}
1285 1285
1286static void *brcmf_read_prof(struct brcmf_cfg80211_priv *cfg_priv, s32 item) 1286static void *brcmf_read_prof(struct brcmf_cfg80211_info *cfg, s32 item)
1287{ 1287{
1288 switch (item) { 1288 switch (item) {
1289 case WL_PROF_SEC: 1289 case WL_PROF_SEC:
1290 return &cfg_priv->profile->sec; 1290 return &cfg->profile->sec;
1291 case WL_PROF_BSSID: 1291 case WL_PROF_BSSID:
1292 return &cfg_priv->profile->bssid; 1292 return &cfg->profile->bssid;
1293 case WL_PROF_SSID: 1293 case WL_PROF_SSID:
1294 return &cfg_priv->profile->ssid; 1294 return &cfg->profile->ssid;
1295 } 1295 }
1296 WL_ERR("invalid item (%d)\n", item); 1296 WL_ERR("invalid item (%d)\n", item);
1297 return NULL; 1297 return NULL;
1298} 1298}
1299 1299
1300static s32 1300static s32
1301brcmf_update_prof(struct brcmf_cfg80211_priv *cfg_priv, 1301brcmf_update_prof(struct brcmf_cfg80211_info *cfg,
1302 const struct brcmf_event_msg *e, void *data, s32 item) 1302 const struct brcmf_event_msg *e, void *data, s32 item)
1303{ 1303{
1304 s32 err = 0; 1304 s32 err = 0;
@@ -1307,27 +1307,27 @@ brcmf_update_prof(struct brcmf_cfg80211_priv *cfg_priv,
1307 switch (item) { 1307 switch (item) {
1308 case WL_PROF_SSID: 1308 case WL_PROF_SSID:
1309 ssid = (struct brcmf_ssid *) data; 1309 ssid = (struct brcmf_ssid *) data;
1310 memset(cfg_priv->profile->ssid.SSID, 0, 1310 memset(cfg->profile->ssid.SSID, 0,
1311 sizeof(cfg_priv->profile->ssid.SSID)); 1311 sizeof(cfg->profile->ssid.SSID));
1312 memcpy(cfg_priv->profile->ssid.SSID, 1312 memcpy(cfg->profile->ssid.SSID,
1313 ssid->SSID, ssid->SSID_len); 1313 ssid->SSID, ssid->SSID_len);
1314 cfg_priv->profile->ssid.SSID_len = ssid->SSID_len; 1314 cfg->profile->ssid.SSID_len = ssid->SSID_len;
1315 break; 1315 break;
1316 case WL_PROF_BSSID: 1316 case WL_PROF_BSSID:
1317 if (data) 1317 if (data)
1318 memcpy(cfg_priv->profile->bssid, data, ETH_ALEN); 1318 memcpy(cfg->profile->bssid, data, ETH_ALEN);
1319 else 1319 else
1320 memset(cfg_priv->profile->bssid, 0, ETH_ALEN); 1320 memset(cfg->profile->bssid, 0, ETH_ALEN);
1321 break; 1321 break;
1322 case WL_PROF_SEC: 1322 case WL_PROF_SEC:
1323 memcpy(&cfg_priv->profile->sec, data, 1323 memcpy(&cfg->profile->sec, data,
1324 sizeof(cfg_priv->profile->sec)); 1324 sizeof(cfg->profile->sec));
1325 break; 1325 break;
1326 case WL_PROF_BEACONINT: 1326 case WL_PROF_BEACONINT:
1327 cfg_priv->profile->beacon_interval = *(u16 *)data; 1327 cfg->profile->beacon_interval = *(u16 *)data;
1328 break; 1328 break;
1329 case WL_PROF_DTIMPERIOD: 1329 case WL_PROF_DTIMPERIOD:
1330 cfg_priv->profile->dtim_period = *(u8 *)data; 1330 cfg->profile->dtim_period = *(u8 *)data;
1331 break; 1331 break;
1332 default: 1332 default:
1333 WL_ERR("unsupported item (%d)\n", item); 1333 WL_ERR("unsupported item (%d)\n", item);
@@ -1370,20 +1370,20 @@ static void brcmf_ch_to_chanspec(int ch, struct brcmf_join_params *join_params,
1370 } 1370 }
1371} 1371}
1372 1372
1373static void brcmf_link_down(struct brcmf_cfg80211_priv *cfg_priv) 1373static void brcmf_link_down(struct brcmf_cfg80211_info *cfg)
1374{ 1374{
1375 struct net_device *ndev = NULL; 1375 struct net_device *ndev = NULL;
1376 s32 err = 0; 1376 s32 err = 0;
1377 1377
1378 WL_TRACE("Enter\n"); 1378 WL_TRACE("Enter\n");
1379 1379
1380 if (cfg_priv->link_up) { 1380 if (cfg->link_up) {
1381 ndev = cfg_to_ndev(cfg_priv); 1381 ndev = cfg_to_ndev(cfg);
1382 WL_INFO("Call WLC_DISASSOC to stop excess roaming\n "); 1382 WL_INFO("Call WLC_DISASSOC to stop excess roaming\n ");
1383 err = brcmf_exec_dcmd(ndev, BRCMF_C_DISASSOC, NULL, 0); 1383 err = brcmf_exec_dcmd(ndev, BRCMF_C_DISASSOC, NULL, 0);
1384 if (err) 1384 if (err)
1385 WL_ERR("WLC_DISASSOC failed (%d)\n", err); 1385 WL_ERR("WLC_DISASSOC failed (%d)\n", err);
1386 cfg_priv->link_up = false; 1386 cfg->link_up = false;
1387 } 1387 }
1388 WL_TRACE("Exit\n"); 1388 WL_TRACE("Exit\n");
1389} 1389}
@@ -1392,7 +1392,7 @@ static s32
1392brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, 1392brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1393 struct cfg80211_ibss_params *params) 1393 struct cfg80211_ibss_params *params)
1394{ 1394{
1395 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 1395 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1396 struct brcmf_join_params join_params; 1396 struct brcmf_join_params join_params;
1397 size_t join_params_size = 0; 1397 size_t join_params_size = 0;
1398 s32 err = 0; 1398 s32 err = 0;
@@ -1411,7 +1411,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1411 return -EOPNOTSUPP; 1411 return -EOPNOTSUPP;
1412 } 1412 }
1413 1413
1414 set_bit(WL_STATUS_CONNECTING, &cfg_priv->status); 1414 set_bit(WL_STATUS_CONNECTING, &cfg->status);
1415 1415
1416 if (params->bssid) 1416 if (params->bssid)
1417 WL_CONN("BSSID: %pM\n", params->bssid); 1417 WL_CONN("BSSID: %pM\n", params->bssid);
@@ -1479,7 +1479,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1479 memcpy(join_params.ssid_le.SSID, params->ssid, ssid.SSID_len); 1479 memcpy(join_params.ssid_le.SSID, params->ssid, ssid.SSID_len);
1480 join_params.ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len); 1480 join_params.ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len);
1481 join_params_size = sizeof(join_params.ssid_le); 1481 join_params_size = sizeof(join_params.ssid_le);
1482 brcmf_update_prof(cfg_priv, NULL, &ssid, WL_PROF_SSID); 1482 brcmf_update_prof(cfg, NULL, &ssid, WL_PROF_SSID);
1483 1483
1484 /* BSSID */ 1484 /* BSSID */
1485 if (params->bssid) { 1485 if (params->bssid) {
@@ -1490,24 +1490,24 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1490 memcpy(join_params.params_le.bssid, ether_bcast, ETH_ALEN); 1490 memcpy(join_params.params_le.bssid, ether_bcast, ETH_ALEN);
1491 } 1491 }
1492 1492
1493 brcmf_update_prof(cfg_priv, NULL, 1493 brcmf_update_prof(cfg, NULL,
1494 &join_params.params_le.bssid, WL_PROF_BSSID); 1494 &join_params.params_le.bssid, WL_PROF_BSSID);
1495 1495
1496 /* Channel */ 1496 /* Channel */
1497 if (params->channel) { 1497 if (params->channel) {
1498 u32 target_channel; 1498 u32 target_channel;
1499 1499
1500 cfg_priv->channel = 1500 cfg->channel =
1501 ieee80211_frequency_to_channel( 1501 ieee80211_frequency_to_channel(
1502 params->channel->center_freq); 1502 params->channel->center_freq);
1503 if (params->channel_fixed) { 1503 if (params->channel_fixed) {
1504 /* adding chanspec */ 1504 /* adding chanspec */
1505 brcmf_ch_to_chanspec(cfg_priv->channel, 1505 brcmf_ch_to_chanspec(cfg->channel,
1506 &join_params, &join_params_size); 1506 &join_params, &join_params_size);
1507 } 1507 }
1508 1508
1509 /* set channel for starter */ 1509 /* set channel for starter */
1510 target_channel = cfg_priv->channel; 1510 target_channel = cfg->channel;
1511 err = brcmf_exec_dcmd_u32(ndev, BRCM_SET_CHANNEL, 1511 err = brcmf_exec_dcmd_u32(ndev, BRCM_SET_CHANNEL,
1512 &target_channel); 1512 &target_channel);
1513 if (err) { 1513 if (err) {
@@ -1515,9 +1515,9 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1515 goto done; 1515 goto done;
1516 } 1516 }
1517 } else 1517 } else
1518 cfg_priv->channel = 0; 1518 cfg->channel = 0;
1519 1519
1520 cfg_priv->ibss_starter = false; 1520 cfg->ibss_starter = false;
1521 1521
1522 1522
1523 err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_SSID, 1523 err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_SSID,
@@ -1529,7 +1529,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
1529 1529
1530done: 1530done:
1531 if (err) 1531 if (err)
1532 clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status); 1532 clear_bit(WL_STATUS_CONNECTING, &cfg->status);
1533 WL_TRACE("Exit\n"); 1533 WL_TRACE("Exit\n");
1534 return err; 1534 return err;
1535} 1535}
@@ -1537,14 +1537,14 @@ done:
1537static s32 1537static s32
1538brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) 1538brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
1539{ 1539{
1540 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 1540 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1541 s32 err = 0; 1541 s32 err = 0;
1542 1542
1543 WL_TRACE("Enter\n"); 1543 WL_TRACE("Enter\n");
1544 if (!check_sys_up(wiphy)) 1544 if (!check_sys_up(wiphy))
1545 return -EIO; 1545 return -EIO;
1546 1546
1547 brcmf_link_down(cfg_priv); 1547 brcmf_link_down(cfg);
1548 1548
1549 WL_TRACE("Exit\n"); 1549 WL_TRACE("Exit\n");
1550 1550
@@ -1554,7 +1554,7 @@ brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
1554static s32 brcmf_set_wpa_version(struct net_device *ndev, 1554static s32 brcmf_set_wpa_version(struct net_device *ndev,
1555 struct cfg80211_connect_params *sme) 1555 struct cfg80211_connect_params *sme)
1556{ 1556{
1557 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); 1557 struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
1558 struct brcmf_cfg80211_security *sec; 1558 struct brcmf_cfg80211_security *sec;
1559 s32 val = 0; 1559 s32 val = 0;
1560 s32 err = 0; 1560 s32 err = 0;
@@ -1571,7 +1571,7 @@ static s32 brcmf_set_wpa_version(struct net_device *ndev,
1571 WL_ERR("set wpa_auth failed (%d)\n", err); 1571 WL_ERR("set wpa_auth failed (%d)\n", err);
1572 return err; 1572 return err;
1573 } 1573 }
1574 sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); 1574 sec = brcmf_read_prof(cfg, WL_PROF_SEC);
1575 sec->wpa_versions = sme->crypto.wpa_versions; 1575 sec->wpa_versions = sme->crypto.wpa_versions;
1576 return err; 1576 return err;
1577} 1577}
@@ -1579,7 +1579,7 @@ static s32 brcmf_set_wpa_version(struct net_device *ndev,
1579static s32 brcmf_set_auth_type(struct net_device *ndev, 1579static s32 brcmf_set_auth_type(struct net_device *ndev,
1580 struct cfg80211_connect_params *sme) 1580 struct cfg80211_connect_params *sme)
1581{ 1581{
1582 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); 1582 struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
1583 struct brcmf_cfg80211_security *sec; 1583 struct brcmf_cfg80211_security *sec;
1584 s32 val = 0; 1584 s32 val = 0;
1585 s32 err = 0; 1585 s32 err = 0;
@@ -1610,7 +1610,7 @@ static s32 brcmf_set_auth_type(struct net_device *ndev,
1610 WL_ERR("set auth failed (%d)\n", err); 1610 WL_ERR("set auth failed (%d)\n", err);
1611 return err; 1611 return err;
1612 } 1612 }
1613 sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); 1613 sec = brcmf_read_prof(cfg, WL_PROF_SEC);
1614 sec->auth_type = sme->auth_type; 1614 sec->auth_type = sme->auth_type;
1615 return err; 1615 return err;
1616} 1616}
@@ -1619,7 +1619,7 @@ static s32
1619brcmf_set_set_cipher(struct net_device *ndev, 1619brcmf_set_set_cipher(struct net_device *ndev,
1620 struct cfg80211_connect_params *sme) 1620 struct cfg80211_connect_params *sme)
1621{ 1621{
1622 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); 1622 struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
1623 struct brcmf_cfg80211_security *sec; 1623 struct brcmf_cfg80211_security *sec;
1624 s32 pval = 0; 1624 s32 pval = 0;
1625 s32 gval = 0; 1625 s32 gval = 0;
@@ -1675,7 +1675,7 @@ brcmf_set_set_cipher(struct net_device *ndev,
1675 return err; 1675 return err;
1676 } 1676 }
1677 1677
1678 sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); 1678 sec = brcmf_read_prof(cfg, WL_PROF_SEC);
1679 sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0]; 1679 sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0];
1680 sec->cipher_group = sme->crypto.cipher_group; 1680 sec->cipher_group = sme->crypto.cipher_group;
1681 1681
@@ -1685,7 +1685,7 @@ brcmf_set_set_cipher(struct net_device *ndev,
1685static s32 1685static s32
1686brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme) 1686brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
1687{ 1687{
1688 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); 1688 struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
1689 struct brcmf_cfg80211_security *sec; 1689 struct brcmf_cfg80211_security *sec;
1690 s32 val = 0; 1690 s32 val = 0;
1691 s32 err = 0; 1691 s32 err = 0;
@@ -1731,7 +1731,7 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
1731 return err; 1731 return err;
1732 } 1732 }
1733 } 1733 }
1734 sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); 1734 sec = brcmf_read_prof(cfg, WL_PROF_SEC);
1735 sec->wpa_auth = sme->crypto.akm_suites[0]; 1735 sec->wpa_auth = sme->crypto.akm_suites[0];
1736 1736
1737 return err; 1737 return err;
@@ -1741,7 +1741,7 @@ static s32
1741brcmf_set_sharedkey(struct net_device *ndev, 1741brcmf_set_sharedkey(struct net_device *ndev,
1742 struct cfg80211_connect_params *sme) 1742 struct cfg80211_connect_params *sme)
1743{ 1743{
1744 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); 1744 struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
1745 struct brcmf_cfg80211_security *sec; 1745 struct brcmf_cfg80211_security *sec;
1746 struct brcmf_wsec_key key; 1746 struct brcmf_wsec_key key;
1747 s32 val; 1747 s32 val;
@@ -1753,7 +1753,7 @@ brcmf_set_sharedkey(struct net_device *ndev,
1753 if (sme->key_len == 0) 1753 if (sme->key_len == 0)
1754 return 0; 1754 return 0;
1755 1755
1756 sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); 1756 sec = brcmf_read_prof(cfg, WL_PROF_SEC);
1757 WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n", 1757 WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n",
1758 sec->wpa_versions, sec->cipher_pairwise); 1758 sec->wpa_versions, sec->cipher_pairwise);
1759 1759
@@ -1789,8 +1789,8 @@ brcmf_set_sharedkey(struct net_device *ndev,
1789 WL_CONN("key length (%d) key index (%d) algo (%d)\n", 1789 WL_CONN("key length (%d) key index (%d) algo (%d)\n",
1790 key.len, key.index, key.algo); 1790 key.len, key.index, key.algo);
1791 WL_CONN("key \"%s\"\n", key.data); 1791 WL_CONN("key \"%s\"\n", key.data);
1792 bssidx = brcmf_find_bssidx(cfg_priv, ndev); 1792 bssidx = brcmf_find_bssidx(cfg, ndev);
1793 err = send_key_to_dongle(cfg_priv, bssidx, ndev, &key); 1793 err = send_key_to_dongle(cfg, bssidx, ndev, &key);
1794 if (err) 1794 if (err)
1795 return err; 1795 return err;
1796 1796
@@ -1808,7 +1808,7 @@ static s32
1808brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, 1808brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1809 struct cfg80211_connect_params *sme) 1809 struct cfg80211_connect_params *sme)
1810{ 1810{
1811 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 1811 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1812 struct ieee80211_channel *chan = sme->channel; 1812 struct ieee80211_channel *chan = sme->channel;
1813 struct brcmf_join_params join_params; 1813 struct brcmf_join_params join_params;
1814 size_t join_params_size; 1814 size_t join_params_size;
@@ -1825,15 +1825,15 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1825 return -EOPNOTSUPP; 1825 return -EOPNOTSUPP;
1826 } 1826 }
1827 1827
1828 set_bit(WL_STATUS_CONNECTING, &cfg_priv->status); 1828 set_bit(WL_STATUS_CONNECTING, &cfg->status);
1829 1829
1830 if (chan) { 1830 if (chan) {
1831 cfg_priv->channel = 1831 cfg->channel =
1832 ieee80211_frequency_to_channel(chan->center_freq); 1832 ieee80211_frequency_to_channel(chan->center_freq);
1833 WL_CONN("channel (%d), center_req (%d)\n", 1833 WL_CONN("channel (%d), center_req (%d)\n",
1834 cfg_priv->channel, chan->center_freq); 1834 cfg->channel, chan->center_freq);
1835 } else 1835 } else
1836 cfg_priv->channel = 0; 1836 cfg->channel = 0;
1837 1837
1838 WL_INFO("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len); 1838 WL_INFO("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len);
1839 1839
@@ -1874,7 +1874,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1874 memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid.SSID_len); 1874 memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid.SSID_len);
1875 memcpy(&ssid.SSID, sme->ssid, ssid.SSID_len); 1875 memcpy(&ssid.SSID, sme->ssid, ssid.SSID_len);
1876 join_params.ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len); 1876 join_params.ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len);
1877 brcmf_update_prof(cfg_priv, NULL, &ssid, WL_PROF_SSID); 1877 brcmf_update_prof(cfg, NULL, &ssid, WL_PROF_SSID);
1878 1878
1879 memcpy(join_params.params_le.bssid, ether_bcast, ETH_ALEN); 1879 memcpy(join_params.params_le.bssid, ether_bcast, ETH_ALEN);
1880 1880
@@ -1882,7 +1882,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1882 WL_CONN("ssid \"%s\", len (%d)\n", 1882 WL_CONN("ssid \"%s\", len (%d)\n",
1883 ssid.SSID, ssid.SSID_len); 1883 ssid.SSID, ssid.SSID_len);
1884 1884
1885 brcmf_ch_to_chanspec(cfg_priv->channel, 1885 brcmf_ch_to_chanspec(cfg->channel,
1886 &join_params, &join_params_size); 1886 &join_params, &join_params_size);
1887 err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_SSID, 1887 err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_SSID,
1888 &join_params, join_params_size); 1888 &join_params, join_params_size);
@@ -1891,7 +1891,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
1891 1891
1892done: 1892done:
1893 if (err) 1893 if (err)
1894 clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status); 1894 clear_bit(WL_STATUS_CONNECTING, &cfg->status);
1895 WL_TRACE("Exit\n"); 1895 WL_TRACE("Exit\n");
1896 return err; 1896 return err;
1897} 1897}
@@ -1900,7 +1900,7 @@ static s32
1900brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev, 1900brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
1901 u16 reason_code) 1901 u16 reason_code)
1902{ 1902{
1903 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 1903 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1904 struct brcmf_scb_val_le scbval; 1904 struct brcmf_scb_val_le scbval;
1905 s32 err = 0; 1905 s32 err = 0;
1906 1906
@@ -1908,16 +1908,16 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
1908 if (!check_sys_up(wiphy)) 1908 if (!check_sys_up(wiphy))
1909 return -EIO; 1909 return -EIO;
1910 1910
1911 clear_bit(WL_STATUS_CONNECTED, &cfg_priv->status); 1911 clear_bit(WL_STATUS_CONNECTED, &cfg->status);
1912 1912
1913 memcpy(&scbval.ea, brcmf_read_prof(cfg_priv, WL_PROF_BSSID), ETH_ALEN); 1913 memcpy(&scbval.ea, brcmf_read_prof(cfg, WL_PROF_BSSID), ETH_ALEN);
1914 scbval.val = cpu_to_le32(reason_code); 1914 scbval.val = cpu_to_le32(reason_code);
1915 err = brcmf_exec_dcmd(ndev, BRCMF_C_DISASSOC, &scbval, 1915 err = brcmf_exec_dcmd(ndev, BRCMF_C_DISASSOC, &scbval,
1916 sizeof(struct brcmf_scb_val_le)); 1916 sizeof(struct brcmf_scb_val_le));
1917 if (err) 1917 if (err)
1918 WL_ERR("error (%d)\n", err); 1918 WL_ERR("error (%d)\n", err);
1919 1919
1920 cfg_priv->link_up = false; 1920 cfg->link_up = false;
1921 1921
1922 WL_TRACE("Exit\n"); 1922 WL_TRACE("Exit\n");
1923 return err; 1923 return err;
@@ -1928,8 +1928,8 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy,
1928 enum nl80211_tx_power_setting type, s32 mbm) 1928 enum nl80211_tx_power_setting type, s32 mbm)
1929{ 1929{
1930 1930
1931 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 1931 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1932 struct net_device *ndev = cfg_to_ndev(cfg_priv); 1932 struct net_device *ndev = cfg_to_ndev(cfg);
1933 u16 txpwrmw; 1933 u16 txpwrmw;
1934 s32 err = 0; 1934 s32 err = 0;
1935 s32 disable = 0; 1935 s32 disable = 0;
@@ -1965,7 +1965,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy,
1965 (s32) (brcmf_mw_to_qdbm(txpwrmw))); 1965 (s32) (brcmf_mw_to_qdbm(txpwrmw)));
1966 if (err) 1966 if (err)
1967 WL_ERR("qtxpower error (%d)\n", err); 1967 WL_ERR("qtxpower error (%d)\n", err);
1968 cfg_priv->conf->tx_power = dbm; 1968 cfg->conf->tx_power = dbm;
1969 1969
1970done: 1970done:
1971 WL_TRACE("Exit\n"); 1971 WL_TRACE("Exit\n");
@@ -1974,8 +1974,8 @@ done:
1974 1974
1975static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm) 1975static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
1976{ 1976{
1977 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 1977 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
1978 struct net_device *ndev = cfg_to_ndev(cfg_priv); 1978 struct net_device *ndev = cfg_to_ndev(cfg);
1979 s32 txpwrdbm; 1979 s32 txpwrdbm;
1980 u8 result; 1980 u8 result;
1981 s32 err = 0; 1981 s32 err = 0;
@@ -2002,7 +2002,7 @@ static s32
2002brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev, 2002brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
2003 u8 key_idx, bool unicast, bool multicast) 2003 u8 key_idx, bool unicast, bool multicast)
2004{ 2004{
2005 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 2005 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2006 u32 index; 2006 u32 index;
2007 u32 wsec; 2007 u32 wsec;
2008 s32 err = 0; 2008 s32 err = 0;
@@ -2013,7 +2013,7 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
2013 if (!check_sys_up(wiphy)) 2013 if (!check_sys_up(wiphy))
2014 return -EIO; 2014 return -EIO;
2015 2015
2016 bssidx = brcmf_find_bssidx(cfg_priv, ndev); 2016 bssidx = brcmf_find_bssidx(cfg, ndev);
2017 err = brcmf_dev_intvar_get_bsscfg(ndev, "wsec", &wsec, bssidx); 2017 err = brcmf_dev_intvar_get_bsscfg(ndev, "wsec", &wsec, bssidx);
2018 if (err) { 2018 if (err) {
2019 WL_ERR("WLC_GET_WSEC error (%d)\n", err); 2019 WL_ERR("WLC_GET_WSEC error (%d)\n", err);
@@ -2037,7 +2037,7 @@ static s32
2037brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, 2037brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
2038 u8 key_idx, const u8 *mac_addr, struct key_params *params) 2038 u8 key_idx, const u8 *mac_addr, struct key_params *params)
2039{ 2039{
2040 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 2040 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2041 struct brcmf_wsec_key key; 2041 struct brcmf_wsec_key key;
2042 struct brcmf_wsec_key_le key_le; 2042 struct brcmf_wsec_key_le key_le;
2043 s32 err = 0; 2043 s32 err = 0;
@@ -2050,11 +2050,11 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
2050 if (!is_multicast_ether_addr(mac_addr)) 2050 if (!is_multicast_ether_addr(mac_addr))
2051 memcpy((char *)&key.ea, (void *)mac_addr, ETH_ALEN); 2051 memcpy((char *)&key.ea, (void *)mac_addr, ETH_ALEN);
2052 key.len = (u32) params->key_len; 2052 key.len = (u32) params->key_len;
2053 bssidx = brcmf_find_bssidx(cfg_priv, ndev); 2053 bssidx = brcmf_find_bssidx(cfg, ndev);
2054 /* check for key index change */ 2054 /* check for key index change */
2055 if (key.len == 0) { 2055 if (key.len == 0) {
2056 /* key delete */ 2056 /* key delete */
2057 err = send_key_to_dongle(cfg_priv, bssidx, ndev, &key); 2057 err = send_key_to_dongle(cfg, bssidx, ndev, &key);
2058 if (err) 2058 if (err)
2059 WL_ERR("key delete error (%d)\n", err); 2059 WL_ERR("key delete error (%d)\n", err);
2060 } else { 2060 } else {
@@ -2114,7 +2114,7 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
2114 brcmf_netdev_wait_pend8021x(ndev); 2114 brcmf_netdev_wait_pend8021x(ndev);
2115 err = brcmf_dev_iovar_setbuf_bsscfg(ndev, "wsec_key", &key_le, 2115 err = brcmf_dev_iovar_setbuf_bsscfg(ndev, "wsec_key", &key_le,
2116 sizeof(key_le), 2116 sizeof(key_le),
2117 cfg_priv->extra_buf, 2117 cfg->extra_buf,
2118 WL_EXTRA_BUF_MAX, bssidx); 2118 WL_EXTRA_BUF_MAX, bssidx);
2119 if (err) 2119 if (err)
2120 WL_ERR("wsec_key error (%d)\n", err); 2120 WL_ERR("wsec_key error (%d)\n", err);
@@ -2127,7 +2127,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
2127 u8 key_idx, bool pairwise, const u8 *mac_addr, 2127 u8 key_idx, bool pairwise, const u8 *mac_addr,
2128 struct key_params *params) 2128 struct key_params *params)
2129{ 2129{
2130 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 2130 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2131 struct brcmf_wsec_key key; 2131 struct brcmf_wsec_key key;
2132 s32 val; 2132 s32 val;
2133 s32 wsec; 2133 s32 wsec;
@@ -2169,7 +2169,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
2169 WL_CONN("WLAN_CIPHER_SUITE_WEP104\n"); 2169 WL_CONN("WLAN_CIPHER_SUITE_WEP104\n");
2170 break; 2170 break;
2171 case WLAN_CIPHER_SUITE_TKIP: 2171 case WLAN_CIPHER_SUITE_TKIP:
2172 if (cfg_priv->conf->mode != WL_MODE_AP) { 2172 if (cfg->conf->mode != WL_MODE_AP) {
2173 WL_CONN("Swapping key\n"); 2173 WL_CONN("Swapping key\n");
2174 memcpy(keybuf, &key.data[24], sizeof(keybuf)); 2174 memcpy(keybuf, &key.data[24], sizeof(keybuf));
2175 memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); 2175 memcpy(&key.data[24], &key.data[16], sizeof(keybuf));
@@ -2195,8 +2195,8 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
2195 goto done; 2195 goto done;
2196 } 2196 }
2197 2197
2198 bssidx = brcmf_find_bssidx(cfg_priv, ndev); 2198 bssidx = brcmf_find_bssidx(cfg, ndev);
2199 err = send_key_to_dongle(cfg_priv, bssidx, ndev, &key); 2199 err = send_key_to_dongle(cfg, bssidx, ndev, &key);
2200 if (err) 2200 if (err)
2201 goto done; 2201 goto done;
2202 2202
@@ -2221,7 +2221,7 @@ static s32
2221brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, 2221brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
2222 u8 key_idx, bool pairwise, const u8 *mac_addr) 2222 u8 key_idx, bool pairwise, const u8 *mac_addr)
2223{ 2223{
2224 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 2224 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2225 struct brcmf_wsec_key key; 2225 struct brcmf_wsec_key key;
2226 s32 err = 0; 2226 s32 err = 0;
2227 s32 bssidx; 2227 s32 bssidx;
@@ -2239,8 +2239,8 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
2239 WL_CONN("key index (%d)\n", key_idx); 2239 WL_CONN("key index (%d)\n", key_idx);
2240 2240
2241 /* Set the new key/index */ 2241 /* Set the new key/index */
2242 bssidx = brcmf_find_bssidx(cfg_priv, ndev); 2242 bssidx = brcmf_find_bssidx(cfg, ndev);
2243 err = send_key_to_dongle(cfg_priv, bssidx, ndev, &key); 2243 err = send_key_to_dongle(cfg, bssidx, ndev, &key);
2244 if (err) { 2244 if (err) {
2245 if (err == -EINVAL) { 2245 if (err == -EINVAL) {
2246 if (key.index >= DOT11_MAX_DEFAULT_KEYS) 2246 if (key.index >= DOT11_MAX_DEFAULT_KEYS)
@@ -2261,7 +2261,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
2261 void (*callback) (void *cookie, struct key_params * params)) 2261 void (*callback) (void *cookie, struct key_params * params))
2262{ 2262{
2263 struct key_params params; 2263 struct key_params params;
2264 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 2264 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2265 struct brcmf_cfg80211_security *sec; 2265 struct brcmf_cfg80211_security *sec;
2266 s32 wsec; 2266 s32 wsec;
2267 s32 err = 0; 2267 s32 err = 0;
@@ -2274,7 +2274,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
2274 2274
2275 memset(&params, 0, sizeof(params)); 2275 memset(&params, 0, sizeof(params));
2276 2276
2277 bssidx = brcmf_find_bssidx(cfg_priv, ndev); 2277 bssidx = brcmf_find_bssidx(cfg, ndev);
2278 err = brcmf_dev_intvar_get_bsscfg(ndev, "wsec", &wsec, bssidx); 2278 err = brcmf_dev_intvar_get_bsscfg(ndev, "wsec", &wsec, bssidx);
2279 if (err) { 2279 if (err) {
2280 WL_ERR("WLC_GET_WSEC error (%d)\n", err); 2280 WL_ERR("WLC_GET_WSEC error (%d)\n", err);
@@ -2284,7 +2284,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
2284 } 2284 }
2285 switch (wsec & ~SES_OW_ENABLED) { 2285 switch (wsec & ~SES_OW_ENABLED) {
2286 case WEP_ENABLED: 2286 case WEP_ENABLED:
2287 sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); 2287 sec = brcmf_read_prof(cfg, WL_PROF_SEC);
2288 if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { 2288 if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) {
2289 params.cipher = WLAN_CIPHER_SUITE_WEP40; 2289 params.cipher = WLAN_CIPHER_SUITE_WEP40;
2290 WL_CONN("WLAN_CIPHER_SUITE_WEP40\n"); 2290 WL_CONN("WLAN_CIPHER_SUITE_WEP40\n");
@@ -2326,27 +2326,27 @@ static s32
2326brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, 2326brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
2327 u8 *mac, struct station_info *sinfo) 2327 u8 *mac, struct station_info *sinfo)
2328{ 2328{
2329 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 2329 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2330 struct brcmf_scb_val_le scb_val; 2330 struct brcmf_scb_val_le scb_val;
2331 int rssi; 2331 int rssi;
2332 s32 rate; 2332 s32 rate;
2333 s32 err = 0; 2333 s32 err = 0;
2334 u8 *bssid = brcmf_read_prof(cfg_priv, WL_PROF_BSSID); 2334 u8 *bssid = brcmf_read_prof(cfg, WL_PROF_BSSID);
2335 struct brcmf_sta_info_le *sta_info_le; 2335 struct brcmf_sta_info_le *sta_info_le;
2336 2336
2337 WL_TRACE("Enter, MAC %pM\n", mac); 2337 WL_TRACE("Enter, MAC %pM\n", mac);
2338 if (!check_sys_up(wiphy)) 2338 if (!check_sys_up(wiphy))
2339 return -EIO; 2339 return -EIO;
2340 2340
2341 if (cfg_priv->conf->mode == WL_MODE_AP) { 2341 if (cfg->conf->mode == WL_MODE_AP) {
2342 err = brcmf_dev_iovar_getbuf(ndev, "sta_info", mac, ETH_ALEN, 2342 err = brcmf_dev_iovar_getbuf(ndev, "sta_info", mac, ETH_ALEN,
2343 cfg_priv->dcmd_buf, 2343 cfg->dcmd_buf,
2344 WL_DCMD_LEN_MAX); 2344 WL_DCMD_LEN_MAX);
2345 if (err < 0) { 2345 if (err < 0) {
2346 WL_ERR("GET STA INFO failed, %d\n", err); 2346 WL_ERR("GET STA INFO failed, %d\n", err);
2347 goto done; 2347 goto done;
2348 } 2348 }
2349 sta_info_le = (struct brcmf_sta_info_le *)cfg_priv->dcmd_buf; 2349 sta_info_le = (struct brcmf_sta_info_le *)cfg->dcmd_buf;
2350 2350
2351 sinfo->filled = STATION_INFO_INACTIVE_TIME; 2351 sinfo->filled = STATION_INFO_INACTIVE_TIME;
2352 sinfo->inactive_time = le32_to_cpu(sta_info_le->idle) * 1000; 2352 sinfo->inactive_time = le32_to_cpu(sta_info_le->idle) * 1000;
@@ -2356,7 +2356,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
2356 } 2356 }
2357 WL_TRACE("STA idle time : %d ms, connected time :%d sec\n", 2357 WL_TRACE("STA idle time : %d ms, connected time :%d sec\n",
2358 sinfo->inactive_time, sinfo->connected_time); 2358 sinfo->inactive_time, sinfo->connected_time);
2359 } else if (cfg_priv->conf->mode == WL_MODE_BSS) { 2359 } else if (cfg->conf->mode == WL_MODE_BSS) {
2360 if (memcmp(mac, bssid, ETH_ALEN)) { 2360 if (memcmp(mac, bssid, ETH_ALEN)) {
2361 WL_ERR("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n", 2361 WL_ERR("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n",
2362 mac, bssid); 2362 mac, bssid);
@@ -2374,7 +2374,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
2374 WL_CONN("Rate %d Mbps\n", rate / 2); 2374 WL_CONN("Rate %d Mbps\n", rate / 2);
2375 } 2375 }
2376 2376
2377 if (test_bit(WL_STATUS_CONNECTED, &cfg_priv->status)) { 2377 if (test_bit(WL_STATUS_CONNECTED, &cfg->status)) {
2378 memset(&scb_val, 0, sizeof(scb_val)); 2378 memset(&scb_val, 0, sizeof(scb_val));
2379 err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_RSSI, &scb_val, 2379 err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_RSSI, &scb_val,
2380 sizeof(scb_val)); 2380 sizeof(scb_val));
@@ -2401,7 +2401,7 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
2401{ 2401{
2402 s32 pm; 2402 s32 pm;
2403 s32 err = 0; 2403 s32 err = 0;
2404 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 2404 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
2405 2405
2406 WL_TRACE("Enter\n"); 2406 WL_TRACE("Enter\n");
2407 2407
@@ -2409,14 +2409,13 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
2409 * Powersave enable/disable request is coming from the 2409 * Powersave enable/disable request is coming from the
2410 * cfg80211 even before the interface is up. In that 2410 * cfg80211 even before the interface is up. In that
2411 * scenario, driver will be storing the power save 2411 * scenario, driver will be storing the power save
2412 * preference in cfg_priv struct to apply this to 2412 * preference in cfg struct to apply this to
2413 * FW later while initializing the dongle 2413 * FW later while initializing the dongle
2414 */ 2414 */
2415 cfg_priv->pwr_save = enabled; 2415 cfg->pwr_save = enabled;
2416 if (!test_bit(WL_STATUS_READY, &cfg_priv->status)) { 2416 if (!test_bit(WL_STATUS_READY, &cfg->status)) {
2417 2417
2418 WL_INFO("Device is not ready," 2418 WL_INFO("Device is not ready, storing the value in cfg_info struct\n");
2419 "storing the value in cfg_priv struct\n");
2420 goto done; 2419 goto done;
2421 } 2420 }
2422 2421
@@ -2494,10 +2493,10 @@ done:
2494 return err; 2493 return err;
2495} 2494}
2496 2495
2497static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_priv *cfg_priv, 2496static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
2498 struct brcmf_bss_info_le *bi) 2497 struct brcmf_bss_info_le *bi)
2499{ 2498{
2500 struct wiphy *wiphy = cfg_to_wiphy(cfg_priv); 2499 struct wiphy *wiphy = cfg_to_wiphy(cfg);
2501 struct ieee80211_channel *notify_channel; 2500 struct ieee80211_channel *notify_channel;
2502 struct cfg80211_bss *bss; 2501 struct cfg80211_bss *bss;
2503 struct ieee80211_supported_band *band; 2502 struct ieee80211_supported_band *band;
@@ -2561,14 +2560,14 @@ next_bss_le(struct brcmf_scan_results *list, struct brcmf_bss_info_le *bss)
2561 le32_to_cpu(bss->length)); 2560 le32_to_cpu(bss->length));
2562} 2561}
2563 2562
2564static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv) 2563static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
2565{ 2564{
2566 struct brcmf_scan_results *bss_list; 2565 struct brcmf_scan_results *bss_list;
2567 struct brcmf_bss_info_le *bi = NULL; /* must be initialized */ 2566 struct brcmf_bss_info_le *bi = NULL; /* must be initialized */
2568 s32 err = 0; 2567 s32 err = 0;
2569 int i; 2568 int i;
2570 2569
2571 bss_list = cfg_priv->bss_list; 2570 bss_list = cfg->bss_list;
2572 if (bss_list->version != BRCMF_BSS_INFO_VERSION) { 2571 if (bss_list->version != BRCMF_BSS_INFO_VERSION) {
2573 WL_ERR("Version %d != WL_BSS_INFO_VERSION\n", 2572 WL_ERR("Version %d != WL_BSS_INFO_VERSION\n",
2574 bss_list->version); 2573 bss_list->version);
@@ -2577,17 +2576,17 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv)
2577 WL_SCAN("scanned AP count (%d)\n", bss_list->count); 2576 WL_SCAN("scanned AP count (%d)\n", bss_list->count);
2578 for (i = 0; i < bss_list->count && i < WL_AP_MAX; i++) { 2577 for (i = 0; i < bss_list->count && i < WL_AP_MAX; i++) {
2579 bi = next_bss_le(bss_list, bi); 2578 bi = next_bss_le(bss_list, bi);
2580 err = brcmf_inform_single_bss(cfg_priv, bi); 2579 err = brcmf_inform_single_bss(cfg, bi);
2581 if (err) 2580 if (err)
2582 break; 2581 break;
2583 } 2582 }
2584 return err; 2583 return err;
2585} 2584}
2586 2585
2587static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv, 2586static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg,
2588 struct net_device *ndev, const u8 *bssid) 2587 struct net_device *ndev, const u8 *bssid)
2589{ 2588{
2590 struct wiphy *wiphy = cfg_to_wiphy(cfg_priv); 2589 struct wiphy *wiphy = cfg_to_wiphy(cfg);
2591 struct ieee80211_channel *notify_channel; 2590 struct ieee80211_channel *notify_channel;
2592 struct brcmf_bss_info_le *bi = NULL; 2591 struct brcmf_bss_info_le *bi = NULL;
2593 struct ieee80211_supported_band *band; 2592 struct ieee80211_supported_band *band;
@@ -2662,9 +2661,9 @@ CleanUp:
2662 return err; 2661 return err;
2663} 2662}
2664 2663
2665static bool brcmf_is_ibssmode(struct brcmf_cfg80211_priv *cfg_priv) 2664static bool brcmf_is_ibssmode(struct brcmf_cfg80211_info *cfg)
2666{ 2665{
2667 return cfg_priv->conf->mode == WL_MODE_IBSS; 2666 return cfg->conf->mode == WL_MODE_IBSS;
2668} 2667}
2669 2668
2670/* 2669/*
@@ -2734,7 +2733,7 @@ brcmf_find_wpaie(u8 *parse, u32 len)
2734 return NULL; 2733 return NULL;
2735} 2734}
2736 2735
2737static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv) 2736static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg)
2738{ 2737{
2739 struct brcmf_bss_info_le *bi; 2738 struct brcmf_bss_info_le *bi;
2740 struct brcmf_ssid *ssid; 2739 struct brcmf_ssid *ssid;
@@ -2746,21 +2745,21 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv)
2746 s32 err = 0; 2745 s32 err = 0;
2747 2746
2748 WL_TRACE("Enter\n"); 2747 WL_TRACE("Enter\n");
2749 if (brcmf_is_ibssmode(cfg_priv)) 2748 if (brcmf_is_ibssmode(cfg))
2750 return err; 2749 return err;
2751 2750
2752 ssid = (struct brcmf_ssid *)brcmf_read_prof(cfg_priv, WL_PROF_SSID); 2751 ssid = (struct brcmf_ssid *)brcmf_read_prof(cfg, WL_PROF_SSID);
2753 2752
2754 *(__le32 *)cfg_priv->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX); 2753 *(__le32 *)cfg->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
2755 err = brcmf_exec_dcmd(cfg_to_ndev(cfg_priv), BRCMF_C_GET_BSS_INFO, 2754 err = brcmf_exec_dcmd(cfg_to_ndev(cfg), BRCMF_C_GET_BSS_INFO,
2756 cfg_priv->extra_buf, WL_EXTRA_BUF_MAX); 2755 cfg->extra_buf, WL_EXTRA_BUF_MAX);
2757 if (err) { 2756 if (err) {
2758 WL_ERR("Could not get bss info %d\n", err); 2757 WL_ERR("Could not get bss info %d\n", err);
2759 goto update_bss_info_out; 2758 goto update_bss_info_out;
2760 } 2759 }
2761 2760
2762 bi = (struct brcmf_bss_info_le *)(cfg_priv->extra_buf + 4); 2761 bi = (struct brcmf_bss_info_le *)(cfg->extra_buf + 4);
2763 err = brcmf_inform_single_bss(cfg_priv, bi); 2762 err = brcmf_inform_single_bss(cfg, bi);
2764 if (err) 2763 if (err)
2765 goto update_bss_info_out; 2764 goto update_bss_info_out;
2766 2765
@@ -2778,7 +2777,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv)
2778 * so we speficially query dtim information to dongle. 2777 * so we speficially query dtim information to dongle.
2779 */ 2778 */
2780 u32 var; 2779 u32 var;
2781 err = brcmf_dev_intvar_get(cfg_to_ndev(cfg_priv), 2780 err = brcmf_dev_intvar_get(cfg_to_ndev(cfg),
2782 "dtim_assoc", &var); 2781 "dtim_assoc", &var);
2783 if (err) { 2782 if (err) {
2784 WL_ERR("wl dtim_assoc failed (%d)\n", err); 2783 WL_ERR("wl dtim_assoc failed (%d)\n", err);
@@ -2787,22 +2786,22 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv)
2787 dtim_period = (u8)var; 2786 dtim_period = (u8)var;
2788 } 2787 }
2789 2788
2790 brcmf_update_prof(cfg_priv, NULL, &beacon_interval, WL_PROF_BEACONINT); 2789 brcmf_update_prof(cfg, NULL, &beacon_interval, WL_PROF_BEACONINT);
2791 brcmf_update_prof(cfg_priv, NULL, &dtim_period, WL_PROF_DTIMPERIOD); 2790 brcmf_update_prof(cfg, NULL, &dtim_period, WL_PROF_DTIMPERIOD);
2792 2791
2793update_bss_info_out: 2792update_bss_info_out:
2794 WL_TRACE("Exit"); 2793 WL_TRACE("Exit");
2795 return err; 2794 return err;
2796} 2795}
2797 2796
2798static void brcmf_abort_scanning(struct brcmf_cfg80211_priv *cfg_priv) 2797static void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg)
2799{ 2798{
2800 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg_priv); 2799 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg);
2801 struct escan_info *escan = &cfg_priv->escan_info; 2800 struct escan_info *escan = &cfg->escan_info;
2802 struct brcmf_ssid ssid; 2801 struct brcmf_ssid ssid;
2803 2802
2804 set_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status); 2803 set_bit(WL_STATUS_SCAN_ABORTING, &cfg->status);
2805 if (cfg_priv->iscan_on) { 2804 if (cfg->iscan_on) {
2806 iscan->state = WL_ISCAN_STATE_IDLE; 2805 iscan->state = WL_ISCAN_STATE_IDLE;
2807 2806
2808 if (iscan->timer_on) { 2807 if (iscan->timer_on) {
@@ -2816,39 +2815,39 @@ static void brcmf_abort_scanning(struct brcmf_cfg80211_priv *cfg_priv)
2816 memset(&ssid, 0, sizeof(ssid)); 2815 memset(&ssid, 0, sizeof(ssid));
2817 brcmf_run_iscan(iscan, &ssid, WL_SCAN_ACTION_ABORT); 2816 brcmf_run_iscan(iscan, &ssid, WL_SCAN_ACTION_ABORT);
2818 2817
2819 if (cfg_priv->scan_request) { 2818 if (cfg->scan_request) {
2820 /* Indidate scan abort to cfg80211 layer */ 2819 /* Indidate scan abort to cfg80211 layer */
2821 WL_INFO("Terminating scan in progress\n"); 2820 WL_INFO("Terminating scan in progress\n");
2822 cfg80211_scan_done(cfg_priv->scan_request, true); 2821 cfg80211_scan_done(cfg->scan_request, true);
2823 cfg_priv->scan_request = NULL; 2822 cfg->scan_request = NULL;
2824 } 2823 }
2825 } 2824 }
2826 if (cfg_priv->escan_on && cfg_priv->scan_request) { 2825 if (cfg->escan_on && cfg->scan_request) {
2827 escan->escan_state = WL_ESCAN_STATE_IDLE; 2826 escan->escan_state = WL_ESCAN_STATE_IDLE;
2828 brcmf_notify_escan_complete(cfg_priv, escan->ndev, true, true); 2827 brcmf_notify_escan_complete(cfg, escan->ndev, true, true);
2829 } 2828 }
2830 clear_bit(WL_STATUS_SCANNING, &cfg_priv->status); 2829 clear_bit(WL_STATUS_SCANNING, &cfg->status);
2831 clear_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status); 2830 clear_bit(WL_STATUS_SCAN_ABORTING, &cfg->status);
2832} 2831}
2833 2832
2834static void brcmf_notify_iscan_complete(struct brcmf_cfg80211_iscan_ctrl *iscan, 2833static void brcmf_notify_iscan_complete(struct brcmf_cfg80211_iscan_ctrl *iscan,
2835 bool aborted) 2834 bool aborted)
2836{ 2835{
2837 struct brcmf_cfg80211_priv *cfg_priv = iscan_to_cfg(iscan); 2836 struct brcmf_cfg80211_info *cfg = iscan_to_cfg(iscan);
2838 struct net_device *ndev = cfg_to_ndev(cfg_priv); 2837 struct net_device *ndev = cfg_to_ndev(cfg);
2839 2838
2840 if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { 2839 if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg->status)) {
2841 WL_ERR("Scan complete while device not scanning\n"); 2840 WL_ERR("Scan complete while device not scanning\n");
2842 return; 2841 return;
2843 } 2842 }
2844 if (cfg_priv->scan_request) { 2843 if (cfg->scan_request) {
2845 WL_SCAN("ISCAN Completed scan: %s\n", 2844 WL_SCAN("ISCAN Completed scan: %s\n",
2846 aborted ? "Aborted" : "Done"); 2845 aborted ? "Aborted" : "Done");
2847 cfg80211_scan_done(cfg_priv->scan_request, aborted); 2846 cfg80211_scan_done(cfg->scan_request, aborted);
2848 brcmf_set_mpc(ndev, 1); 2847 brcmf_set_mpc(ndev, 1);
2849 cfg_priv->scan_request = NULL; 2848 cfg->scan_request = NULL;
2850 } 2849 }
2851 cfg_priv->iscan_kickstart = false; 2850 cfg->iscan_kickstart = false;
2852} 2851}
2853 2852
2854static s32 brcmf_wakeup_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan) 2853static s32 brcmf_wakeup_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan)
@@ -2901,21 +2900,21 @@ brcmf_get_iscan_results(struct brcmf_cfg80211_iscan_ctrl *iscan, u32 *status,
2901 return err; 2900 return err;
2902} 2901}
2903 2902
2904static s32 brcmf_iscan_done(struct brcmf_cfg80211_priv *cfg_priv) 2903static s32 brcmf_iscan_done(struct brcmf_cfg80211_info *cfg)
2905{ 2904{
2906 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; 2905 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg->iscan;
2907 s32 err = 0; 2906 s32 err = 0;
2908 2907
2909 iscan->state = WL_ISCAN_STATE_IDLE; 2908 iscan->state = WL_ISCAN_STATE_IDLE;
2910 brcmf_inform_bss(cfg_priv); 2909 brcmf_inform_bss(cfg);
2911 brcmf_notify_iscan_complete(iscan, false); 2910 brcmf_notify_iscan_complete(iscan, false);
2912 2911
2913 return err; 2912 return err;
2914} 2913}
2915 2914
2916static s32 brcmf_iscan_pending(struct brcmf_cfg80211_priv *cfg_priv) 2915static s32 brcmf_iscan_pending(struct brcmf_cfg80211_info *cfg)
2917{ 2916{
2918 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; 2917 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg->iscan;
2919 s32 err = 0; 2918 s32 err = 0;
2920 2919
2921 /* Reschedule the timer */ 2920 /* Reschedule the timer */
@@ -2925,12 +2924,12 @@ static s32 brcmf_iscan_pending(struct brcmf_cfg80211_priv *cfg_priv)
2925 return err; 2924 return err;
2926} 2925}
2927 2926
2928static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv) 2927static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_info *cfg)
2929{ 2928{
2930 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; 2929 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg->iscan;
2931 s32 err = 0; 2930 s32 err = 0;
2932 2931
2933 brcmf_inform_bss(cfg_priv); 2932 brcmf_inform_bss(cfg);
2934 brcmf_run_iscan(iscan, NULL, BRCMF_SCAN_ACTION_CONTINUE); 2933 brcmf_run_iscan(iscan, NULL, BRCMF_SCAN_ACTION_CONTINUE);
2935 /* Reschedule the timer */ 2934 /* Reschedule the timer */
2936 mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000); 2935 mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000);
@@ -2939,9 +2938,9 @@ static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv)
2939 return err; 2938 return err;
2940} 2939}
2941 2940
2942static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_priv *cfg_priv) 2941static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_info *cfg)
2943{ 2942{
2944 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; 2943 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg->iscan;
2945 s32 err = 0; 2944 s32 err = 0;
2946 2945
2947 iscan->state = WL_ISCAN_STATE_IDLE; 2946 iscan->state = WL_ISCAN_STATE_IDLE;
@@ -2955,7 +2954,7 @@ static void brcmf_cfg80211_iscan_handler(struct work_struct *work)
2955 struct brcmf_cfg80211_iscan_ctrl *iscan = 2954 struct brcmf_cfg80211_iscan_ctrl *iscan =
2956 container_of(work, struct brcmf_cfg80211_iscan_ctrl, 2955 container_of(work, struct brcmf_cfg80211_iscan_ctrl,
2957 work); 2956 work);
2958 struct brcmf_cfg80211_priv *cfg_priv = iscan_to_cfg(iscan); 2957 struct brcmf_cfg80211_info *cfg = iscan_to_cfg(iscan);
2959 struct brcmf_cfg80211_iscan_eloop *el = &iscan->el; 2958 struct brcmf_cfg80211_iscan_eloop *el = &iscan->el;
2960 u32 status = BRCMF_SCAN_RESULTS_PARTIAL; 2959 u32 status = BRCMF_SCAN_RESULTS_PARTIAL;
2961 2960
@@ -2964,12 +2963,12 @@ static void brcmf_cfg80211_iscan_handler(struct work_struct *work)
2964 iscan->timer_on = 0; 2963 iscan->timer_on = 0;
2965 } 2964 }
2966 2965
2967 if (brcmf_get_iscan_results(iscan, &status, &cfg_priv->bss_list)) { 2966 if (brcmf_get_iscan_results(iscan, &status, &cfg->bss_list)) {
2968 status = BRCMF_SCAN_RESULTS_ABORTED; 2967 status = BRCMF_SCAN_RESULTS_ABORTED;
2969 WL_ERR("Abort iscan\n"); 2968 WL_ERR("Abort iscan\n");
2970 } 2969 }
2971 2970
2972 el->handler[status](cfg_priv); 2971 el->handler[status](cfg);
2973} 2972}
2974 2973
2975static void brcmf_iscan_timer(unsigned long data) 2974static void brcmf_iscan_timer(unsigned long data)
@@ -2984,11 +2983,11 @@ static void brcmf_iscan_timer(unsigned long data)
2984 } 2983 }
2985} 2984}
2986 2985
2987static s32 brcmf_invoke_iscan(struct brcmf_cfg80211_priv *cfg_priv) 2986static s32 brcmf_invoke_iscan(struct brcmf_cfg80211_info *cfg)
2988{ 2987{
2989 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg_priv); 2988 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg);
2990 2989
2991 if (cfg_priv->iscan_on) { 2990 if (cfg->iscan_on) {
2992 iscan->state = WL_ISCAN_STATE_IDLE; 2991 iscan->state = WL_ISCAN_STATE_IDLE;
2993 INIT_WORK(&iscan->work, brcmf_cfg80211_iscan_handler); 2992 INIT_WORK(&iscan->work, brcmf_cfg80211_iscan_handler);
2994 } 2993 }
@@ -3006,21 +3005,21 @@ static void brcmf_init_iscan_eloop(struct brcmf_cfg80211_iscan_eloop *el)
3006 el->handler[BRCMF_SCAN_RESULTS_NO_MEM] = brcmf_iscan_aborted; 3005 el->handler[BRCMF_SCAN_RESULTS_NO_MEM] = brcmf_iscan_aborted;
3007} 3006}
3008 3007
3009static s32 brcmf_init_iscan(struct brcmf_cfg80211_priv *cfg_priv) 3008static s32 brcmf_init_iscan(struct brcmf_cfg80211_info *cfg)
3010{ 3009{
3011 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg_priv); 3010 struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg);
3012 int err = 0; 3011 int err = 0;
3013 3012
3014 if (cfg_priv->iscan_on) { 3013 if (cfg->iscan_on) {
3015 iscan->ndev = cfg_to_ndev(cfg_priv); 3014 iscan->ndev = cfg_to_ndev(cfg);
3016 brcmf_init_iscan_eloop(&iscan->el); 3015 brcmf_init_iscan_eloop(&iscan->el);
3017 iscan->timer_ms = WL_ISCAN_TIMER_INTERVAL_MS; 3016 iscan->timer_ms = WL_ISCAN_TIMER_INTERVAL_MS;
3018 init_timer(&iscan->timer); 3017 init_timer(&iscan->timer);
3019 iscan->timer.data = (unsigned long) iscan; 3018 iscan->timer.data = (unsigned long) iscan;
3020 iscan->timer.function = brcmf_iscan_timer; 3019 iscan->timer.function = brcmf_iscan_timer;
3021 err = brcmf_invoke_iscan(cfg_priv); 3020 err = brcmf_invoke_iscan(cfg);
3022 if (!err) 3021 if (!err)
3023 iscan->data = cfg_priv; 3022 iscan->data = cfg;
3024 } 3023 }
3025 3024
3026 return err; 3025 return err;
@@ -3028,23 +3027,23 @@ static s32 brcmf_init_iscan(struct brcmf_cfg80211_priv *cfg_priv)
3028 3027
3029static void brcmf_cfg80211_escan_timeout_worker(struct work_struct *work) 3028static void brcmf_cfg80211_escan_timeout_worker(struct work_struct *work)
3030{ 3029{
3031 struct brcmf_cfg80211_priv *cfg_priv = 3030 struct brcmf_cfg80211_info *cfg =
3032 container_of(work, struct brcmf_cfg80211_priv, 3031 container_of(work, struct brcmf_cfg80211_info,
3033 escan_timeout_work); 3032 escan_timeout_work);
3034 3033
3035 brcmf_notify_escan_complete(cfg_priv, 3034 brcmf_notify_escan_complete(cfg,
3036 cfg_priv->escan_info.ndev, true, true); 3035 cfg->escan_info.ndev, true, true);
3037} 3036}
3038 3037
3039static void brcmf_escan_timeout(unsigned long data) 3038static void brcmf_escan_timeout(unsigned long data)
3040{ 3039{
3041 struct brcmf_cfg80211_priv *cfg_priv = 3040 struct brcmf_cfg80211_info *cfg =
3042 (struct brcmf_cfg80211_priv *)data; 3041 (struct brcmf_cfg80211_info *)data;
3043 3042
3044 if (cfg_priv->scan_request) { 3043 if (cfg->scan_request) {
3045 WL_ERR("timer expired\n"); 3044 WL_ERR("timer expired\n");
3046 if (cfg_priv->escan_on) 3045 if (cfg->escan_on)
3047 schedule_work(&cfg_priv->escan_timeout_work); 3046 schedule_work(&cfg->escan_timeout_work);
3048 } 3047 }
3049} 3048}
3050 3049
@@ -3081,7 +3080,7 @@ brcmf_compare_update_same_bss(struct brcmf_bss_info_le *bss,
3081} 3080}
3082 3081
3083static s32 3082static s32
3084brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv, 3083brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_info *cfg,
3085 struct net_device *ndev, 3084 struct net_device *ndev,
3086 const struct brcmf_event_msg *e, void *data) 3085 const struct brcmf_event_msg *e, void *data)
3087{ 3086{
@@ -3097,11 +3096,11 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv,
3097 3096
3098 status = be32_to_cpu(e->status); 3097 status = be32_to_cpu(e->status);
3099 3098
3100 if (!ndev || !cfg_priv->escan_on || 3099 if (!ndev || !cfg->escan_on ||
3101 !test_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { 3100 !test_bit(WL_STATUS_SCANNING, &cfg->status)) {
3102 WL_ERR("scan not ready ndev %p wl->escan_on %d drv_status %x\n", 3101 WL_ERR("scan not ready ndev %p wl->escan_on %d drv_status %x\n",
3103 ndev, cfg_priv->escan_on, 3102 ndev, cfg->escan_on,
3104 !test_bit(WL_STATUS_SCANNING, &cfg_priv->status)); 3103 !test_bit(WL_STATUS_SCANNING, &cfg->status));
3105 return -EPERM; 3104 return -EPERM;
3106 } 3105 }
3107 3106
@@ -3112,7 +3111,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv,
3112 WL_ERR("Invalid escan result (NULL pointer)\n"); 3111 WL_ERR("Invalid escan result (NULL pointer)\n");
3113 goto exit; 3112 goto exit;
3114 } 3113 }
3115 if (!cfg_priv->scan_request) { 3114 if (!cfg->scan_request) {
3116 WL_SCAN("result without cfg80211 request\n"); 3115 WL_SCAN("result without cfg80211 request\n");
3117 goto exit; 3116 goto exit;
3118 } 3117 }
@@ -3132,7 +3131,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv,
3132 goto exit; 3131 goto exit;
3133 } 3132 }
3134 3133
3135 if (!(cfg_to_wiphy(cfg_priv)->interface_modes & 3134 if (!(cfg_to_wiphy(cfg)->interface_modes &
3136 BIT(NL80211_IFTYPE_ADHOC))) { 3135 BIT(NL80211_IFTYPE_ADHOC))) {
3137 if (le16_to_cpu(bss_info_le->capability) & 3136 if (le16_to_cpu(bss_info_le->capability) &
3138 WLAN_CAPABILITY_IBSS) { 3137 WLAN_CAPABILITY_IBSS) {
@@ -3142,7 +3141,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv,
3142 } 3141 }
3143 3142
3144 list = (struct brcmf_scan_results *) 3143 list = (struct brcmf_scan_results *)
3145 cfg_priv->escan_info.escan_buf; 3144 cfg->escan_info.escan_buf;
3146 if (bi_length > WL_ESCAN_BUF_SIZE - list->buflen) { 3145 if (bi_length > WL_ESCAN_BUF_SIZE - list->buflen) {
3147 WL_ERR("Buffer is too small: ignoring\n"); 3146 WL_ERR("Buffer is too small: ignoring\n");
3148 goto exit; 3147 goto exit;
@@ -3155,19 +3154,19 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv,
3155 if (brcmf_compare_update_same_bss(bss, bss_info_le)) 3154 if (brcmf_compare_update_same_bss(bss, bss_info_le))
3156 goto exit; 3155 goto exit;
3157 } 3156 }
3158 memcpy(&(cfg_priv->escan_info.escan_buf[list->buflen]), 3157 memcpy(&(cfg->escan_info.escan_buf[list->buflen]),
3159 bss_info_le, bi_length); 3158 bss_info_le, bi_length);
3160 list->version = le32_to_cpu(bss_info_le->version); 3159 list->version = le32_to_cpu(bss_info_le->version);
3161 list->buflen += bi_length; 3160 list->buflen += bi_length;
3162 list->count++; 3161 list->count++;
3163 } else { 3162 } else {
3164 cfg_priv->escan_info.escan_state = WL_ESCAN_STATE_IDLE; 3163 cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE;
3165 if (cfg_priv->scan_request) { 3164 if (cfg->scan_request) {
3166 cfg_priv->bss_list = (struct brcmf_scan_results *) 3165 cfg->bss_list = (struct brcmf_scan_results *)
3167 cfg_priv->escan_info.escan_buf; 3166 cfg->escan_info.escan_buf;
3168 brcmf_inform_bss(cfg_priv); 3167 brcmf_inform_bss(cfg);
3169 aborted = status != BRCMF_E_STATUS_SUCCESS; 3168 aborted = status != BRCMF_E_STATUS_SUCCESS;
3170 brcmf_notify_escan_complete(cfg_priv, ndev, aborted, 3169 brcmf_notify_escan_complete(cfg, ndev, aborted,
3171 false); 3170 false);
3172 } else 3171 } else
3173 WL_ERR("Unexpected scan result 0x%x\n", status); 3172 WL_ERR("Unexpected scan result 0x%x\n", status);
@@ -3176,18 +3175,18 @@ exit:
3176 return err; 3175 return err;
3177} 3176}
3178 3177
3179static void brcmf_init_escan(struct brcmf_cfg80211_priv *cfg_priv) 3178static void brcmf_init_escan(struct brcmf_cfg80211_info *cfg)
3180{ 3179{
3181 3180
3182 if (cfg_priv->escan_on) { 3181 if (cfg->escan_on) {
3183 cfg_priv->el.handler[BRCMF_E_ESCAN_RESULT] = 3182 cfg->el.handler[BRCMF_E_ESCAN_RESULT] =
3184 brcmf_cfg80211_escan_handler; 3183 brcmf_cfg80211_escan_handler;
3185 cfg_priv->escan_info.escan_state = WL_ESCAN_STATE_IDLE; 3184 cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE;
3186 /* Init scan_timeout timer */ 3185 /* Init scan_timeout timer */
3187 init_timer(&cfg_priv->escan_timeout); 3186 init_timer(&cfg->escan_timeout);
3188 cfg_priv->escan_timeout.data = (unsigned long) cfg_priv; 3187 cfg->escan_timeout.data = (unsigned long) cfg;
3189 cfg_priv->escan_timeout.function = brcmf_escan_timeout; 3188 cfg->escan_timeout.function = brcmf_escan_timeout;
3190 INIT_WORK(&cfg_priv->escan_timeout_work, 3189 INIT_WORK(&cfg->escan_timeout_work,
3191 brcmf_cfg80211_escan_timeout_worker); 3190 brcmf_cfg80211_escan_timeout_worker);
3192 } 3191 }
3193} 3192}
@@ -3204,7 +3203,7 @@ static __always_inline void brcmf_delay(u32 ms)
3204 3203
3205static s32 brcmf_cfg80211_resume(struct wiphy *wiphy) 3204static s32 brcmf_cfg80211_resume(struct wiphy *wiphy)
3206{ 3205{
3207 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 3206 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3208 3207
3209 /* 3208 /*
3210 * Check for WL_STATUS_READY before any function call which 3209 * Check for WL_STATUS_READY before any function call which
@@ -3213,7 +3212,7 @@ static s32 brcmf_cfg80211_resume(struct wiphy *wiphy)
3213 */ 3212 */
3214 WL_TRACE("Enter\n"); 3213 WL_TRACE("Enter\n");
3215 3214
3216 if (test_bit(WL_STATUS_READY, &cfg_priv->status)) 3215 if (test_bit(WL_STATUS_READY, &cfg->status))
3217 brcmf_invoke_iscan(wiphy_to_cfg(wiphy)); 3216 brcmf_invoke_iscan(wiphy_to_cfg(wiphy));
3218 3217
3219 WL_TRACE("Exit\n"); 3218 WL_TRACE("Exit\n");
@@ -3223,8 +3222,8 @@ static s32 brcmf_cfg80211_resume(struct wiphy *wiphy)
3223static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, 3222static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
3224 struct cfg80211_wowlan *wow) 3223 struct cfg80211_wowlan *wow)
3225{ 3224{
3226 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 3225 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3227 struct net_device *ndev = cfg_to_ndev(cfg_priv); 3226 struct net_device *ndev = cfg_to_ndev(cfg);
3228 3227
3229 WL_TRACE("Enter\n"); 3228 WL_TRACE("Enter\n");
3230 3229
@@ -3238,12 +3237,12 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
3238 * While going to suspend if associated with AP disassociate 3237 * While going to suspend if associated with AP disassociate
3239 * from AP to save power while system is in suspended state 3238 * from AP to save power while system is in suspended state
3240 */ 3239 */
3241 if ((test_bit(WL_STATUS_CONNECTED, &cfg_priv->status) || 3240 if ((test_bit(WL_STATUS_CONNECTED, &cfg->status) ||
3242 test_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) && 3241 test_bit(WL_STATUS_CONNECTING, &cfg->status)) &&
3243 test_bit(WL_STATUS_READY, &cfg_priv->status)) { 3242 test_bit(WL_STATUS_READY, &cfg->status)) {
3244 WL_INFO("Disassociating from AP" 3243 WL_INFO("Disassociating from AP"
3245 " while entering suspend state\n"); 3244 " while entering suspend state\n");
3246 brcmf_link_down(cfg_priv); 3245 brcmf_link_down(cfg);
3247 3246
3248 /* 3247 /*
3249 * Make sure WPA_Supplicant receives all the event 3248 * Make sure WPA_Supplicant receives all the event
@@ -3253,13 +3252,13 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
3253 brcmf_delay(500); 3252 brcmf_delay(500);
3254 } 3253 }
3255 3254
3256 if (test_bit(WL_STATUS_READY, &cfg_priv->status)) 3255 if (test_bit(WL_STATUS_READY, &cfg->status))
3257 brcmf_abort_scanning(cfg_priv); 3256 brcmf_abort_scanning(cfg);
3258 else 3257 else
3259 clear_bit(WL_STATUS_SCANNING, &cfg_priv->status); 3258 clear_bit(WL_STATUS_SCANNING, &cfg->status);
3260 3259
3261 /* Turn off watchdog timer */ 3260 /* Turn off watchdog timer */
3262 if (test_bit(WL_STATUS_READY, &cfg_priv->status)) 3261 if (test_bit(WL_STATUS_READY, &cfg->status))
3263 brcmf_set_mpc(ndev, 1); 3262 brcmf_set_mpc(ndev, 1);
3264 3263
3265 WL_TRACE("Exit\n"); 3264 WL_TRACE("Exit\n");
@@ -3270,14 +3269,14 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
3270static __used s32 3269static __used s32
3271brcmf_dev_bufvar_set(struct net_device *ndev, s8 *name, s8 *buf, s32 len) 3270brcmf_dev_bufvar_set(struct net_device *ndev, s8 *name, s8 *buf, s32 len)
3272{ 3271{
3273 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); 3272 struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
3274 u32 buflen; 3273 u32 buflen;
3275 3274
3276 buflen = brcmf_c_mkiovar(name, buf, len, cfg_priv->dcmd_buf, 3275 buflen = brcmf_c_mkiovar(name, buf, len, cfg->dcmd_buf,
3277 WL_DCMD_LEN_MAX); 3276 WL_DCMD_LEN_MAX);
3278 BUG_ON(!buflen); 3277 BUG_ON(!buflen);
3279 3278
3280 return brcmf_exec_dcmd(ndev, BRCMF_C_SET_VAR, cfg_priv->dcmd_buf, 3279 return brcmf_exec_dcmd(ndev, BRCMF_C_SET_VAR, cfg->dcmd_buf,
3281 buflen); 3280 buflen);
3282} 3281}
3283 3282
@@ -3285,20 +3284,20 @@ static s32
3285brcmf_dev_bufvar_get(struct net_device *ndev, s8 *name, s8 *buf, 3284brcmf_dev_bufvar_get(struct net_device *ndev, s8 *name, s8 *buf,
3286 s32 buf_len) 3285 s32 buf_len)
3287{ 3286{
3288 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); 3287 struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
3289 u32 len; 3288 u32 len;
3290 s32 err = 0; 3289 s32 err = 0;
3291 3290
3292 len = brcmf_c_mkiovar(name, NULL, 0, cfg_priv->dcmd_buf, 3291 len = brcmf_c_mkiovar(name, NULL, 0, cfg->dcmd_buf,
3293 WL_DCMD_LEN_MAX); 3292 WL_DCMD_LEN_MAX);
3294 BUG_ON(!len); 3293 BUG_ON(!len);
3295 err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_VAR, cfg_priv->dcmd_buf, 3294 err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_VAR, cfg->dcmd_buf,
3296 WL_DCMD_LEN_MAX); 3295 WL_DCMD_LEN_MAX);
3297 if (err) { 3296 if (err) {
3298 WL_ERR("error (%d)\n", err); 3297 WL_ERR("error (%d)\n", err);
3299 return err; 3298 return err;
3300 } 3299 }
3301 memcpy(buf, cfg_priv->dcmd_buf, buf_len); 3300 memcpy(buf, cfg->dcmd_buf, buf_len);
3302 3301
3303 return err; 3302 return err;
3304} 3303}
@@ -3331,8 +3330,8 @@ static s32
3331brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev, 3330brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev,
3332 struct cfg80211_pmksa *pmksa) 3331 struct cfg80211_pmksa *pmksa)
3333{ 3332{
3334 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 3333 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3335 struct pmkid_list *pmkids = &cfg_priv->pmk_list->pmkids; 3334 struct pmkid_list *pmkids = &cfg->pmk_list->pmkids;
3336 s32 err = 0; 3335 s32 err = 0;
3337 int i; 3336 int i;
3338 int pmkid_len; 3337 int pmkid_len;
@@ -3360,7 +3359,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev,
3360 for (i = 0; i < WLAN_PMKID_LEN; i++) 3359 for (i = 0; i < WLAN_PMKID_LEN; i++)
3361 WL_CONN("%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]); 3360 WL_CONN("%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]);
3362 3361
3363 err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err); 3362 err = brcmf_update_pmklist(ndev, cfg->pmk_list, err);
3364 3363
3365 WL_TRACE("Exit\n"); 3364 WL_TRACE("Exit\n");
3366 return err; 3365 return err;
@@ -3370,7 +3369,7 @@ static s32
3370brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, 3369brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
3371 struct cfg80211_pmksa *pmksa) 3370 struct cfg80211_pmksa *pmksa)
3372{ 3371{
3373 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 3372 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3374 struct pmkid_list pmkid; 3373 struct pmkid_list pmkid;
3375 s32 err = 0; 3374 s32 err = 0;
3376 int i, pmkid_len; 3375 int i, pmkid_len;
@@ -3387,30 +3386,30 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
3387 for (i = 0; i < WLAN_PMKID_LEN; i++) 3386 for (i = 0; i < WLAN_PMKID_LEN; i++)
3388 WL_CONN("%02x\n", pmkid.pmkid[0].PMKID[i]); 3387 WL_CONN("%02x\n", pmkid.pmkid[0].PMKID[i]);
3389 3388
3390 pmkid_len = le32_to_cpu(cfg_priv->pmk_list->pmkids.npmkid); 3389 pmkid_len = le32_to_cpu(cfg->pmk_list->pmkids.npmkid);
3391 for (i = 0; i < pmkid_len; i++) 3390 for (i = 0; i < pmkid_len; i++)
3392 if (!memcmp 3391 if (!memcmp
3393 (pmksa->bssid, &cfg_priv->pmk_list->pmkids.pmkid[i].BSSID, 3392 (pmksa->bssid, &cfg->pmk_list->pmkids.pmkid[i].BSSID,
3394 ETH_ALEN)) 3393 ETH_ALEN))
3395 break; 3394 break;
3396 3395
3397 if ((pmkid_len > 0) 3396 if ((pmkid_len > 0)
3398 && (i < pmkid_len)) { 3397 && (i < pmkid_len)) {
3399 memset(&cfg_priv->pmk_list->pmkids.pmkid[i], 0, 3398 memset(&cfg->pmk_list->pmkids.pmkid[i], 0,
3400 sizeof(struct pmkid)); 3399 sizeof(struct pmkid));
3401 for (; i < (pmkid_len - 1); i++) { 3400 for (; i < (pmkid_len - 1); i++) {
3402 memcpy(&cfg_priv->pmk_list->pmkids.pmkid[i].BSSID, 3401 memcpy(&cfg->pmk_list->pmkids.pmkid[i].BSSID,
3403 &cfg_priv->pmk_list->pmkids.pmkid[i + 1].BSSID, 3402 &cfg->pmk_list->pmkids.pmkid[i + 1].BSSID,
3404 ETH_ALEN); 3403 ETH_ALEN);
3405 memcpy(&cfg_priv->pmk_list->pmkids.pmkid[i].PMKID, 3404 memcpy(&cfg->pmk_list->pmkids.pmkid[i].PMKID,
3406 &cfg_priv->pmk_list->pmkids.pmkid[i + 1].PMKID, 3405 &cfg->pmk_list->pmkids.pmkid[i + 1].PMKID,
3407 WLAN_PMKID_LEN); 3406 WLAN_PMKID_LEN);
3408 } 3407 }
3409 cfg_priv->pmk_list->pmkids.npmkid = cpu_to_le32(pmkid_len - 1); 3408 cfg->pmk_list->pmkids.npmkid = cpu_to_le32(pmkid_len - 1);
3410 } else 3409 } else
3411 err = -EINVAL; 3410 err = -EINVAL;
3412 3411
3413 err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err); 3412 err = brcmf_update_pmklist(ndev, cfg->pmk_list, err);
3414 3413
3415 WL_TRACE("Exit\n"); 3414 WL_TRACE("Exit\n");
3416 return err; 3415 return err;
@@ -3420,15 +3419,15 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
3420static s32 3419static s32
3421brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev) 3420brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev)
3422{ 3421{
3423 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 3422 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3424 s32 err = 0; 3423 s32 err = 0;
3425 3424
3426 WL_TRACE("Enter\n"); 3425 WL_TRACE("Enter\n");
3427 if (!check_sys_up(wiphy)) 3426 if (!check_sys_up(wiphy))
3428 return -EIO; 3427 return -EIO;
3429 3428
3430 memset(cfg_priv->pmk_list, 0, sizeof(*cfg_priv->pmk_list)); 3429 memset(cfg->pmk_list, 0, sizeof(*cfg->pmk_list));
3431 err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err); 3430 err = brcmf_update_pmklist(ndev, cfg->pmk_list, err);
3432 3431
3433 WL_TRACE("Exit\n"); 3432 WL_TRACE("Exit\n");
3434 return err; 3433 return err;
@@ -3444,7 +3443,7 @@ brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev)
3444 * cfg80211_scan_request one out of the received PNO event. 3443 * cfg80211_scan_request one out of the received PNO event.
3445 */ 3444 */
3446static s32 3445static s32
3447brcmf_notify_sched_scan_results(struct brcmf_cfg80211_priv *cfg_priv, 3446brcmf_notify_sched_scan_results(struct brcmf_cfg80211_info *cfg,
3448 struct net_device *ndev, 3447 struct net_device *ndev,
3449 const struct brcmf_event_msg *e, void *data) 3448 const struct brcmf_event_msg *e, void *data)
3450{ 3449{
@@ -3452,7 +3451,7 @@ brcmf_notify_sched_scan_results(struct brcmf_cfg80211_priv *cfg_priv,
3452 struct cfg80211_scan_request *request = NULL; 3451 struct cfg80211_scan_request *request = NULL;
3453 struct cfg80211_ssid *ssid = NULL; 3452 struct cfg80211_ssid *ssid = NULL;
3454 struct ieee80211_channel *channel = NULL; 3453 struct ieee80211_channel *channel = NULL;
3455 struct wiphy *wiphy = cfg_to_wiphy(cfg_priv); 3454 struct wiphy *wiphy = cfg_to_wiphy(cfg);
3456 int err = 0; 3455 int err = 0;
3457 int channel_req = 0; 3456 int channel_req = 0;
3458 int band = 0; 3457 int band = 0;
@@ -3524,19 +3523,19 @@ brcmf_notify_sched_scan_results(struct brcmf_cfg80211_priv *cfg_priv,
3524 if (request->n_ssids) 3523 if (request->n_ssids)
3525 request->ssids = &ssid[0]; 3524 request->ssids = &ssid[0];
3526 3525
3527 if (test_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { 3526 if (test_bit(WL_STATUS_SCANNING, &cfg->status)) {
3528 /* Abort any on-going scan */ 3527 /* Abort any on-going scan */
3529 brcmf_abort_scanning(cfg_priv); 3528 brcmf_abort_scanning(cfg);
3530 } 3529 }
3531 3530
3532 set_bit(WL_STATUS_SCANNING, &cfg_priv->status); 3531 set_bit(WL_STATUS_SCANNING, &cfg->status);
3533 err = brcmf_do_escan(cfg_priv, wiphy, ndev, request); 3532 err = brcmf_do_escan(cfg, wiphy, ndev, request);
3534 if (err) { 3533 if (err) {
3535 clear_bit(WL_STATUS_SCANNING, &cfg_priv->status); 3534 clear_bit(WL_STATUS_SCANNING, &cfg->status);
3536 goto out_err; 3535 goto out_err;
3537 } 3536 }
3538 cfg_priv->sched_escan = true; 3537 cfg->sched_escan = true;
3539 cfg_priv->scan_request = request; 3538 cfg->scan_request = request;
3540 } else { 3539 } else {
3541 WL_ERR("FALSE PNO Event. (pfn_count == 0)\n"); 3540 WL_ERR("FALSE PNO Event. (pfn_count == 0)\n");
3542 goto out_err; 3541 goto out_err;
@@ -3601,15 +3600,15 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy,
3601 struct cfg80211_sched_scan_request *request) 3600 struct cfg80211_sched_scan_request *request)
3602{ 3601{
3603 char iovbuf[128]; 3602 char iovbuf[128];
3604 struct brcmf_cfg80211_priv *cfg_priv = wiphy_priv(wiphy); 3603 struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
3605 struct brcmf_pno_net_param_le pfn; 3604 struct brcmf_pno_net_param_le pfn;
3606 int i; 3605 int i;
3607 int ret = 0; 3606 int ret = 0;
3608 3607
3609 WL_SCAN("Enter n_match_sets:%d n_ssids:%d\n", 3608 WL_SCAN("Enter n_match_sets:%d n_ssids:%d\n",
3610 request->n_match_sets, request->n_ssids); 3609 request->n_match_sets, request->n_ssids);
3611 if (test_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { 3610 if (test_bit(WL_STATUS_SCANNING, &cfg->status)) {
3612 WL_ERR("Scanning already : status (%lu)\n", cfg_priv->status); 3611 WL_ERR("Scanning already : status (%lu)\n", cfg->status);
3613 return -EAGAIN; 3612 return -EAGAIN;
3614 } 3613 }
3615 3614
@@ -3688,12 +3687,12 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy,
3688static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy, 3687static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy,
3689 struct net_device *ndev) 3688 struct net_device *ndev)
3690{ 3689{
3691 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 3690 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3692 3691
3693 WL_SCAN("enter\n"); 3692 WL_SCAN("enter\n");
3694 brcmf_dev_pno_clean(ndev); 3693 brcmf_dev_pno_clean(ndev);
3695 if (cfg_priv->sched_escan) 3694 if (cfg->sched_escan)
3696 brcmf_notify_escan_complete(cfg_priv, ndev, true, true); 3695 brcmf_notify_escan_complete(cfg, ndev, true, true);
3697 return 0; 3696 return 0;
3698} 3697}
3699#endif /* CONFIG_BRCMISCAN */ 3698#endif /* CONFIG_BRCMISCAN */
@@ -3701,8 +3700,8 @@ static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy,
3701#ifdef CONFIG_NL80211_TESTMODE 3700#ifdef CONFIG_NL80211_TESTMODE
3702static int brcmf_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) 3701static int brcmf_cfg80211_testmode(struct wiphy *wiphy, void *data, int len)
3703{ 3702{
3704 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 3703 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
3705 struct net_device *ndev = cfg_priv->wdev->netdev; 3704 struct net_device *ndev = cfg->wdev->netdev;
3706 struct brcmf_dcmd *dcmd = data; 3705 struct brcmf_dcmd *dcmd = data;
3707 struct sk_buff *reply; 3706 struct sk_buff *reply;
3708 int ret; 3707 int ret;
@@ -4010,7 +4009,7 @@ brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 *ie_ptr, u32 ie_len, s8 *add_del_cmd)
4010} 4009}
4011 4010
4012s32 4011s32
4013brcmf_set_management_ie(struct brcmf_cfg80211_priv *cfg_priv, 4012brcmf_set_management_ie(struct brcmf_cfg80211_info *cfg,
4014 struct net_device *ndev, s32 bssidx, s32 pktflag, 4013 struct net_device *ndev, s32 bssidx, s32 pktflag,
4015 u8 *vndr_ie_buf, u32 vndr_ie_len) 4014 u8 *vndr_ie_buf, u32 vndr_ie_len)
4016{ 4015{
@@ -4035,19 +4034,19 @@ brcmf_set_management_ie(struct brcmf_cfg80211_priv *cfg_priv,
4035 if (!iovar_ie_buf) 4034 if (!iovar_ie_buf)
4036 return -ENOMEM; 4035 return -ENOMEM;
4037 curr_ie_buf = iovar_ie_buf; 4036 curr_ie_buf = iovar_ie_buf;
4038 if (test_bit(WL_STATUS_AP_CREATING, &cfg_priv->status) || 4037 if (test_bit(WL_STATUS_AP_CREATING, &cfg->status) ||
4039 test_bit(WL_STATUS_AP_CREATED, &cfg_priv->status)) { 4038 test_bit(WL_STATUS_AP_CREATED, &cfg->status)) {
4040 switch (pktflag) { 4039 switch (pktflag) {
4041 case VNDR_IE_PRBRSP_FLAG: 4040 case VNDR_IE_PRBRSP_FLAG:
4042 mgmt_ie_buf = cfg_priv->ap_info->probe_res_ie; 4041 mgmt_ie_buf = cfg->ap_info->probe_res_ie;
4043 mgmt_ie_len = &cfg_priv->ap_info->probe_res_ie_len; 4042 mgmt_ie_len = &cfg->ap_info->probe_res_ie_len;
4044 mgmt_ie_buf_len = 4043 mgmt_ie_buf_len =
4045 sizeof(cfg_priv->ap_info->probe_res_ie); 4044 sizeof(cfg->ap_info->probe_res_ie);
4046 break; 4045 break;
4047 case VNDR_IE_BEACON_FLAG: 4046 case VNDR_IE_BEACON_FLAG:
4048 mgmt_ie_buf = cfg_priv->ap_info->beacon_ie; 4047 mgmt_ie_buf = cfg->ap_info->beacon_ie;
4049 mgmt_ie_len = &cfg_priv->ap_info->beacon_ie_len; 4048 mgmt_ie_len = &cfg->ap_info->beacon_ie_len;
4050 mgmt_ie_buf_len = sizeof(cfg_priv->ap_info->beacon_ie); 4049 mgmt_ie_buf_len = sizeof(cfg->ap_info->beacon_ie);
4051 break; 4050 break;
4052 default: 4051 default:
4053 err = -EPERM; 4052 err = -EPERM;
@@ -4153,7 +4152,7 @@ brcmf_set_management_ie(struct brcmf_cfg80211_priv *cfg_priv,
4153 err = brcmf_dev_iovar_setbuf_bsscfg(ndev, "vndr_ie", 4152 err = brcmf_dev_iovar_setbuf_bsscfg(ndev, "vndr_ie",
4154 iovar_ie_buf, 4153 iovar_ie_buf,
4155 total_ie_buf_len, 4154 total_ie_buf_len,
4156 cfg_priv->extra_buf, 4155 cfg->extra_buf,
4157 WL_EXTRA_BUF_MAX, bssidx); 4156 WL_EXTRA_BUF_MAX, bssidx);
4158 if (err) 4157 if (err)
4159 WL_ERR("vndr ie set error : %d\n", err); 4158 WL_ERR("vndr ie set error : %d\n", err);
@@ -4176,7 +4175,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4176 struct brcmf_tlv *rsn_ie; 4175 struct brcmf_tlv *rsn_ie;
4177 struct brcmf_vs_tlv *wpa_ie; 4176 struct brcmf_vs_tlv *wpa_ie;
4178 struct brcmf_join_params join_params; 4177 struct brcmf_join_params join_params;
4179 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 4178 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
4180 s32 bssidx = 0; 4179 s32 bssidx = 0;
4181 4180
4182 WL_TRACE("channel_type=%d, beacon_interval=%d, dtim_period=%d,\n", 4181 WL_TRACE("channel_type=%d, beacon_interval=%d, dtim_period=%d,\n",
@@ -4186,7 +4185,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4186 settings->ssid, settings->ssid_len, settings->auth_type, 4185 settings->ssid, settings->ssid_len, settings->auth_type,
4187 settings->inactivity_timeout); 4186 settings->inactivity_timeout);
4188 4187
4189 if (!test_bit(WL_STATUS_AP_CREATING, &cfg_priv->status)) { 4188 if (!test_bit(WL_STATUS_AP_CREATING, &cfg->status)) {
4190 WL_ERR("Not in AP creation mode\n"); 4189 WL_ERR("Not in AP creation mode\n");
4191 return -EPERM; 4190 return -EPERM;
4192 } 4191 }
@@ -4237,10 +4236,10 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4237 wpa_ie = brcmf_find_wpaie((u8 *)settings->beacon.tail, 4236 wpa_ie = brcmf_find_wpaie((u8 *)settings->beacon.tail,
4238 settings->beacon.tail_len); 4237 settings->beacon.tail_len);
4239 4238
4240 kfree(cfg_priv->ap_info->rsn_ie); 4239 kfree(cfg->ap_info->rsn_ie);
4241 cfg_priv->ap_info->rsn_ie = NULL; 4240 cfg->ap_info->rsn_ie = NULL;
4242 kfree(cfg_priv->ap_info->wpa_ie); 4241 kfree(cfg->ap_info->wpa_ie);
4243 cfg_priv->ap_info->wpa_ie = NULL; 4242 cfg->ap_info->wpa_ie = NULL;
4244 4243
4245 if ((wpa_ie != NULL || rsn_ie != NULL)) { 4244 if ((wpa_ie != NULL || rsn_ie != NULL)) {
4246 WL_TRACE("WPA(2) IE is found\n"); 4245 WL_TRACE("WPA(2) IE is found\n");
@@ -4250,7 +4249,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4250 bssidx); 4249 bssidx);
4251 if (err < 0) 4250 if (err < 0)
4252 goto exit; 4251 goto exit;
4253 cfg_priv->ap_info->wpa_ie = kmemdup(wpa_ie, 4252 cfg->ap_info->wpa_ie = kmemdup(wpa_ie,
4254 wpa_ie->len + 4253 wpa_ie->len +
4255 TLV_HDR_LEN, 4254 TLV_HDR_LEN,
4256 GFP_KERNEL); 4255 GFP_KERNEL);
@@ -4260,19 +4259,19 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4260 (struct brcmf_vs_tlv *)rsn_ie, true, bssidx); 4259 (struct brcmf_vs_tlv *)rsn_ie, true, bssidx);
4261 if (err < 0) 4260 if (err < 0)
4262 goto exit; 4261 goto exit;
4263 cfg_priv->ap_info->rsn_ie = kmemdup(rsn_ie, 4262 cfg->ap_info->rsn_ie = kmemdup(rsn_ie,
4264 rsn_ie->len + 4263 rsn_ie->len +
4265 TLV_HDR_LEN, 4264 TLV_HDR_LEN,
4266 GFP_KERNEL); 4265 GFP_KERNEL);
4267 } 4266 }
4268 cfg_priv->ap_info->security_mode = true; 4267 cfg->ap_info->security_mode = true;
4269 } else { 4268 } else {
4270 WL_TRACE("No WPA(2) IEs found\n"); 4269 WL_TRACE("No WPA(2) IEs found\n");
4271 brcmf_configure_opensecurity(ndev, bssidx); 4270 brcmf_configure_opensecurity(ndev, bssidx);
4272 cfg_priv->ap_info->security_mode = false; 4271 cfg->ap_info->security_mode = false;
4273 } 4272 }
4274 /* Set Beacon IEs to FW */ 4273 /* Set Beacon IEs to FW */
4275 err = brcmf_set_management_ie(cfg_priv, ndev, bssidx, 4274 err = brcmf_set_management_ie(cfg, ndev, bssidx,
4276 VNDR_IE_BEACON_FLAG, 4275 VNDR_IE_BEACON_FLAG,
4277 (u8 *)settings->beacon.tail, 4276 (u8 *)settings->beacon.tail,
4278 settings->beacon.tail_len); 4277 settings->beacon.tail_len);
@@ -4282,7 +4281,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4282 WL_TRACE("Applied Vndr IEs for Beacon\n"); 4281 WL_TRACE("Applied Vndr IEs for Beacon\n");
4283 4282
4284 /* Set Probe Response IEs to FW */ 4283 /* Set Probe Response IEs to FW */
4285 err = brcmf_set_management_ie(cfg_priv, ndev, bssidx, 4284 err = brcmf_set_management_ie(cfg, ndev, bssidx,
4286 VNDR_IE_PRBRSP_FLAG, 4285 VNDR_IE_PRBRSP_FLAG,
4287 (u8 *)settings->beacon.proberesp_ies, 4286 (u8 *)settings->beacon.proberesp_ies,
4288 settings->beacon.proberesp_ies_len); 4287 settings->beacon.proberesp_ies_len);
@@ -4326,8 +4325,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
4326 WL_ERR("SET SSID error (%d)\n", err); 4325 WL_ERR("SET SSID error (%d)\n", err);
4327 goto exit; 4326 goto exit;
4328 } 4327 }
4329 clear_bit(WL_STATUS_AP_CREATING, &cfg_priv->status); 4328 clear_bit(WL_STATUS_AP_CREATING, &cfg->status);
4330 set_bit(WL_STATUS_AP_CREATED, &cfg_priv->status); 4329 set_bit(WL_STATUS_AP_CREATED, &cfg->status);
4331 4330
4332exit: 4331exit:
4333 if (err) 4332 if (err)
@@ -4337,13 +4336,13 @@ exit:
4337 4336
4338static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) 4337static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
4339{ 4338{
4340 struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); 4339 struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
4341 s32 ioctl_value; 4340 s32 ioctl_value;
4342 s32 err = -EPERM; 4341 s32 err = -EPERM;
4343 4342
4344 WL_TRACE("Enter\n"); 4343 WL_TRACE("Enter\n");
4345 4344
4346 if (cfg_priv->conf->mode == WL_MODE_AP) { 4345 if (cfg->conf->mode == WL_MODE_AP) {
4347 /* Due to most likely deauths outstanding we sleep */ 4346 /* Due to most likely deauths outstanding we sleep */
4348 /* first to make sure they get processed by fw. */ 4347 /* first to make sure they get processed by fw. */
4349 msleep(400); 4348 msleep(400);
@@ -4360,8 +4359,8 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
4360 goto exit; 4359 goto exit;
4361 } 4360 }
4362 brcmf_set_mpc(ndev, 1); 4361 brcmf_set_mpc(ndev, 1);
4363 clear_bit(WL_STATUS_AP_CREATING, &cfg_priv->status); 4362 clear_bit(WL_STATUS_AP_CREATING, &cfg->status);
4364 clear_bit(WL_STATUS_AP_CREATED, &cfg_priv->status); 4363 clear_bit(WL_STATUS_AP_CREATED, &cfg->status);
4365 } 4364 }
4366exit: 4365exit:
4367 return err; 4366 return err;
@@ -4466,7 +4465,7 @@ static struct wireless_dev *brcmf_alloc_wdev(struct device *ndev)
4466 return ERR_PTR(-ENOMEM); 4465 return ERR_PTR(-ENOMEM);
4467 4466
4468 wdev->wiphy = wiphy_new(&wl_cfg80211_ops, 4467 wdev->wiphy = wiphy_new(&wl_cfg80211_ops,
4469 sizeof(struct brcmf_cfg80211_priv)); 4468 sizeof(struct brcmf_cfg80211_info));
4470 if (!wdev->wiphy) { 4469 if (!wdev->wiphy) {
4471 WL_ERR("Could not allocate wiphy device\n"); 4470 WL_ERR("Could not allocate wiphy device\n");
4472 err = -ENOMEM; 4471 err = -ENOMEM;
@@ -4510,9 +4509,9 @@ wiphy_new_out:
4510 return ERR_PTR(err); 4509 return ERR_PTR(err);
4511} 4510}
4512 4511
4513static void brcmf_free_wdev(struct brcmf_cfg80211_priv *cfg_priv) 4512static void brcmf_free_wdev(struct brcmf_cfg80211_info *cfg)
4514{ 4513{
4515 struct wireless_dev *wdev = cfg_priv->wdev; 4514 struct wireless_dev *wdev = cfg->wdev;
4516 4515
4517 if (!wdev) { 4516 if (!wdev) {
4518 WL_ERR("wdev is invalid\n"); 4517 WL_ERR("wdev is invalid\n");
@@ -4521,10 +4520,10 @@ static void brcmf_free_wdev(struct brcmf_cfg80211_priv *cfg_priv)
4521 wiphy_unregister(wdev->wiphy); 4520 wiphy_unregister(wdev->wiphy);
4522 wiphy_free(wdev->wiphy); 4521 wiphy_free(wdev->wiphy);
4523 kfree(wdev); 4522 kfree(wdev);
4524 cfg_priv->wdev = NULL; 4523 cfg->wdev = NULL;
4525} 4524}
4526 4525
4527static bool brcmf_is_linkup(struct brcmf_cfg80211_priv *cfg_priv, 4526static bool brcmf_is_linkup(struct brcmf_cfg80211_info *cfg,
4528 const struct brcmf_event_msg *e) 4527 const struct brcmf_event_msg *e)
4529{ 4528{
4530 u32 event = be32_to_cpu(e->event_type); 4529 u32 event = be32_to_cpu(e->event_type);
@@ -4532,14 +4531,14 @@ static bool brcmf_is_linkup(struct brcmf_cfg80211_priv *cfg_priv,
4532 4531
4533 if (event == BRCMF_E_SET_SSID && status == BRCMF_E_STATUS_SUCCESS) { 4532 if (event == BRCMF_E_SET_SSID && status == BRCMF_E_STATUS_SUCCESS) {
4534 WL_CONN("Processing set ssid\n"); 4533 WL_CONN("Processing set ssid\n");
4535 cfg_priv->link_up = true; 4534 cfg->link_up = true;
4536 return true; 4535 return true;
4537 } 4536 }
4538 4537
4539 return false; 4538 return false;
4540} 4539}
4541 4540
4542static bool brcmf_is_linkdown(struct brcmf_cfg80211_priv *cfg_priv, 4541static bool brcmf_is_linkdown(struct brcmf_cfg80211_info *cfg,
4543 const struct brcmf_event_msg *e) 4542 const struct brcmf_event_msg *e)
4544{ 4543{
4545 u32 event = be32_to_cpu(e->event_type); 4544 u32 event = be32_to_cpu(e->event_type);
@@ -4552,7 +4551,7 @@ static bool brcmf_is_linkdown(struct brcmf_cfg80211_priv *cfg_priv,
4552 return false; 4551 return false;
4553} 4552}
4554 4553
4555static bool brcmf_is_nonetwork(struct brcmf_cfg80211_priv *cfg_priv, 4554static bool brcmf_is_nonetwork(struct brcmf_cfg80211_info *cfg,
4556 const struct brcmf_event_msg *e) 4555 const struct brcmf_event_msg *e)
4557{ 4556{
4558 u32 event = be32_to_cpu(e->event_type); 4557 u32 event = be32_to_cpu(e->event_type);
@@ -4573,9 +4572,9 @@ static bool brcmf_is_nonetwork(struct brcmf_cfg80211_priv *cfg_priv,
4573 return false; 4572 return false;
4574} 4573}
4575 4574
4576static void brcmf_clear_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv) 4575static void brcmf_clear_assoc_ies(struct brcmf_cfg80211_info *cfg)
4577{ 4576{
4578 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg_priv); 4577 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
4579 4578
4580 kfree(conn_info->req_ie); 4579 kfree(conn_info->req_ie);
4581 conn_info->req_ie = NULL; 4580 conn_info->req_ie = NULL;
@@ -4585,30 +4584,30 @@ static void brcmf_clear_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
4585 conn_info->resp_ie_len = 0; 4584 conn_info->resp_ie_len = 0;
4586} 4585}
4587 4586
4588static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv) 4587static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg)
4589{ 4588{
4590 struct net_device *ndev = cfg_to_ndev(cfg_priv); 4589 struct net_device *ndev = cfg_to_ndev(cfg);
4591 struct brcmf_cfg80211_assoc_ielen_le *assoc_info; 4590 struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
4592 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg_priv); 4591 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
4593 u32 req_len; 4592 u32 req_len;
4594 u32 resp_len; 4593 u32 resp_len;
4595 s32 err = 0; 4594 s32 err = 0;
4596 4595
4597 brcmf_clear_assoc_ies(cfg_priv); 4596 brcmf_clear_assoc_ies(cfg);
4598 4597
4599 err = brcmf_dev_bufvar_get(ndev, "assoc_info", cfg_priv->extra_buf, 4598 err = brcmf_dev_bufvar_get(ndev, "assoc_info", cfg->extra_buf,
4600 WL_ASSOC_INFO_MAX); 4599 WL_ASSOC_INFO_MAX);
4601 if (err) { 4600 if (err) {
4602 WL_ERR("could not get assoc info (%d)\n", err); 4601 WL_ERR("could not get assoc info (%d)\n", err);
4603 return err; 4602 return err;
4604 } 4603 }
4605 assoc_info = 4604 assoc_info =
4606 (struct brcmf_cfg80211_assoc_ielen_le *)cfg_priv->extra_buf; 4605 (struct brcmf_cfg80211_assoc_ielen_le *)cfg->extra_buf;
4607 req_len = le32_to_cpu(assoc_info->req_len); 4606 req_len = le32_to_cpu(assoc_info->req_len);
4608 resp_len = le32_to_cpu(assoc_info->resp_len); 4607 resp_len = le32_to_cpu(assoc_info->resp_len);
4609 if (req_len) { 4608 if (req_len) {
4610 err = brcmf_dev_bufvar_get(ndev, "assoc_req_ies", 4609 err = brcmf_dev_bufvar_get(ndev, "assoc_req_ies",
4611 cfg_priv->extra_buf, 4610 cfg->extra_buf,
4612 WL_ASSOC_INFO_MAX); 4611 WL_ASSOC_INFO_MAX);
4613 if (err) { 4612 if (err) {
4614 WL_ERR("could not get assoc req (%d)\n", err); 4613 WL_ERR("could not get assoc req (%d)\n", err);
@@ -4616,7 +4615,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
4616 } 4615 }
4617 conn_info->req_ie_len = req_len; 4616 conn_info->req_ie_len = req_len;
4618 conn_info->req_ie = 4617 conn_info->req_ie =
4619 kmemdup(cfg_priv->extra_buf, conn_info->req_ie_len, 4618 kmemdup(cfg->extra_buf, conn_info->req_ie_len,
4620 GFP_KERNEL); 4619 GFP_KERNEL);
4621 } else { 4620 } else {
4622 conn_info->req_ie_len = 0; 4621 conn_info->req_ie_len = 0;
@@ -4624,7 +4623,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
4624 } 4623 }
4625 if (resp_len) { 4624 if (resp_len) {
4626 err = brcmf_dev_bufvar_get(ndev, "assoc_resp_ies", 4625 err = brcmf_dev_bufvar_get(ndev, "assoc_resp_ies",
4627 cfg_priv->extra_buf, 4626 cfg->extra_buf,
4628 WL_ASSOC_INFO_MAX); 4627 WL_ASSOC_INFO_MAX);
4629 if (err) { 4628 if (err) {
4630 WL_ERR("could not get assoc resp (%d)\n", err); 4629 WL_ERR("could not get assoc resp (%d)\n", err);
@@ -4632,7 +4631,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
4632 } 4631 }
4633 conn_info->resp_ie_len = resp_len; 4632 conn_info->resp_ie_len = resp_len;
4634 conn_info->resp_ie = 4633 conn_info->resp_ie =
4635 kmemdup(cfg_priv->extra_buf, conn_info->resp_ie_len, 4634 kmemdup(cfg->extra_buf, conn_info->resp_ie_len,
4636 GFP_KERNEL); 4635 GFP_KERNEL);
4637 } else { 4636 } else {
4638 conn_info->resp_ie_len = 0; 4637 conn_info->resp_ie_len = 0;
@@ -4645,12 +4644,12 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
4645} 4644}
4646 4645
4647static s32 4646static s32
4648brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv, 4647brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
4649 struct net_device *ndev, 4648 struct net_device *ndev,
4650 const struct brcmf_event_msg *e) 4649 const struct brcmf_event_msg *e)
4651{ 4650{
4652 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg_priv); 4651 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
4653 struct wiphy *wiphy = cfg_to_wiphy(cfg_priv); 4652 struct wiphy *wiphy = cfg_to_wiphy(cfg);
4654 struct brcmf_channel_info_le channel_le; 4653 struct brcmf_channel_info_le channel_le;
4655 struct ieee80211_channel *notify_channel; 4654 struct ieee80211_channel *notify_channel;
4656 struct ieee80211_supported_band *band; 4655 struct ieee80211_supported_band *band;
@@ -4660,9 +4659,9 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv,
4660 4659
4661 WL_TRACE("Enter\n"); 4660 WL_TRACE("Enter\n");
4662 4661
4663 brcmf_get_assoc_ies(cfg_priv); 4662 brcmf_get_assoc_ies(cfg);
4664 brcmf_update_prof(cfg_priv, NULL, &e->addr, WL_PROF_BSSID); 4663 brcmf_update_prof(cfg, NULL, &e->addr, WL_PROF_BSSID);
4665 brcmf_update_bss_info(cfg_priv); 4664 brcmf_update_bss_info(cfg);
4666 4665
4667 brcmf_exec_dcmd(ndev, BRCMF_C_GET_CHANNEL, &channel_le, 4666 brcmf_exec_dcmd(ndev, BRCMF_C_GET_CHANNEL, &channel_le,
4668 sizeof(channel_le)); 4667 sizeof(channel_le));
@@ -4679,35 +4678,35 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv,
4679 notify_channel = ieee80211_get_channel(wiphy, freq); 4678 notify_channel = ieee80211_get_channel(wiphy, freq);
4680 4679
4681 cfg80211_roamed(ndev, notify_channel, 4680 cfg80211_roamed(ndev, notify_channel,
4682 (u8 *)brcmf_read_prof(cfg_priv, WL_PROF_BSSID), 4681 (u8 *)brcmf_read_prof(cfg, WL_PROF_BSSID),
4683 conn_info->req_ie, conn_info->req_ie_len, 4682 conn_info->req_ie, conn_info->req_ie_len,
4684 conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); 4683 conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
4685 WL_CONN("Report roaming result\n"); 4684 WL_CONN("Report roaming result\n");
4686 4685
4687 set_bit(WL_STATUS_CONNECTED, &cfg_priv->status); 4686 set_bit(WL_STATUS_CONNECTED, &cfg->status);
4688 WL_TRACE("Exit\n"); 4687 WL_TRACE("Exit\n");
4689 return err; 4688 return err;
4690} 4689}
4691 4690
4692static s32 4691static s32
4693brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv, 4692brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,
4694 struct net_device *ndev, const struct brcmf_event_msg *e, 4693 struct net_device *ndev, const struct brcmf_event_msg *e,
4695 bool completed) 4694 bool completed)
4696{ 4695{
4697 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg_priv); 4696 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
4698 s32 err = 0; 4697 s32 err = 0;
4699 4698
4700 WL_TRACE("Enter\n"); 4699 WL_TRACE("Enter\n");
4701 4700
4702 if (test_and_clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) { 4701 if (test_and_clear_bit(WL_STATUS_CONNECTING, &cfg->status)) {
4703 if (completed) { 4702 if (completed) {
4704 brcmf_get_assoc_ies(cfg_priv); 4703 brcmf_get_assoc_ies(cfg);
4705 brcmf_update_prof(cfg_priv, NULL, &e->addr, 4704 brcmf_update_prof(cfg, NULL, &e->addr,
4706 WL_PROF_BSSID); 4705 WL_PROF_BSSID);
4707 brcmf_update_bss_info(cfg_priv); 4706 brcmf_update_bss_info(cfg);
4708 } 4707 }
4709 cfg80211_connect_result(ndev, 4708 cfg80211_connect_result(ndev,
4710 (u8 *)brcmf_read_prof(cfg_priv, 4709 (u8 *)brcmf_read_prof(cfg,
4711 WL_PROF_BSSID), 4710 WL_PROF_BSSID),
4712 conn_info->req_ie, 4711 conn_info->req_ie,
4713 conn_info->req_ie_len, 4712 conn_info->req_ie_len,
@@ -4717,7 +4716,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv,
4717 WLAN_STATUS_AUTH_TIMEOUT, 4716 WLAN_STATUS_AUTH_TIMEOUT,
4718 GFP_KERNEL); 4717 GFP_KERNEL);
4719 if (completed) 4718 if (completed)
4720 set_bit(WL_STATUS_CONNECTED, &cfg_priv->status); 4719 set_bit(WL_STATUS_CONNECTED, &cfg->status);
4721 WL_CONN("Report connect result - connection %s\n", 4720 WL_CONN("Report connect result - connection %s\n",
4722 completed ? "succeeded" : "failed"); 4721 completed ? "succeeded" : "failed");
4723 } 4722 }
@@ -4726,7 +4725,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv,
4726} 4725}
4727 4726
4728static s32 4727static s32
4729brcmf_notify_connect_status_ap(struct brcmf_cfg80211_priv *cfg_priv, 4728brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg,
4730 struct net_device *ndev, 4729 struct net_device *ndev,
4731 const struct brcmf_event_msg *e, void *data) 4730 const struct brcmf_event_msg *e, void *data)
4732{ 4731{
@@ -4765,54 +4764,54 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_priv *cfg_priv,
4765} 4764}
4766 4765
4767static s32 4766static s32
4768brcmf_notify_connect_status(struct brcmf_cfg80211_priv *cfg_priv, 4767brcmf_notify_connect_status(struct brcmf_cfg80211_info *cfg,
4769 struct net_device *ndev, 4768 struct net_device *ndev,
4770 const struct brcmf_event_msg *e, void *data) 4769 const struct brcmf_event_msg *e, void *data)
4771{ 4770{
4772 s32 err = 0; 4771 s32 err = 0;
4773 4772
4774 if (cfg_priv->conf->mode == WL_MODE_AP) { 4773 if (cfg->conf->mode == WL_MODE_AP) {
4775 err = brcmf_notify_connect_status_ap(cfg_priv, ndev, e, data); 4774 err = brcmf_notify_connect_status_ap(cfg, ndev, e, data);
4776 } else if (brcmf_is_linkup(cfg_priv, e)) { 4775 } else if (brcmf_is_linkup(cfg, e)) {
4777 WL_CONN("Linkup\n"); 4776 WL_CONN("Linkup\n");
4778 if (brcmf_is_ibssmode(cfg_priv)) { 4777 if (brcmf_is_ibssmode(cfg)) {
4779 brcmf_update_prof(cfg_priv, NULL, (void *)e->addr, 4778 brcmf_update_prof(cfg, NULL, (void *)e->addr,
4780 WL_PROF_BSSID); 4779 WL_PROF_BSSID);
4781 wl_inform_ibss(cfg_priv, ndev, e->addr); 4780 wl_inform_ibss(cfg, ndev, e->addr);
4782 cfg80211_ibss_joined(ndev, e->addr, GFP_KERNEL); 4781 cfg80211_ibss_joined(ndev, e->addr, GFP_KERNEL);
4783 clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status); 4782 clear_bit(WL_STATUS_CONNECTING, &cfg->status);
4784 set_bit(WL_STATUS_CONNECTED, &cfg_priv->status); 4783 set_bit(WL_STATUS_CONNECTED, &cfg->status);
4785 } else 4784 } else
4786 brcmf_bss_connect_done(cfg_priv, ndev, e, true); 4785 brcmf_bss_connect_done(cfg, ndev, e, true);
4787 } else if (brcmf_is_linkdown(cfg_priv, e)) { 4786 } else if (brcmf_is_linkdown(cfg, e)) {
4788 WL_CONN("Linkdown\n"); 4787 WL_CONN("Linkdown\n");
4789 if (brcmf_is_ibssmode(cfg_priv)) { 4788 if (brcmf_is_ibssmode(cfg)) {
4790 clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status); 4789 clear_bit(WL_STATUS_CONNECTING, &cfg->status);
4791 if (test_and_clear_bit(WL_STATUS_CONNECTED, 4790 if (test_and_clear_bit(WL_STATUS_CONNECTED,
4792 &cfg_priv->status)) 4791 &cfg->status))
4793 brcmf_link_down(cfg_priv); 4792 brcmf_link_down(cfg);
4794 } else { 4793 } else {
4795 brcmf_bss_connect_done(cfg_priv, ndev, e, false); 4794 brcmf_bss_connect_done(cfg, ndev, e, false);
4796 if (test_and_clear_bit(WL_STATUS_CONNECTED, 4795 if (test_and_clear_bit(WL_STATUS_CONNECTED,
4797 &cfg_priv->status)) { 4796 &cfg->status)) {
4798 cfg80211_disconnected(ndev, 0, NULL, 0, 4797 cfg80211_disconnected(ndev, 0, NULL, 0,
4799 GFP_KERNEL); 4798 GFP_KERNEL);
4800 brcmf_link_down(cfg_priv); 4799 brcmf_link_down(cfg);
4801 } 4800 }
4802 } 4801 }
4803 brcmf_init_prof(cfg_priv->profile); 4802 brcmf_init_prof(cfg->profile);
4804 } else if (brcmf_is_nonetwork(cfg_priv, e)) { 4803 } else if (brcmf_is_nonetwork(cfg, e)) {
4805 if (brcmf_is_ibssmode(cfg_priv)) 4804 if (brcmf_is_ibssmode(cfg))
4806 clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status); 4805 clear_bit(WL_STATUS_CONNECTING, &cfg->status);
4807 else 4806 else
4808 brcmf_bss_connect_done(cfg_priv, ndev, e, false); 4807 brcmf_bss_connect_done(cfg, ndev, e, false);
4809 } 4808 }
4810 4809
4811 return err; 4810 return err;
4812} 4811}
4813 4812
4814static s32 4813static s32
4815brcmf_notify_roaming_status(struct brcmf_cfg80211_priv *cfg_priv, 4814brcmf_notify_roaming_status(struct brcmf_cfg80211_info *cfg,
4816 struct net_device *ndev, 4815 struct net_device *ndev,
4817 const struct brcmf_event_msg *e, void *data) 4816 const struct brcmf_event_msg *e, void *data)
4818{ 4817{
@@ -4821,17 +4820,17 @@ brcmf_notify_roaming_status(struct brcmf_cfg80211_priv *cfg_priv,
4821 u32 status = be32_to_cpu(e->status); 4820 u32 status = be32_to_cpu(e->status);
4822 4821
4823 if (event == BRCMF_E_ROAM && status == BRCMF_E_STATUS_SUCCESS) { 4822 if (event == BRCMF_E_ROAM && status == BRCMF_E_STATUS_SUCCESS) {
4824 if (test_bit(WL_STATUS_CONNECTED, &cfg_priv->status)) 4823 if (test_bit(WL_STATUS_CONNECTED, &cfg->status))
4825 brcmf_bss_roaming_done(cfg_priv, ndev, e); 4824 brcmf_bss_roaming_done(cfg, ndev, e);
4826 else 4825 else
4827 brcmf_bss_connect_done(cfg_priv, ndev, e, true); 4826 brcmf_bss_connect_done(cfg, ndev, e, true);
4828 } 4827 }
4829 4828
4830 return err; 4829 return err;
4831} 4830}
4832 4831
4833static s32 4832static s32
4834brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv, 4833brcmf_notify_mic_status(struct brcmf_cfg80211_info *cfg,
4835 struct net_device *ndev, 4834 struct net_device *ndev,
4836 const struct brcmf_event_msg *e, void *data) 4835 const struct brcmf_event_msg *e, void *data)
4837{ 4836{
@@ -4850,7 +4849,7 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv,
4850} 4849}
4851 4850
4852static s32 4851static s32
4853brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv, 4852brcmf_notify_scan_status(struct brcmf_cfg80211_info *cfg,
4854 struct net_device *ndev, 4853 struct net_device *ndev,
4855 const struct brcmf_event_msg *e, void *data) 4854 const struct brcmf_event_msg *e, void *data)
4856{ 4855{
@@ -4863,12 +4862,12 @@ brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
4863 4862
4864 WL_TRACE("Enter\n"); 4863 WL_TRACE("Enter\n");
4865 4864
4866 if (cfg_priv->iscan_on && cfg_priv->iscan_kickstart) { 4865 if (cfg->iscan_on && cfg->iscan_kickstart) {
4867 WL_TRACE("Exit\n"); 4866 WL_TRACE("Exit\n");
4868 return brcmf_wakeup_iscan(cfg_to_iscan(cfg_priv)); 4867 return brcmf_wakeup_iscan(cfg_to_iscan(cfg));
4869 } 4868 }
4870 4869
4871 if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { 4870 if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg->status)) {
4872 WL_ERR("Scan complete while device not scanning\n"); 4871 WL_ERR("Scan complete while device not scanning\n");
4873 scan_abort = true; 4872 scan_abort = true;
4874 err = -EINVAL; 4873 err = -EINVAL;
@@ -4885,33 +4884,33 @@ brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
4885 scan_channel = le32_to_cpu(channel_inform_le.scan_channel); 4884 scan_channel = le32_to_cpu(channel_inform_le.scan_channel);
4886 if (scan_channel) 4885 if (scan_channel)
4887 WL_CONN("channel_inform.scan_channel (%d)\n", scan_channel); 4886 WL_CONN("channel_inform.scan_channel (%d)\n", scan_channel);
4888 cfg_priv->bss_list = cfg_priv->scan_results; 4887 cfg->bss_list = cfg->scan_results;
4889 bss_list_le = (struct brcmf_scan_results_le *) cfg_priv->bss_list; 4888 bss_list_le = (struct brcmf_scan_results_le *) cfg->bss_list;
4890 4889
4891 memset(cfg_priv->scan_results, 0, len); 4890 memset(cfg->scan_results, 0, len);
4892 bss_list_le->buflen = cpu_to_le32(len); 4891 bss_list_le->buflen = cpu_to_le32(len);
4893 err = brcmf_exec_dcmd(ndev, BRCMF_C_SCAN_RESULTS, 4892 err = brcmf_exec_dcmd(ndev, BRCMF_C_SCAN_RESULTS,
4894 cfg_priv->scan_results, len); 4893 cfg->scan_results, len);
4895 if (err) { 4894 if (err) {
4896 WL_ERR("%s Scan_results error (%d)\n", ndev->name, err); 4895 WL_ERR("%s Scan_results error (%d)\n", ndev->name, err);
4897 err = -EINVAL; 4896 err = -EINVAL;
4898 scan_abort = true; 4897 scan_abort = true;
4899 goto scan_done_out; 4898 goto scan_done_out;
4900 } 4899 }
4901 cfg_priv->scan_results->buflen = le32_to_cpu(bss_list_le->buflen); 4900 cfg->scan_results->buflen = le32_to_cpu(bss_list_le->buflen);
4902 cfg_priv->scan_results->version = le32_to_cpu(bss_list_le->version); 4901 cfg->scan_results->version = le32_to_cpu(bss_list_le->version);
4903 cfg_priv->scan_results->count = le32_to_cpu(bss_list_le->count); 4902 cfg->scan_results->count = le32_to_cpu(bss_list_le->count);
4904 4903
4905 err = brcmf_inform_bss(cfg_priv); 4904 err = brcmf_inform_bss(cfg);
4906 if (err) 4905 if (err)
4907 scan_abort = true; 4906 scan_abort = true;
4908 4907
4909scan_done_out: 4908scan_done_out:
4910 if (cfg_priv->scan_request) { 4909 if (cfg->scan_request) {
4911 WL_SCAN("calling cfg80211_scan_done\n"); 4910 WL_SCAN("calling cfg80211_scan_done\n");
4912 cfg80211_scan_done(cfg_priv->scan_request, scan_abort); 4911 cfg80211_scan_done(cfg->scan_request, scan_abort);
4913 brcmf_set_mpc(ndev, 1); 4912 brcmf_set_mpc(ndev, 1);
4914 cfg_priv->scan_request = NULL; 4913 cfg->scan_request = NULL;
4915 } 4914 }
4916 4915
4917 WL_TRACE("Exit\n"); 4916 WL_TRACE("Exit\n");
@@ -4945,74 +4944,74 @@ static void brcmf_init_eloop_handler(struct brcmf_cfg80211_event_loop *el)
4945 el->handler[BRCMF_E_PFN_NET_FOUND] = brcmf_notify_sched_scan_results; 4944 el->handler[BRCMF_E_PFN_NET_FOUND] = brcmf_notify_sched_scan_results;
4946} 4945}
4947 4946
4948static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_priv *cfg_priv) 4947static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_info *cfg)
4949{ 4948{
4950 kfree(cfg_priv->scan_results); 4949 kfree(cfg->scan_results);
4951 cfg_priv->scan_results = NULL; 4950 cfg->scan_results = NULL;
4952 kfree(cfg_priv->bss_info); 4951 kfree(cfg->bss_info);
4953 cfg_priv->bss_info = NULL; 4952 cfg->bss_info = NULL;
4954 kfree(cfg_priv->conf); 4953 kfree(cfg->conf);
4955 cfg_priv->conf = NULL; 4954 cfg->conf = NULL;
4956 kfree(cfg_priv->profile); 4955 kfree(cfg->profile);
4957 cfg_priv->profile = NULL; 4956 cfg->profile = NULL;
4958 kfree(cfg_priv->scan_req_int); 4957 kfree(cfg->scan_req_int);
4959 cfg_priv->scan_req_int = NULL; 4958 cfg->scan_req_int = NULL;
4960 kfree(cfg_priv->escan_ioctl_buf); 4959 kfree(cfg->escan_ioctl_buf);
4961 cfg_priv->escan_ioctl_buf = NULL; 4960 cfg->escan_ioctl_buf = NULL;
4962 kfree(cfg_priv->dcmd_buf); 4961 kfree(cfg->dcmd_buf);
4963 cfg_priv->dcmd_buf = NULL; 4962 cfg->dcmd_buf = NULL;
4964 kfree(cfg_priv->extra_buf); 4963 kfree(cfg->extra_buf);
4965 cfg_priv->extra_buf = NULL; 4964 cfg->extra_buf = NULL;
4966 kfree(cfg_priv->iscan); 4965 kfree(cfg->iscan);
4967 cfg_priv->iscan = NULL; 4966 cfg->iscan = NULL;
4968 kfree(cfg_priv->pmk_list); 4967 kfree(cfg->pmk_list);
4969 cfg_priv->pmk_list = NULL; 4968 cfg->pmk_list = NULL;
4970 if (cfg_priv->ap_info) { 4969 if (cfg->ap_info) {
4971 kfree(cfg_priv->ap_info->wpa_ie); 4970 kfree(cfg->ap_info->wpa_ie);
4972 kfree(cfg_priv->ap_info->rsn_ie); 4971 kfree(cfg->ap_info->rsn_ie);
4973 kfree(cfg_priv->ap_info); 4972 kfree(cfg->ap_info);
4974 cfg_priv->ap_info = NULL; 4973 cfg->ap_info = NULL;
4975 } 4974 }
4976} 4975}
4977 4976
4978static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_priv *cfg_priv) 4977static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_info *cfg)
4979{ 4978{
4980 cfg_priv->scan_results = kzalloc(WL_SCAN_BUF_MAX, GFP_KERNEL); 4979 cfg->scan_results = kzalloc(WL_SCAN_BUF_MAX, GFP_KERNEL);
4981 if (!cfg_priv->scan_results) 4980 if (!cfg->scan_results)
4982 goto init_priv_mem_out; 4981 goto init_priv_mem_out;
4983 cfg_priv->conf = kzalloc(sizeof(*cfg_priv->conf), GFP_KERNEL); 4982 cfg->conf = kzalloc(sizeof(*cfg->conf), GFP_KERNEL);
4984 if (!cfg_priv->conf) 4983 if (!cfg->conf)
4985 goto init_priv_mem_out; 4984 goto init_priv_mem_out;
4986 cfg_priv->profile = kzalloc(sizeof(*cfg_priv->profile), GFP_KERNEL); 4985 cfg->profile = kzalloc(sizeof(*cfg->profile), GFP_KERNEL);
4987 if (!cfg_priv->profile) 4986 if (!cfg->profile)
4988 goto init_priv_mem_out; 4987 goto init_priv_mem_out;
4989 cfg_priv->bss_info = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); 4988 cfg->bss_info = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
4990 if (!cfg_priv->bss_info) 4989 if (!cfg->bss_info)
4991 goto init_priv_mem_out; 4990 goto init_priv_mem_out;
4992 cfg_priv->scan_req_int = kzalloc(sizeof(*cfg_priv->scan_req_int), 4991 cfg->scan_req_int = kzalloc(sizeof(*cfg->scan_req_int),
4993 GFP_KERNEL); 4992 GFP_KERNEL);
4994 if (!cfg_priv->scan_req_int) 4993 if (!cfg->scan_req_int)
4995 goto init_priv_mem_out; 4994 goto init_priv_mem_out;
4996 cfg_priv->escan_ioctl_buf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL); 4995 cfg->escan_ioctl_buf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL);
4997 if (!cfg_priv->escan_ioctl_buf) 4996 if (!cfg->escan_ioctl_buf)
4998 goto init_priv_mem_out; 4997 goto init_priv_mem_out;
4999 cfg_priv->dcmd_buf = kzalloc(WL_DCMD_LEN_MAX, GFP_KERNEL); 4998 cfg->dcmd_buf = kzalloc(WL_DCMD_LEN_MAX, GFP_KERNEL);
5000 if (!cfg_priv->dcmd_buf) 4999 if (!cfg->dcmd_buf)
5001 goto init_priv_mem_out; 5000 goto init_priv_mem_out;
5002 cfg_priv->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); 5001 cfg->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
5003 if (!cfg_priv->extra_buf) 5002 if (!cfg->extra_buf)
5004 goto init_priv_mem_out; 5003 goto init_priv_mem_out;
5005 cfg_priv->iscan = kzalloc(sizeof(*cfg_priv->iscan), GFP_KERNEL); 5004 cfg->iscan = kzalloc(sizeof(*cfg->iscan), GFP_KERNEL);
5006 if (!cfg_priv->iscan) 5005 if (!cfg->iscan)
5007 goto init_priv_mem_out; 5006 goto init_priv_mem_out;
5008 cfg_priv->pmk_list = kzalloc(sizeof(*cfg_priv->pmk_list), GFP_KERNEL); 5007 cfg->pmk_list = kzalloc(sizeof(*cfg->pmk_list), GFP_KERNEL);
5009 if (!cfg_priv->pmk_list) 5008 if (!cfg->pmk_list)
5010 goto init_priv_mem_out; 5009 goto init_priv_mem_out;
5011 5010
5012 return 0; 5011 return 0;
5013 5012
5014init_priv_mem_out: 5013init_priv_mem_out:
5015 brcmf_deinit_priv_mem(cfg_priv); 5014 brcmf_deinit_priv_mem(cfg);
5016 5015
5017 return -ENOMEM; 5016 return -ENOMEM;
5018} 5017}
@@ -5022,17 +5021,17 @@ init_priv_mem_out:
5022*/ 5021*/
5023 5022
5024static struct brcmf_cfg80211_event_q *brcmf_deq_event( 5023static struct brcmf_cfg80211_event_q *brcmf_deq_event(
5025 struct brcmf_cfg80211_priv *cfg_priv) 5024 struct brcmf_cfg80211_info *cfg)
5026{ 5025{
5027 struct brcmf_cfg80211_event_q *e = NULL; 5026 struct brcmf_cfg80211_event_q *e = NULL;
5028 5027
5029 spin_lock_irq(&cfg_priv->evt_q_lock); 5028 spin_lock_irq(&cfg->evt_q_lock);
5030 if (!list_empty(&cfg_priv->evt_q_list)) { 5029 if (!list_empty(&cfg->evt_q_list)) {
5031 e = list_first_entry(&cfg_priv->evt_q_list, 5030 e = list_first_entry(&cfg->evt_q_list,
5032 struct brcmf_cfg80211_event_q, evt_q_list); 5031 struct brcmf_cfg80211_event_q, evt_q_list);
5033 list_del(&e->evt_q_list); 5032 list_del(&e->evt_q_list);
5034 } 5033 }
5035 spin_unlock_irq(&cfg_priv->evt_q_lock); 5034 spin_unlock_irq(&cfg->evt_q_lock);
5036 5035
5037 return e; 5036 return e;
5038} 5037}
@@ -5044,7 +5043,7 @@ static struct brcmf_cfg80211_event_q *brcmf_deq_event(
5044*/ 5043*/
5045 5044
5046static s32 5045static s32
5047brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 event, 5046brcmf_enq_event(struct brcmf_cfg80211_info *cfg, u32 event,
5048 const struct brcmf_event_msg *msg, void *data) 5047 const struct brcmf_event_msg *msg, void *data)
5049{ 5048{
5050 struct brcmf_cfg80211_event_q *e; 5049 struct brcmf_cfg80211_event_q *e;
@@ -5068,9 +5067,9 @@ brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 event,
5068 if (data) 5067 if (data)
5069 memcpy(&e->edata, data, data_len); 5068 memcpy(&e->edata, data, data_len);
5070 5069
5071 spin_lock_irqsave(&cfg_priv->evt_q_lock, flags); 5070 spin_lock_irqsave(&cfg->evt_q_lock, flags);
5072 list_add_tail(&e->evt_q_list, &cfg_priv->evt_q_list); 5071 list_add_tail(&e->evt_q_list, &cfg->evt_q_list);
5073 spin_unlock_irqrestore(&cfg_priv->evt_q_lock, flags); 5072 spin_unlock_irqrestore(&cfg->evt_q_lock, flags);
5074 5073
5075 return err; 5074 return err;
5076} 5075}
@@ -5082,12 +5081,12 @@ static void brcmf_put_event(struct brcmf_cfg80211_event_q *e)
5082 5081
5083static void brcmf_cfg80211_event_handler(struct work_struct *work) 5082static void brcmf_cfg80211_event_handler(struct work_struct *work)
5084{ 5083{
5085 struct brcmf_cfg80211_priv *cfg_priv = 5084 struct brcmf_cfg80211_info *cfg =
5086 container_of(work, struct brcmf_cfg80211_priv, 5085 container_of(work, struct brcmf_cfg80211_info,
5087 event_work); 5086 event_work);
5088 struct brcmf_cfg80211_event_q *e; 5087 struct brcmf_cfg80211_event_q *e;
5089 5088
5090 e = brcmf_deq_event(cfg_priv); 5089 e = brcmf_deq_event(cfg);
5091 if (unlikely(!e)) { 5090 if (unlikely(!e)) {
5092 WL_ERR("event queue empty...\n"); 5091 WL_ERR("event queue empty...\n");
5093 return; 5092 return;
@@ -5095,95 +5094,95 @@ static void brcmf_cfg80211_event_handler(struct work_struct *work)
5095 5094
5096 do { 5095 do {
5097 WL_INFO("event type (%d)\n", e->etype); 5096 WL_INFO("event type (%d)\n", e->etype);
5098 if (cfg_priv->el.handler[e->etype]) 5097 if (cfg->el.handler[e->etype])
5099 cfg_priv->el.handler[e->etype](cfg_priv, 5098 cfg->el.handler[e->etype](cfg,
5100 cfg_to_ndev(cfg_priv), 5099 cfg_to_ndev(cfg),
5101 &e->emsg, e->edata); 5100 &e->emsg, e->edata);
5102 else 5101 else
5103 WL_INFO("Unknown Event (%d): ignoring\n", e->etype); 5102 WL_INFO("Unknown Event (%d): ignoring\n", e->etype);
5104 brcmf_put_event(e); 5103 brcmf_put_event(e);
5105 } while ((e = brcmf_deq_event(cfg_priv))); 5104 } while ((e = brcmf_deq_event(cfg)));
5106 5105
5107} 5106}
5108 5107
5109static void brcmf_init_eq(struct brcmf_cfg80211_priv *cfg_priv) 5108static void brcmf_init_eq(struct brcmf_cfg80211_info *cfg)
5110{ 5109{
5111 spin_lock_init(&cfg_priv->evt_q_lock); 5110 spin_lock_init(&cfg->evt_q_lock);
5112 INIT_LIST_HEAD(&cfg_priv->evt_q_list); 5111 INIT_LIST_HEAD(&cfg->evt_q_list);
5113} 5112}
5114 5113
5115static void brcmf_flush_eq(struct brcmf_cfg80211_priv *cfg_priv) 5114static void brcmf_flush_eq(struct brcmf_cfg80211_info *cfg)
5116{ 5115{
5117 struct brcmf_cfg80211_event_q *e; 5116 struct brcmf_cfg80211_event_q *e;
5118 5117
5119 spin_lock_irq(&cfg_priv->evt_q_lock); 5118 spin_lock_irq(&cfg->evt_q_lock);
5120 while (!list_empty(&cfg_priv->evt_q_list)) { 5119 while (!list_empty(&cfg->evt_q_list)) {
5121 e = list_first_entry(&cfg_priv->evt_q_list, 5120 e = list_first_entry(&cfg->evt_q_list,
5122 struct brcmf_cfg80211_event_q, evt_q_list); 5121 struct brcmf_cfg80211_event_q, evt_q_list);
5123 list_del(&e->evt_q_list); 5122 list_del(&e->evt_q_list);
5124 kfree(e); 5123 kfree(e);
5125 } 5124 }
5126 spin_unlock_irq(&cfg_priv->evt_q_lock); 5125 spin_unlock_irq(&cfg->evt_q_lock);
5127} 5126}
5128 5127
5129static s32 wl_init_priv(struct brcmf_cfg80211_priv *cfg_priv) 5128static s32 wl_init_priv(struct brcmf_cfg80211_info *cfg)
5130{ 5129{
5131 s32 err = 0; 5130 s32 err = 0;
5132 5131
5133 cfg_priv->scan_request = NULL; 5132 cfg->scan_request = NULL;
5134 cfg_priv->pwr_save = true; 5133 cfg->pwr_save = true;
5135#ifdef CONFIG_BRCMISCAN 5134#ifdef CONFIG_BRCMISCAN
5136 cfg_priv->iscan_on = true; /* iscan on & off switch. 5135 cfg->iscan_on = true; /* iscan on & off switch.
5137 we enable iscan per default */ 5136 we enable iscan per default */
5138 cfg_priv->escan_on = false; /* escan on & off switch. 5137 cfg->escan_on = false; /* escan on & off switch.
5139 we disable escan per default */ 5138 we disable escan per default */
5140#else 5139#else
5141 cfg_priv->iscan_on = false; /* iscan on & off switch. 5140 cfg->iscan_on = false; /* iscan on & off switch.
5142 we disable iscan per default */ 5141 we disable iscan per default */
5143 cfg_priv->escan_on = true; /* escan on & off switch. 5142 cfg->escan_on = true; /* escan on & off switch.
5144 we enable escan per default */ 5143 we enable escan per default */
5145#endif 5144#endif
5146 cfg_priv->roam_on = true; /* roam on & off switch. 5145 cfg->roam_on = true; /* roam on & off switch.
5147 we enable roam per default */ 5146 we enable roam per default */
5148 5147
5149 cfg_priv->iscan_kickstart = false; 5148 cfg->iscan_kickstart = false;
5150 cfg_priv->active_scan = true; /* we do active scan for 5149 cfg->active_scan = true; /* we do active scan for
5151 specific scan per default */ 5150 specific scan per default */
5152 cfg_priv->dongle_up = false; /* dongle is not up yet */ 5151 cfg->dongle_up = false; /* dongle is not up yet */
5153 brcmf_init_eq(cfg_priv); 5152 brcmf_init_eq(cfg);
5154 err = brcmf_init_priv_mem(cfg_priv); 5153 err = brcmf_init_priv_mem(cfg);
5155 if (err) 5154 if (err)
5156 return err; 5155 return err;
5157 INIT_WORK(&cfg_priv->event_work, brcmf_cfg80211_event_handler); 5156 INIT_WORK(&cfg->event_work, brcmf_cfg80211_event_handler);
5158 brcmf_init_eloop_handler(&cfg_priv->el); 5157 brcmf_init_eloop_handler(&cfg->el);
5159 mutex_init(&cfg_priv->usr_sync); 5158 mutex_init(&cfg->usr_sync);
5160 err = brcmf_init_iscan(cfg_priv); 5159 err = brcmf_init_iscan(cfg);
5161 if (err) 5160 if (err)
5162 return err; 5161 return err;
5163 brcmf_init_escan(cfg_priv); 5162 brcmf_init_escan(cfg);
5164 brcmf_init_conf(cfg_priv->conf); 5163 brcmf_init_conf(cfg->conf);
5165 brcmf_init_prof(cfg_priv->profile); 5164 brcmf_init_prof(cfg->profile);
5166 brcmf_link_down(cfg_priv); 5165 brcmf_link_down(cfg);
5167 5166
5168 return err; 5167 return err;
5169} 5168}
5170 5169
5171static void wl_deinit_priv(struct brcmf_cfg80211_priv *cfg_priv) 5170static void wl_deinit_priv(struct brcmf_cfg80211_info *cfg)
5172{ 5171{
5173 cancel_work_sync(&cfg_priv->event_work); 5172 cancel_work_sync(&cfg->event_work);
5174 cfg_priv->dongle_up = false; /* dongle down */ 5173 cfg->dongle_up = false; /* dongle down */
5175 brcmf_flush_eq(cfg_priv); 5174 brcmf_flush_eq(cfg);
5176 brcmf_link_down(cfg_priv); 5175 brcmf_link_down(cfg);
5177 brcmf_abort_scanning(cfg_priv); 5176 brcmf_abort_scanning(cfg);
5178 brcmf_deinit_priv_mem(cfg_priv); 5177 brcmf_deinit_priv_mem(cfg);
5179} 5178}
5180 5179
5181struct brcmf_cfg80211_priv *brcmf_cfg80211_attach(struct net_device *ndev, 5180struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct net_device *ndev,
5182 struct device *busdev, 5181 struct device *busdev,
5183 struct brcmf_pub *drvr) 5182 struct brcmf_pub *drvr)
5184{ 5183{
5185 struct wireless_dev *wdev; 5184 struct wireless_dev *wdev;
5186 struct brcmf_cfg80211_priv *cfg_priv; 5185 struct brcmf_cfg80211_info *cfg;
5187 s32 err = 0; 5186 s32 err = 0;
5188 5187
5189 if (!ndev) { 5188 if (!ndev) {
@@ -5197,29 +5196,29 @@ struct brcmf_cfg80211_priv *brcmf_cfg80211_attach(struct net_device *ndev,
5197 } 5196 }
5198 5197
5199 wdev->iftype = brcmf_mode_to_nl80211_iftype(WL_MODE_BSS); 5198 wdev->iftype = brcmf_mode_to_nl80211_iftype(WL_MODE_BSS);
5200 cfg_priv = wdev_to_cfg(wdev); 5199 cfg = wdev_to_cfg(wdev);
5201 cfg_priv->wdev = wdev; 5200 cfg->wdev = wdev;
5202 cfg_priv->pub = drvr; 5201 cfg->pub = drvr;
5203 ndev->ieee80211_ptr = wdev; 5202 ndev->ieee80211_ptr = wdev;
5204 SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); 5203 SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy));
5205 wdev->netdev = ndev; 5204 wdev->netdev = ndev;
5206 err = wl_init_priv(cfg_priv); 5205 err = wl_init_priv(cfg);
5207 if (err) { 5206 if (err) {
5208 WL_ERR("Failed to init iwm_priv (%d)\n", err); 5207 WL_ERR("Failed to init iwm_priv (%d)\n", err);
5209 goto cfg80211_attach_out; 5208 goto cfg80211_attach_out;
5210 } 5209 }
5211 5210
5212 return cfg_priv; 5211 return cfg;
5213 5212
5214cfg80211_attach_out: 5213cfg80211_attach_out:
5215 brcmf_free_wdev(cfg_priv); 5214 brcmf_free_wdev(cfg);
5216 return NULL; 5215 return NULL;
5217} 5216}
5218 5217
5219void brcmf_cfg80211_detach(struct brcmf_cfg80211_priv *cfg_priv) 5218void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg)
5220{ 5219{
5221 wl_deinit_priv(cfg_priv); 5220 wl_deinit_priv(cfg);
5222 brcmf_free_wdev(cfg_priv); 5221 brcmf_free_wdev(cfg);
5223} 5222}
5224 5223
5225void 5224void
@@ -5227,10 +5226,10 @@ brcmf_cfg80211_event(struct net_device *ndev,
5227 const struct brcmf_event_msg *e, void *data) 5226 const struct brcmf_event_msg *e, void *data)
5228{ 5227{
5229 u32 event_type = be32_to_cpu(e->event_type); 5228 u32 event_type = be32_to_cpu(e->event_type);
5230 struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); 5229 struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
5231 5230
5232 if (!brcmf_enq_event(cfg_priv, event_type, e, data)) 5231 if (!brcmf_enq_event(cfg, event_type, e, data))
5233 schedule_work(&cfg_priv->event_work); 5232 schedule_work(&cfg->event_work);
5234} 5233}
5235 5234
5236static s32 brcmf_dongle_mode(struct net_device *ndev, s32 iftype) 5235static s32 brcmf_dongle_mode(struct net_device *ndev, s32 iftype)
@@ -5426,14 +5425,14 @@ dongle_scantime_out:
5426 return err; 5425 return err;
5427} 5426}
5428 5427
5429static s32 wl_update_wiphybands(struct brcmf_cfg80211_priv *cfg_priv) 5428static s32 wl_update_wiphybands(struct brcmf_cfg80211_info *cfg)
5430{ 5429{
5431 struct wiphy *wiphy; 5430 struct wiphy *wiphy;
5432 s32 phy_list; 5431 s32 phy_list;
5433 s8 phy; 5432 s8 phy;
5434 s32 err = 0; 5433 s32 err = 0;
5435 5434
5436 err = brcmf_exec_dcmd(cfg_to_ndev(cfg_priv), BRCM_GET_PHYLIST, 5435 err = brcmf_exec_dcmd(cfg_to_ndev(cfg), BRCM_GET_PHYLIST,
5437 &phy_list, sizeof(phy_list)); 5436 &phy_list, sizeof(phy_list));
5438 if (err) { 5437 if (err) {
5439 WL_ERR("error (%d)\n", err); 5438 WL_ERR("error (%d)\n", err);
@@ -5443,29 +5442,29 @@ static s32 wl_update_wiphybands(struct brcmf_cfg80211_priv *cfg_priv)
5443 phy = ((char *)&phy_list)[0]; 5442 phy = ((char *)&phy_list)[0];
5444 WL_INFO("%c phy\n", phy); 5443 WL_INFO("%c phy\n", phy);
5445 if (phy == 'n' || phy == 'a') { 5444 if (phy == 'n' || phy == 'a') {
5446 wiphy = cfg_to_wiphy(cfg_priv); 5445 wiphy = cfg_to_wiphy(cfg);
5447 wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n; 5446 wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
5448 } 5447 }
5449 5448
5450 return err; 5449 return err;
5451} 5450}
5452 5451
5453static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_priv *cfg_priv) 5452static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_info *cfg)
5454{ 5453{
5455 return wl_update_wiphybands(cfg_priv); 5454 return wl_update_wiphybands(cfg);
5456} 5455}
5457 5456
5458static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv) 5457static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
5459{ 5458{
5460 struct net_device *ndev; 5459 struct net_device *ndev;
5461 struct wireless_dev *wdev; 5460 struct wireless_dev *wdev;
5462 s32 power_mode; 5461 s32 power_mode;
5463 s32 err = 0; 5462 s32 err = 0;
5464 5463
5465 if (cfg_priv->dongle_up) 5464 if (cfg->dongle_up)
5466 return err; 5465 return err;
5467 5466
5468 ndev = cfg_to_ndev(cfg_priv); 5467 ndev = cfg_to_ndev(cfg);
5469 wdev = ndev->ieee80211_ptr; 5468 wdev = ndev->ieee80211_ptr;
5470 5469
5471 brcmf_dongle_scantime(ndev, WL_SCAN_CHANNEL_TIME, 5470 brcmf_dongle_scantime(ndev, WL_SCAN_CHANNEL_TIME,
@@ -5475,21 +5474,21 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv)
5475 if (err) 5474 if (err)
5476 goto default_conf_out; 5475 goto default_conf_out;
5477 5476
5478 power_mode = cfg_priv->pwr_save ? PM_FAST : PM_OFF; 5477 power_mode = cfg->pwr_save ? PM_FAST : PM_OFF;
5479 err = brcmf_exec_dcmd_u32(ndev, BRCMF_C_SET_PM, &power_mode); 5478 err = brcmf_exec_dcmd_u32(ndev, BRCMF_C_SET_PM, &power_mode);
5480 if (err) 5479 if (err)
5481 goto default_conf_out; 5480 goto default_conf_out;
5482 WL_INFO("power save set to %s\n", 5481 WL_INFO("power save set to %s\n",
5483 (power_mode ? "enabled" : "disabled")); 5482 (power_mode ? "enabled" : "disabled"));
5484 5483
5485 err = brcmf_dongle_roam(ndev, (cfg_priv->roam_on ? 0 : 1), 5484 err = brcmf_dongle_roam(ndev, (cfg->roam_on ? 0 : 1),
5486 WL_BEACON_TIMEOUT); 5485 WL_BEACON_TIMEOUT);
5487 if (err) 5486 if (err)
5488 goto default_conf_out; 5487 goto default_conf_out;
5489 err = brcmf_dongle_mode(ndev, wdev->iftype); 5488 err = brcmf_dongle_mode(ndev, wdev->iftype);
5490 if (err && err != -EINPROGRESS) 5489 if (err && err != -EINPROGRESS)
5491 goto default_conf_out; 5490 goto default_conf_out;
5492 err = brcmf_dongle_probecap(cfg_priv); 5491 err = brcmf_dongle_probecap(cfg);
5493 if (err) 5492 if (err)
5494 goto default_conf_out; 5493 goto default_conf_out;
5495 5494
@@ -5497,31 +5496,31 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv)
5497 5496
5498default_conf_out: 5497default_conf_out:
5499 5498
5500 cfg_priv->dongle_up = true; 5499 cfg->dongle_up = true;
5501 5500
5502 return err; 5501 return err;
5503 5502
5504} 5503}
5505 5504
5506static int brcmf_debugfs_add_netdev_params(struct brcmf_cfg80211_priv *cfg_priv) 5505static int brcmf_debugfs_add_netdev_params(struct brcmf_cfg80211_info *cfg)
5507{ 5506{
5508 char buf[10+IFNAMSIZ]; 5507 char buf[10+IFNAMSIZ];
5509 struct dentry *fd; 5508 struct dentry *fd;
5510 s32 err = 0; 5509 s32 err = 0;
5511 5510
5512 sprintf(buf, "netdev:%s", cfg_to_ndev(cfg_priv)->name); 5511 sprintf(buf, "netdev:%s", cfg_to_ndev(cfg)->name);
5513 cfg_priv->debugfsdir = debugfs_create_dir(buf, 5512 cfg->debugfsdir = debugfs_create_dir(buf,
5514 cfg_to_wiphy(cfg_priv)->debugfsdir); 5513 cfg_to_wiphy(cfg)->debugfsdir);
5515 5514
5516 fd = debugfs_create_u16("beacon_int", S_IRUGO, cfg_priv->debugfsdir, 5515 fd = debugfs_create_u16("beacon_int", S_IRUGO, cfg->debugfsdir,
5517 (u16 *)&cfg_priv->profile->beacon_interval); 5516 (u16 *)&cfg->profile->beacon_interval);
5518 if (!fd) { 5517 if (!fd) {
5519 err = -ENOMEM; 5518 err = -ENOMEM;
5520 goto err_out; 5519 goto err_out;
5521 } 5520 }
5522 5521
5523 fd = debugfs_create_u8("dtim_period", S_IRUGO, cfg_priv->debugfsdir, 5522 fd = debugfs_create_u8("dtim_period", S_IRUGO, cfg->debugfsdir,
5524 (u8 *)&cfg_priv->profile->dtim_period); 5523 (u8 *)&cfg->profile->dtim_period);
5525 if (!fd) { 5524 if (!fd) {
5526 err = -ENOMEM; 5525 err = -ENOMEM;
5527 goto err_out; 5526 goto err_out;
@@ -5531,40 +5530,40 @@ err_out:
5531 return err; 5530 return err;
5532} 5531}
5533 5532
5534static void brcmf_debugfs_remove_netdev(struct brcmf_cfg80211_priv *cfg_priv) 5533static void brcmf_debugfs_remove_netdev(struct brcmf_cfg80211_info *cfg)
5535{ 5534{
5536 debugfs_remove_recursive(cfg_priv->debugfsdir); 5535 debugfs_remove_recursive(cfg->debugfsdir);
5537 cfg_priv->debugfsdir = NULL; 5536 cfg->debugfsdir = NULL;
5538} 5537}
5539 5538
5540static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv) 5539static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_info *cfg)
5541{ 5540{
5542 s32 err = 0; 5541 s32 err = 0;
5543 5542
5544 set_bit(WL_STATUS_READY, &cfg_priv->status); 5543 set_bit(WL_STATUS_READY, &cfg->status);
5545 5544
5546 brcmf_debugfs_add_netdev_params(cfg_priv); 5545 brcmf_debugfs_add_netdev_params(cfg);
5547 5546
5548 err = brcmf_config_dongle(cfg_priv); 5547 err = brcmf_config_dongle(cfg);
5549 if (err) 5548 if (err)
5550 return err; 5549 return err;
5551 5550
5552 brcmf_invoke_iscan(cfg_priv); 5551 brcmf_invoke_iscan(cfg);
5553 5552
5554 return err; 5553 return err;
5555} 5554}
5556 5555
5557static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv) 5556static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_info *cfg)
5558{ 5557{
5559 /* 5558 /*
5560 * While going down, if associated with AP disassociate 5559 * While going down, if associated with AP disassociate
5561 * from AP to save power 5560 * from AP to save power
5562 */ 5561 */
5563 if ((test_bit(WL_STATUS_CONNECTED, &cfg_priv->status) || 5562 if ((test_bit(WL_STATUS_CONNECTED, &cfg->status) ||
5564 test_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) && 5563 test_bit(WL_STATUS_CONNECTING, &cfg->status)) &&
5565 test_bit(WL_STATUS_READY, &cfg_priv->status)) { 5564 test_bit(WL_STATUS_READY, &cfg->status)) {
5566 WL_INFO("Disassociating from AP"); 5565 WL_INFO("Disassociating from AP");
5567 brcmf_link_down(cfg_priv); 5566 brcmf_link_down(cfg);
5568 5567
5569 /* Make sure WPA_Supplicant receives all the event 5568 /* Make sure WPA_Supplicant receives all the event
5570 generated due to DISASSOC call to the fw to keep 5569 generated due to DISASSOC call to the fw to keep
@@ -5573,32 +5572,32 @@ static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv)
5573 brcmf_delay(500); 5572 brcmf_delay(500);
5574 } 5573 }
5575 5574
5576 brcmf_abort_scanning(cfg_priv); 5575 brcmf_abort_scanning(cfg);
5577 clear_bit(WL_STATUS_READY, &cfg_priv->status); 5576 clear_bit(WL_STATUS_READY, &cfg->status);
5578 5577
5579 brcmf_debugfs_remove_netdev(cfg_priv); 5578 brcmf_debugfs_remove_netdev(cfg);
5580 5579
5581 return 0; 5580 return 0;
5582} 5581}
5583 5582
5584s32 brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv) 5583s32 brcmf_cfg80211_up(struct brcmf_cfg80211_info *cfg)
5585{ 5584{
5586 s32 err = 0; 5585 s32 err = 0;
5587 5586
5588 mutex_lock(&cfg_priv->usr_sync); 5587 mutex_lock(&cfg->usr_sync);
5589 err = __brcmf_cfg80211_up(cfg_priv); 5588 err = __brcmf_cfg80211_up(cfg);
5590 mutex_unlock(&cfg_priv->usr_sync); 5589 mutex_unlock(&cfg->usr_sync);
5591 5590
5592 return err; 5591 return err;
5593} 5592}
5594 5593
5595s32 brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv) 5594s32 brcmf_cfg80211_down(struct brcmf_cfg80211_info *cfg)
5596{ 5595{
5597 s32 err = 0; 5596 s32 err = 0;
5598 5597
5599 mutex_lock(&cfg_priv->usr_sync); 5598 mutex_lock(&cfg->usr_sync);
5600 err = __brcmf_cfg80211_down(cfg_priv); 5599 err = __brcmf_cfg80211_down(cfg);
5601 mutex_unlock(&cfg_priv->usr_sync); 5600 mutex_unlock(&cfg->usr_sync);
5602 5601
5603 return err; 5602 return err;
5604} 5603}
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
index 374680072c16..71ced174748a 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
@@ -176,11 +176,11 @@ struct brcmf_cfg80211_conf {
176}; 176};
177 177
178/* forward declaration */ 178/* forward declaration */
179struct brcmf_cfg80211_priv; 179struct brcmf_cfg80211_info;
180 180
181/* cfg80211 main event loop */ 181/* cfg80211 main event loop */
182struct brcmf_cfg80211_event_loop { 182struct brcmf_cfg80211_event_loop {
183 s32(*handler[BRCMF_E_LAST]) (struct brcmf_cfg80211_priv *cfg_priv, 183 s32(*handler[BRCMF_E_LAST]) (struct brcmf_cfg80211_info *cfg,
184 struct net_device *ndev, 184 struct net_device *ndev,
185 const struct brcmf_event_msg *e, 185 const struct brcmf_event_msg *e,
186 void *data); 186 void *data);
@@ -238,7 +238,7 @@ struct brcmf_cfg80211_profile {
238/* dongle iscan event loop */ 238/* dongle iscan event loop */
239struct brcmf_cfg80211_iscan_eloop { 239struct brcmf_cfg80211_iscan_eloop {
240 s32 (*handler[WL_SCAN_ERSULTS_LAST]) 240 s32 (*handler[WL_SCAN_ERSULTS_LAST])
241 (struct brcmf_cfg80211_priv *cfg_priv); 241 (struct brcmf_cfg80211_info *cfg);
242}; 242};
243 243
244/* dongle iscan controller */ 244/* dongle iscan controller */
@@ -381,7 +381,7 @@ struct brcmf_pno_scanresults_le {
381}; 381};
382 382
383/** 383/**
384 * struct brcmf_cfg80211_priv - dongle private data of cfg80211 interface 384 * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface
385 * 385 *
386 * @wdev: representing wl cfg80211 device. 386 * @wdev: representing wl cfg80211 device.
387 * @conf: dongle configuration. 387 * @conf: dongle configuration.
@@ -424,7 +424,7 @@ struct brcmf_pno_scanresults_le {
424 * @ap_info: host ap information. 424 * @ap_info: host ap information.
425 * @ci: used to link this structure to netdev private data. 425 * @ci: used to link this structure to netdev private data.
426 */ 426 */
427struct brcmf_cfg80211_priv { 427struct brcmf_cfg80211_info {
428 struct wireless_dev *wdev; 428 struct wireless_dev *wdev;
429 struct brcmf_cfg80211_conf *conf; 429 struct brcmf_cfg80211_conf *conf;
430 struct cfg80211_scan_request *scan_request; 430 struct cfg80211_scan_request *scan_request;
@@ -466,49 +466,49 @@ struct brcmf_cfg80211_priv {
466 struct ap_info *ap_info; 466 struct ap_info *ap_info;
467}; 467};
468 468
469static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_priv *w) 469static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *w)
470{ 470{
471 return w->wdev->wiphy; 471 return w->wdev->wiphy;
472} 472}
473 473
474static inline struct brcmf_cfg80211_priv *wiphy_to_cfg(struct wiphy *w) 474static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w)
475{ 475{
476 return (struct brcmf_cfg80211_priv *)(wiphy_priv(w)); 476 return (struct brcmf_cfg80211_info *)(wiphy_priv(w));
477} 477}
478 478
479static inline struct brcmf_cfg80211_priv *wdev_to_cfg(struct wireless_dev *wd) 479static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd)
480{ 480{
481 return (struct brcmf_cfg80211_priv *)(wdev_priv(wd)); 481 return (struct brcmf_cfg80211_info *)(wdev_priv(wd));
482} 482}
483 483
484static inline struct net_device *cfg_to_ndev(struct brcmf_cfg80211_priv *cfg) 484static inline struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg)
485{ 485{
486 return cfg->wdev->netdev; 486 return cfg->wdev->netdev;
487} 487}
488 488
489static inline struct brcmf_cfg80211_priv *ndev_to_cfg(struct net_device *ndev) 489static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev)
490{ 490{
491 return wdev_to_cfg(ndev->ieee80211_ptr); 491 return wdev_to_cfg(ndev->ieee80211_ptr);
492} 492}
493 493
494#define iscan_to_cfg(i) ((struct brcmf_cfg80211_priv *)(i->data)) 494#define iscan_to_cfg(i) ((struct brcmf_cfg80211_info *)(i->data))
495#define cfg_to_iscan(w) (w->iscan) 495#define cfg_to_iscan(w) (w->iscan)
496 496
497static inline struct 497static inline struct
498brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_priv *cfg) 498brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg)
499{ 499{
500 return &cfg->conn_info; 500 return &cfg->conn_info;
501} 501}
502 502
503struct brcmf_cfg80211_priv *brcmf_cfg80211_attach(struct net_device *ndev, 503struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct net_device *ndev,
504 struct device *busdev, 504 struct device *busdev,
505 struct brcmf_pub *drvr); 505 struct brcmf_pub *drvr);
506void brcmf_cfg80211_detach(struct brcmf_cfg80211_priv *cfg_priv); 506void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
507 507
508/* event handler from dongle */ 508/* event handler from dongle */
509void brcmf_cfg80211_event(struct net_device *ndev, 509void brcmf_cfg80211_event(struct net_device *ndev,
510 const struct brcmf_event_msg *e, void *data); 510 const struct brcmf_event_msg *e, void *data);
511s32 brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv); 511s32 brcmf_cfg80211_up(struct brcmf_cfg80211_info *cfg);
512s32 brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv); 512s32 brcmf_cfg80211_down(struct brcmf_cfg80211_info *cfg);
513 513
514#endif /* _wl_cfg80211_h_ */ 514#endif /* _wl_cfg80211_h_ */