提交 27a68fe3 编写于 作者: A Arend van Spriel 提交者: John W. Linville

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: NHante Meuleman <meuleman@broadcom.com>
Reviewed-by: NPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: NArend van Spriel <arend@broadcom.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 1a873342
...@@ -614,7 +614,7 @@ struct brcmf_pub { ...@@ -614,7 +614,7 @@ struct brcmf_pub {
/* Linkage ponters */ /* Linkage ponters */
struct brcmf_bus *bus_if; struct brcmf_bus *bus_if;
struct brcmf_proto *prot; struct brcmf_proto *prot;
struct brcmf_cfg80211_priv *config; struct brcmf_cfg80211_info *config;
struct device *dev; /* fullmac dongle device pointer */ struct device *dev; /* fullmac dongle device pointer */
/* Internal brcmf items */ /* Internal brcmf items */
......
...@@ -97,10 +97,10 @@ static u32 brcmf_dbg_level = WL_DBG_ERR; ...@@ -97,10 +97,10 @@ static u32 brcmf_dbg_level = WL_DBG_ERR;
static bool check_sys_up(struct wiphy *wiphy) static bool check_sys_up(struct wiphy *wiphy)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
if (!test_bit(WL_STATUS_READY, &cfg_priv->status)) { if (!test_bit(WL_STATUS_READY, &cfg->status)) {
WL_INFO("device is not ready : status (%d)\n", WL_INFO("device is not ready : status (%d)\n",
(int)cfg_priv->status); (int)cfg->status);
return false; return false;
} }
return true; return true;
...@@ -457,7 +457,7 @@ static void convert_key_from_CPU(struct brcmf_wsec_key *key, ...@@ -457,7 +457,7 @@ static void convert_key_from_CPU(struct brcmf_wsec_key *key,
} }
static int static int
send_key_to_dongle(struct brcmf_cfg80211_priv *cfg_priv, s32 bssidx, send_key_to_dongle(struct brcmf_cfg80211_info *cfg, s32 bssidx,
struct net_device *ndev, struct brcmf_wsec_key *key) struct net_device *ndev, struct brcmf_wsec_key *key)
{ {
int err; int err;
...@@ -467,7 +467,7 @@ send_key_to_dongle(struct brcmf_cfg80211_priv *cfg_priv, s32 bssidx, ...@@ -467,7 +467,7 @@ send_key_to_dongle(struct brcmf_cfg80211_priv *cfg_priv, s32 bssidx,
err = brcmf_dev_iovar_setbuf_bsscfg(ndev, "wsec_key", &key_le, err = brcmf_dev_iovar_setbuf_bsscfg(ndev, "wsec_key", &key_le,
sizeof(key_le), sizeof(key_le),
cfg_priv->extra_buf, cfg->extra_buf,
WL_EXTRA_BUF_MAX, bssidx); WL_EXTRA_BUF_MAX, bssidx);
if (err) if (err)
...@@ -480,7 +480,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, ...@@ -480,7 +480,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
enum nl80211_iftype type, u32 *flags, enum nl80211_iftype type, u32 *flags,
struct vif_params *params) struct vif_params *params)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
s32 infra = 0; s32 infra = 0;
s32 ap = 0; s32 ap = 0;
s32 err = 0; s32 err = 0;
...@@ -494,15 +494,15 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, ...@@ -494,15 +494,15 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
type); type);
return -EOPNOTSUPP; return -EOPNOTSUPP;
case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_ADHOC:
cfg_priv->conf->mode = WL_MODE_IBSS; cfg->conf->mode = WL_MODE_IBSS;
infra = 0; infra = 0;
break; break;
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
cfg_priv->conf->mode = WL_MODE_BSS; cfg->conf->mode = WL_MODE_BSS;
infra = 1; infra = 1;
break; break;
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
cfg_priv->conf->mode = WL_MODE_AP; cfg->conf->mode = WL_MODE_AP;
ap = 1; ap = 1;
break; break;
default: default:
...@@ -511,11 +511,11 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, ...@@ -511,11 +511,11 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
} }
if (ap) { if (ap) {
set_bit(WL_STATUS_AP_CREATING, &cfg_priv->status); set_bit(WL_STATUS_AP_CREATING, &cfg->status);
if (!cfg_priv->ap_info) if (!cfg->ap_info)
cfg_priv->ap_info = kzalloc(sizeof(*cfg_priv->ap_info), cfg->ap_info = kzalloc(sizeof(*cfg->ap_info),
GFP_KERNEL); GFP_KERNEL);
if (!cfg_priv->ap_info) { if (!cfg->ap_info) {
err = -ENOMEM; err = -ENOMEM;
goto done; goto done;
} }
...@@ -528,7 +528,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, ...@@ -528,7 +528,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
goto done; goto done;
} }
WL_INFO("IF Type = %s\n", WL_INFO("IF Type = %s\n",
(cfg_priv->conf->mode == WL_MODE_IBSS) ? (cfg->conf->mode == WL_MODE_IBSS) ?
"Adhoc" : "Infra"); "Adhoc" : "Infra");
} }
ndev->ieee80211_ptr->iftype = type; ndev->ieee80211_ptr->iftype = type;
...@@ -620,7 +620,7 @@ brcmf_dev_intvar_get_bsscfg(struct net_device *ndev, s8 *name, s32 *val, ...@@ -620,7 +620,7 @@ brcmf_dev_intvar_get_bsscfg(struct net_device *ndev, s8 *name, s32 *val,
* should return the ndev matching bssidx. * should return the ndev matching bssidx.
*/ */
static s32 static s32
brcmf_find_bssidx(struct brcmf_cfg80211_priv *cfg_priv, struct net_device *ndev) brcmf_find_bssidx(struct brcmf_cfg80211_info *cfg, struct net_device *ndev)
{ {
return 0; return 0;
} }
...@@ -628,9 +628,9 @@ brcmf_find_bssidx(struct brcmf_cfg80211_priv *cfg_priv, struct net_device *ndev) ...@@ -628,9 +628,9 @@ brcmf_find_bssidx(struct brcmf_cfg80211_priv *cfg_priv, struct net_device *ndev)
static void brcmf_set_mpc(struct net_device *ndev, int mpc) static void brcmf_set_mpc(struct net_device *ndev, int mpc)
{ {
s32 err = 0; s32 err = 0;
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
if (test_bit(WL_STATUS_READY, &cfg_priv->status)) { if (test_bit(WL_STATUS_READY, &cfg->status)) {
err = brcmf_dev_intvar_set(ndev, "mpc", mpc); err = brcmf_dev_intvar_set(ndev, "mpc", mpc);
if (err) { if (err) {
WL_ERR("fail to set mpc\n"); WL_ERR("fail to set mpc\n");
...@@ -714,10 +714,10 @@ brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan, ...@@ -714,10 +714,10 @@ brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan,
return err; return err;
} }
static s32 brcmf_do_iscan(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_do_iscan(struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg_priv); struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg);
struct net_device *ndev = cfg_to_ndev(cfg_priv); struct net_device *ndev = cfg_to_ndev(cfg);
struct brcmf_ssid ssid; struct brcmf_ssid ssid;
__le32 passive_scan; __le32 passive_scan;
s32 err = 0; s32 err = 0;
...@@ -727,19 +727,19 @@ static s32 brcmf_do_iscan(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -727,19 +727,19 @@ static s32 brcmf_do_iscan(struct brcmf_cfg80211_priv *cfg_priv)
iscan->state = WL_ISCAN_STATE_SCANING; iscan->state = WL_ISCAN_STATE_SCANING;
passive_scan = cfg_priv->active_scan ? 0 : cpu_to_le32(1); passive_scan = cfg->active_scan ? 0 : cpu_to_le32(1);
err = brcmf_exec_dcmd(cfg_to_ndev(cfg_priv), BRCMF_C_SET_PASSIVE_SCAN, err = brcmf_exec_dcmd(cfg_to_ndev(cfg), BRCMF_C_SET_PASSIVE_SCAN,
&passive_scan, sizeof(passive_scan)); &passive_scan, sizeof(passive_scan));
if (err) { if (err) {
WL_ERR("error (%d)\n", err); WL_ERR("error (%d)\n", err);
return err; return err;
} }
brcmf_set_mpc(ndev, 0); brcmf_set_mpc(ndev, 0);
cfg_priv->iscan_kickstart = true; cfg->iscan_kickstart = true;
err = brcmf_run_iscan(iscan, &ssid, BRCMF_SCAN_ACTION_START); err = brcmf_run_iscan(iscan, &ssid, BRCMF_SCAN_ACTION_START);
if (err) { if (err) {
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ndev, 1);
cfg_priv->iscan_kickstart = false; cfg->iscan_kickstart = false;
return err; return err;
} }
mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000); 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,27 +752,27 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_scan_request *request, struct cfg80211_scan_request *request,
struct cfg80211_ssid *this_ssid) struct cfg80211_ssid *this_ssid)
{ {
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
struct cfg80211_ssid *ssids; struct cfg80211_ssid *ssids;
struct brcmf_cfg80211_scan_req *sr = cfg_priv->scan_req_int; struct brcmf_cfg80211_scan_req *sr = cfg->scan_req_int;
__le32 passive_scan; __le32 passive_scan;
bool iscan_req; bool iscan_req;
bool spec_scan; bool spec_scan;
s32 err = 0; s32 err = 0;
u32 SSID_len; u32 SSID_len;
if (test_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { if (test_bit(WL_STATUS_SCANNING, &cfg->status)) {
WL_ERR("Scanning already : status (%lu)\n", cfg_priv->status); WL_ERR("Scanning already : status (%lu)\n", cfg->status);
return -EAGAIN; return -EAGAIN;
} }
if (test_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status)) { if (test_bit(WL_STATUS_SCAN_ABORTING, &cfg->status)) {
WL_ERR("Scanning being aborted : status (%lu)\n", WL_ERR("Scanning being aborted : status (%lu)\n",
cfg_priv->status); cfg->status);
return -EAGAIN; return -EAGAIN;
} }
if (test_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) { if (test_bit(WL_STATUS_CONNECTING, &cfg->status)) {
WL_ERR("Connecting : status (%lu)\n", WL_ERR("Connecting : status (%lu)\n",
cfg_priv->status); cfg->status);
return -EAGAIN; return -EAGAIN;
} }
...@@ -781,7 +781,7 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev, ...@@ -781,7 +781,7 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev,
if (request) { if (request) {
/* scan bss */ /* scan bss */
ssids = request->ssids; ssids = request->ssids;
if (cfg_priv->iscan_on && (!ssids || !ssids->ssid_len)) if (cfg->iscan_on && (!ssids || !ssids->ssid_len))
iscan_req = true; iscan_req = true;
} else { } else {
/* scan in ibss */ /* scan in ibss */
...@@ -789,10 +789,10 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev, ...@@ -789,10 +789,10 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev,
ssids = this_ssid; ssids = this_ssid;
} }
cfg_priv->scan_request = request; cfg->scan_request = request;
set_bit(WL_STATUS_SCANNING, &cfg_priv->status); set_bit(WL_STATUS_SCANNING, &cfg->status);
if (iscan_req) { if (iscan_req) {
err = brcmf_do_iscan(cfg_priv); err = brcmf_do_iscan(cfg);
if (!err) if (!err)
return err; return err;
else else
...@@ -811,7 +811,7 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev, ...@@ -811,7 +811,7 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev,
WL_SCAN("Broadcast scan\n"); WL_SCAN("Broadcast scan\n");
} }
passive_scan = cfg_priv->active_scan ? 0 : cpu_to_le32(1); passive_scan = cfg->active_scan ? 0 : cpu_to_le32(1);
err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_PASSIVE_SCAN, err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_PASSIVE_SCAN,
&passive_scan, sizeof(passive_scan)); &passive_scan, sizeof(passive_scan));
if (err) { if (err) {
...@@ -836,8 +836,8 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev, ...@@ -836,8 +836,8 @@ brcmf_cfg80211_iscan(struct wiphy *wiphy, struct net_device *ndev,
return 0; return 0;
scan_out: scan_out:
clear_bit(WL_STATUS_SCANNING, &cfg_priv->status); clear_bit(WL_STATUS_SCANNING, &cfg->status);
cfg_priv->scan_request = NULL; cfg->scan_request = NULL;
return err; return err;
} }
...@@ -942,7 +942,7 @@ static void brcmf_escan_prep(struct brcmf_scan_params_le *params_le, ...@@ -942,7 +942,7 @@ static void brcmf_escan_prep(struct brcmf_scan_params_le *params_le,
} }
static s32 static s32
brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv, brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, struct net_device *ndev,
bool aborted, bool fw_abort) bool aborted, bool fw_abort)
{ {
...@@ -954,11 +954,11 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -954,11 +954,11 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv,
/* clear scan request, because the FW abort can cause a second call */ /* clear scan request, because the FW abort can cause a second call */
/* to this functon and might cause a double cfg80211_scan_done */ /* to this functon and might cause a double cfg80211_scan_done */
scan_request = cfg_priv->scan_request; scan_request = cfg->scan_request;
cfg_priv->scan_request = NULL; cfg->scan_request = NULL;
if (timer_pending(&cfg_priv->escan_timeout)) if (timer_pending(&cfg->escan_timeout))
del_timer_sync(&cfg_priv->escan_timeout); del_timer_sync(&cfg->escan_timeout);
if (fw_abort) { if (fw_abort) {
/* Do a scan abort to stop the driver's scan engine */ /* 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,11 +984,11 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv,
* e-scan can be initiated by scheduled scan * e-scan can be initiated by scheduled scan
* which takes precedence. * which takes precedence.
*/ */
if (cfg_priv->sched_escan) { if (cfg->sched_escan) {
WL_SCAN("scheduled scan completed\n"); WL_SCAN("scheduled scan completed\n");
cfg_priv->sched_escan = false; cfg->sched_escan = false;
if (!aborted) if (!aborted)
cfg80211_sched_scan_results(cfg_to_wiphy(cfg_priv)); cfg80211_sched_scan_results(cfg_to_wiphy(cfg));
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ndev, 1);
} else if (scan_request) { } else if (scan_request) {
WL_SCAN("ESCAN Completed scan: %s\n", WL_SCAN("ESCAN Completed scan: %s\n",
...@@ -996,7 +996,7 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -996,7 +996,7 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv,
cfg80211_scan_done(scan_request, aborted); cfg80211_scan_done(scan_request, aborted);
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ndev, 1);
} }
if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg->status)) {
WL_ERR("Scan complete while device not scanning\n"); WL_ERR("Scan complete while device not scanning\n");
return -EPERM; return -EPERM;
} }
...@@ -1005,7 +1005,7 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -1005,7 +1005,7 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_priv *cfg_priv,
} }
static s32 static s32
brcmf_run_escan(struct brcmf_cfg80211_priv *cfg_priv, struct net_device *ndev, brcmf_run_escan(struct brcmf_cfg80211_info *cfg, struct net_device *ndev,
struct cfg80211_scan_request *request, u16 action) struct cfg80211_scan_request *request, u16 action)
{ {
s32 params_size = BRCMF_SCAN_PARAMS_FIXED_SIZE + 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,7 +1035,7 @@ brcmf_run_escan(struct brcmf_cfg80211_priv *cfg_priv, struct net_device *ndev,
params->sync_id = cpu_to_le16(0x1234); params->sync_id = cpu_to_le16(0x1234);
err = brcmf_dev_iovar_setbuf(ndev, "escan", params, params_size, err = brcmf_dev_iovar_setbuf(ndev, "escan", params, params_size,
cfg_priv->escan_ioctl_buf, BRCMF_DCMD_MEDLEN); cfg->escan_ioctl_buf, BRCMF_DCMD_MEDLEN);
if (err) { if (err) {
if (err == -EBUSY) if (err == -EBUSY)
WL_INFO("system busy : escan canceled\n"); WL_INFO("system busy : escan canceled\n");
...@@ -1049,7 +1049,7 @@ brcmf_run_escan(struct brcmf_cfg80211_priv *cfg_priv, struct net_device *ndev, ...@@ -1049,7 +1049,7 @@ brcmf_run_escan(struct brcmf_cfg80211_priv *cfg_priv, struct net_device *ndev,
} }
static s32 static s32
brcmf_do_escan(struct brcmf_cfg80211_priv *cfg_priv, struct wiphy *wiphy, brcmf_do_escan(struct brcmf_cfg80211_info *cfg, struct wiphy *wiphy,
struct net_device *ndev, struct cfg80211_scan_request *request) struct net_device *ndev, struct cfg80211_scan_request *request)
{ {
s32 err; s32 err;
...@@ -1057,10 +1057,10 @@ brcmf_do_escan(struct brcmf_cfg80211_priv *cfg_priv, struct wiphy *wiphy, ...@@ -1057,10 +1057,10 @@ brcmf_do_escan(struct brcmf_cfg80211_priv *cfg_priv, struct wiphy *wiphy,
struct brcmf_scan_results *results; struct brcmf_scan_results *results;
WL_SCAN("Enter\n"); WL_SCAN("Enter\n");
cfg_priv->escan_info.ndev = ndev; cfg->escan_info.ndev = ndev;
cfg_priv->escan_info.wiphy = wiphy; cfg->escan_info.wiphy = wiphy;
cfg_priv->escan_info.escan_state = WL_ESCAN_STATE_SCANNING; cfg->escan_info.escan_state = WL_ESCAN_STATE_SCANNING;
passive_scan = cfg_priv->active_scan ? 0 : cpu_to_le32(1); passive_scan = cfg->active_scan ? 0 : cpu_to_le32(1);
err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_PASSIVE_SCAN, err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_PASSIVE_SCAN,
&passive_scan, sizeof(passive_scan)); &passive_scan, sizeof(passive_scan));
if (err) { if (err) {
...@@ -1068,12 +1068,12 @@ brcmf_do_escan(struct brcmf_cfg80211_priv *cfg_priv, struct wiphy *wiphy, ...@@ -1068,12 +1068,12 @@ brcmf_do_escan(struct brcmf_cfg80211_priv *cfg_priv, struct wiphy *wiphy,
return err; return err;
} }
brcmf_set_mpc(ndev, 0); brcmf_set_mpc(ndev, 0);
results = (struct brcmf_scan_results *)cfg_priv->escan_info.escan_buf; results = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
results->version = 0; results->version = 0;
results->count = 0; results->count = 0;
results->buflen = WL_ESCAN_RESULTS_FIXED_SIZE; results->buflen = WL_ESCAN_RESULTS_FIXED_SIZE;
err = brcmf_run_escan(cfg_priv, ndev, request, WL_ESCAN_ACTION_START); err = brcmf_run_escan(cfg, ndev, request, WL_ESCAN_ACTION_START);
if (err) if (err)
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ndev, 1);
return err; return err;
...@@ -1084,9 +1084,9 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1084,9 +1084,9 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_scan_request *request, struct cfg80211_scan_request *request,
struct cfg80211_ssid *this_ssid) struct cfg80211_ssid *this_ssid)
{ {
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
struct cfg80211_ssid *ssids; struct cfg80211_ssid *ssids;
struct brcmf_cfg80211_scan_req *sr = cfg_priv->scan_req_int; struct brcmf_cfg80211_scan_req *sr = cfg->scan_req_int;
__le32 passive_scan; __le32 passive_scan;
bool escan_req; bool escan_req;
bool spec_scan; bool spec_scan;
...@@ -1095,23 +1095,23 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1095,23 +1095,23 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
WL_SCAN("START ESCAN\n"); WL_SCAN("START ESCAN\n");
if (test_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { if (test_bit(WL_STATUS_SCANNING, &cfg->status)) {
WL_ERR("Scanning already : status (%lu)\n", cfg_priv->status); WL_ERR("Scanning already : status (%lu)\n", cfg->status);
return -EAGAIN; return -EAGAIN;
} }
if (test_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status)) { if (test_bit(WL_STATUS_SCAN_ABORTING, &cfg->status)) {
WL_ERR("Scanning being aborted : status (%lu)\n", WL_ERR("Scanning being aborted : status (%lu)\n",
cfg_priv->status); cfg->status);
return -EAGAIN; return -EAGAIN;
} }
if (test_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) { if (test_bit(WL_STATUS_CONNECTING, &cfg->status)) {
WL_ERR("Connecting : status (%lu)\n", WL_ERR("Connecting : status (%lu)\n",
cfg_priv->status); cfg->status);
return -EAGAIN; return -EAGAIN;
} }
/* Arm scan timeout timer */ /* Arm scan timeout timer */
mod_timer(&cfg_priv->escan_timeout, jiffies + mod_timer(&cfg->escan_timeout, jiffies +
WL_ESCAN_TIMER_INTERVAL_MS * HZ / 1000); WL_ESCAN_TIMER_INTERVAL_MS * HZ / 1000);
escan_req = false; escan_req = false;
...@@ -1125,10 +1125,10 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1125,10 +1125,10 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
ssids = this_ssid; ssids = this_ssid;
} }
cfg_priv->scan_request = request; cfg->scan_request = request;
set_bit(WL_STATUS_SCANNING, &cfg_priv->status); set_bit(WL_STATUS_SCANNING, &cfg->status);
if (escan_req) { if (escan_req) {
err = brcmf_do_escan(cfg_priv, wiphy, ndev, request); err = brcmf_do_escan(cfg, wiphy, ndev, request);
if (!err) if (!err)
return err; return err;
else else
...@@ -1147,7 +1147,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1147,7 +1147,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
} else } else
WL_SCAN("Broadcast scan\n"); WL_SCAN("Broadcast scan\n");
passive_scan = cfg_priv->active_scan ? 0 : cpu_to_le32(1); passive_scan = cfg->active_scan ? 0 : cpu_to_le32(1);
err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_PASSIVE_SCAN, err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_PASSIVE_SCAN,
&passive_scan, sizeof(passive_scan)); &passive_scan, sizeof(passive_scan));
if (err) { if (err) {
...@@ -1172,10 +1172,10 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1172,10 +1172,10 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
return 0; return 0;
scan_out: scan_out:
clear_bit(WL_STATUS_SCANNING, &cfg_priv->status); clear_bit(WL_STATUS_SCANNING, &cfg->status);
if (timer_pending(&cfg_priv->escan_timeout)) if (timer_pending(&cfg->escan_timeout))
del_timer_sync(&cfg_priv->escan_timeout); del_timer_sync(&cfg->escan_timeout);
cfg_priv->scan_request = NULL; cfg->scan_request = NULL;
return err; return err;
} }
...@@ -1184,7 +1184,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, ...@@ -1184,7 +1184,7 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
struct cfg80211_scan_request *request) struct cfg80211_scan_request *request)
{ {
struct net_device *ndev = request->wdev->netdev; struct net_device *ndev = request->wdev->netdev;
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
s32 err = 0; s32 err = 0;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
...@@ -1192,9 +1192,9 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, ...@@ -1192,9 +1192,9 @@ brcmf_cfg80211_scan(struct wiphy *wiphy,
if (!check_sys_up(wiphy)) if (!check_sys_up(wiphy))
return -EIO; return -EIO;
if (cfg_priv->iscan_on) if (cfg->iscan_on)
err = brcmf_cfg80211_iscan(wiphy, ndev, request, NULL); err = brcmf_cfg80211_iscan(wiphy, ndev, request, NULL);
else if (cfg_priv->escan_on) else if (cfg->escan_on)
err = brcmf_cfg80211_escan(wiphy, ndev, request, NULL); err = brcmf_cfg80211_escan(wiphy, ndev, request, NULL);
if (err) if (err)
...@@ -1241,8 +1241,8 @@ static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l) ...@@ -1241,8 +1241,8 @@ static s32 brcmf_set_retry(struct net_device *ndev, u32 retry, bool l)
static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct net_device *ndev = cfg_to_ndev(cfg_priv); struct net_device *ndev = cfg_to_ndev(cfg);
s32 err = 0; s32 err = 0;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
...@@ -1250,30 +1250,30 @@ static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) ...@@ -1250,30 +1250,30 @@ static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
return -EIO; return -EIO;
if (changed & WIPHY_PARAM_RTS_THRESHOLD && if (changed & WIPHY_PARAM_RTS_THRESHOLD &&
(cfg_priv->conf->rts_threshold != wiphy->rts_threshold)) { (cfg->conf->rts_threshold != wiphy->rts_threshold)) {
cfg_priv->conf->rts_threshold = wiphy->rts_threshold; cfg->conf->rts_threshold = wiphy->rts_threshold;
err = brcmf_set_rts(ndev, cfg_priv->conf->rts_threshold); err = brcmf_set_rts(ndev, cfg->conf->rts_threshold);
if (!err) if (!err)
goto done; goto done;
} }
if (changed & WIPHY_PARAM_FRAG_THRESHOLD && if (changed & WIPHY_PARAM_FRAG_THRESHOLD &&
(cfg_priv->conf->frag_threshold != wiphy->frag_threshold)) { (cfg->conf->frag_threshold != wiphy->frag_threshold)) {
cfg_priv->conf->frag_threshold = wiphy->frag_threshold; cfg->conf->frag_threshold = wiphy->frag_threshold;
err = brcmf_set_frag(ndev, cfg_priv->conf->frag_threshold); err = brcmf_set_frag(ndev, cfg->conf->frag_threshold);
if (!err) if (!err)
goto done; goto done;
} }
if (changed & WIPHY_PARAM_RETRY_LONG if (changed & WIPHY_PARAM_RETRY_LONG
&& (cfg_priv->conf->retry_long != wiphy->retry_long)) { && (cfg->conf->retry_long != wiphy->retry_long)) {
cfg_priv->conf->retry_long = wiphy->retry_long; cfg->conf->retry_long = wiphy->retry_long;
err = brcmf_set_retry(ndev, cfg_priv->conf->retry_long, true); err = brcmf_set_retry(ndev, cfg->conf->retry_long, true);
if (!err) if (!err)
goto done; goto done;
} }
if (changed & WIPHY_PARAM_RETRY_SHORT if (changed & WIPHY_PARAM_RETRY_SHORT
&& (cfg_priv->conf->retry_short != wiphy->retry_short)) { && (cfg->conf->retry_short != wiphy->retry_short)) {
cfg_priv->conf->retry_short = wiphy->retry_short; cfg->conf->retry_short = wiphy->retry_short;
err = brcmf_set_retry(ndev, cfg_priv->conf->retry_short, false); err = brcmf_set_retry(ndev, cfg->conf->retry_short, false);
if (!err) if (!err)
goto done; goto done;
} }
...@@ -1283,22 +1283,22 @@ static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) ...@@ -1283,22 +1283,22 @@ static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
return err; return err;
} }
static void *brcmf_read_prof(struct brcmf_cfg80211_priv *cfg_priv, s32 item) static void *brcmf_read_prof(struct brcmf_cfg80211_info *cfg, s32 item)
{ {
switch (item) { switch (item) {
case WL_PROF_SEC: case WL_PROF_SEC:
return &cfg_priv->profile->sec; return &cfg->profile->sec;
case WL_PROF_BSSID: case WL_PROF_BSSID:
return &cfg_priv->profile->bssid; return &cfg->profile->bssid;
case WL_PROF_SSID: case WL_PROF_SSID:
return &cfg_priv->profile->ssid; return &cfg->profile->ssid;
} }
WL_ERR("invalid item (%d)\n", item); WL_ERR("invalid item (%d)\n", item);
return NULL; return NULL;
} }
static s32 static s32
brcmf_update_prof(struct brcmf_cfg80211_priv *cfg_priv, brcmf_update_prof(struct brcmf_cfg80211_info *cfg,
const struct brcmf_event_msg *e, void *data, s32 item) const struct brcmf_event_msg *e, void *data, s32 item)
{ {
s32 err = 0; s32 err = 0;
...@@ -1307,27 +1307,27 @@ brcmf_update_prof(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -1307,27 +1307,27 @@ brcmf_update_prof(struct brcmf_cfg80211_priv *cfg_priv,
switch (item) { switch (item) {
case WL_PROF_SSID: case WL_PROF_SSID:
ssid = (struct brcmf_ssid *) data; ssid = (struct brcmf_ssid *) data;
memset(cfg_priv->profile->ssid.SSID, 0, memset(cfg->profile->ssid.SSID, 0,
sizeof(cfg_priv->profile->ssid.SSID)); sizeof(cfg->profile->ssid.SSID));
memcpy(cfg_priv->profile->ssid.SSID, memcpy(cfg->profile->ssid.SSID,
ssid->SSID, ssid->SSID_len); ssid->SSID, ssid->SSID_len);
cfg_priv->profile->ssid.SSID_len = ssid->SSID_len; cfg->profile->ssid.SSID_len = ssid->SSID_len;
break; break;
case WL_PROF_BSSID: case WL_PROF_BSSID:
if (data) if (data)
memcpy(cfg_priv->profile->bssid, data, ETH_ALEN); memcpy(cfg->profile->bssid, data, ETH_ALEN);
else else
memset(cfg_priv->profile->bssid, 0, ETH_ALEN); memset(cfg->profile->bssid, 0, ETH_ALEN);
break; break;
case WL_PROF_SEC: case WL_PROF_SEC:
memcpy(&cfg_priv->profile->sec, data, memcpy(&cfg->profile->sec, data,
sizeof(cfg_priv->profile->sec)); sizeof(cfg->profile->sec));
break; break;
case WL_PROF_BEACONINT: case WL_PROF_BEACONINT:
cfg_priv->profile->beacon_interval = *(u16 *)data; cfg->profile->beacon_interval = *(u16 *)data;
break; break;
case WL_PROF_DTIMPERIOD: case WL_PROF_DTIMPERIOD:
cfg_priv->profile->dtim_period = *(u8 *)data; cfg->profile->dtim_period = *(u8 *)data;
break; break;
default: default:
WL_ERR("unsupported item (%d)\n", item); 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,20 +1370,20 @@ static void brcmf_ch_to_chanspec(int ch, struct brcmf_join_params *join_params,
} }
} }
static void brcmf_link_down(struct brcmf_cfg80211_priv *cfg_priv) static void brcmf_link_down(struct brcmf_cfg80211_info *cfg)
{ {
struct net_device *ndev = NULL; struct net_device *ndev = NULL;
s32 err = 0; s32 err = 0;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (cfg_priv->link_up) { if (cfg->link_up) {
ndev = cfg_to_ndev(cfg_priv); ndev = cfg_to_ndev(cfg);
WL_INFO("Call WLC_DISASSOC to stop excess roaming\n "); WL_INFO("Call WLC_DISASSOC to stop excess roaming\n ");
err = brcmf_exec_dcmd(ndev, BRCMF_C_DISASSOC, NULL, 0); err = brcmf_exec_dcmd(ndev, BRCMF_C_DISASSOC, NULL, 0);
if (err) if (err)
WL_ERR("WLC_DISASSOC failed (%d)\n", err); WL_ERR("WLC_DISASSOC failed (%d)\n", err);
cfg_priv->link_up = false; cfg->link_up = false;
} }
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
} }
...@@ -1392,7 +1392,7 @@ static s32 ...@@ -1392,7 +1392,7 @@ static s32
brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_ibss_params *params) struct cfg80211_ibss_params *params)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_join_params join_params; struct brcmf_join_params join_params;
size_t join_params_size = 0; size_t join_params_size = 0;
s32 err = 0; s32 err = 0;
...@@ -1411,7 +1411,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1411,7 +1411,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
set_bit(WL_STATUS_CONNECTING, &cfg_priv->status); set_bit(WL_STATUS_CONNECTING, &cfg->status);
if (params->bssid) if (params->bssid)
WL_CONN("BSSID: %pM\n", params->bssid); WL_CONN("BSSID: %pM\n", params->bssid);
...@@ -1479,7 +1479,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1479,7 +1479,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
memcpy(join_params.ssid_le.SSID, params->ssid, ssid.SSID_len); memcpy(join_params.ssid_le.SSID, params->ssid, ssid.SSID_len);
join_params.ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len); join_params.ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len);
join_params_size = sizeof(join_params.ssid_le); join_params_size = sizeof(join_params.ssid_le);
brcmf_update_prof(cfg_priv, NULL, &ssid, WL_PROF_SSID); brcmf_update_prof(cfg, NULL, &ssid, WL_PROF_SSID);
/* BSSID */ /* BSSID */
if (params->bssid) { if (params->bssid) {
...@@ -1490,24 +1490,24 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1490,24 +1490,24 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
memcpy(join_params.params_le.bssid, ether_bcast, ETH_ALEN); memcpy(join_params.params_le.bssid, ether_bcast, ETH_ALEN);
} }
brcmf_update_prof(cfg_priv, NULL, brcmf_update_prof(cfg, NULL,
&join_params.params_le.bssid, WL_PROF_BSSID); &join_params.params_le.bssid, WL_PROF_BSSID);
/* Channel */ /* Channel */
if (params->channel) { if (params->channel) {
u32 target_channel; u32 target_channel;
cfg_priv->channel = cfg->channel =
ieee80211_frequency_to_channel( ieee80211_frequency_to_channel(
params->channel->center_freq); params->channel->center_freq);
if (params->channel_fixed) { if (params->channel_fixed) {
/* adding chanspec */ /* adding chanspec */
brcmf_ch_to_chanspec(cfg_priv->channel, brcmf_ch_to_chanspec(cfg->channel,
&join_params, &join_params_size); &join_params, &join_params_size);
} }
/* set channel for starter */ /* set channel for starter */
target_channel = cfg_priv->channel; target_channel = cfg->channel;
err = brcmf_exec_dcmd_u32(ndev, BRCM_SET_CHANNEL, err = brcmf_exec_dcmd_u32(ndev, BRCM_SET_CHANNEL,
&target_channel); &target_channel);
if (err) { if (err) {
...@@ -1515,9 +1515,9 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1515,9 +1515,9 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
goto done; goto done;
} }
} else } else
cfg_priv->channel = 0; cfg->channel = 0;
cfg_priv->ibss_starter = false; cfg->ibss_starter = false;
err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_SSID, 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,7 +1529,7 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
done: done:
if (err) if (err)
clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status); clear_bit(WL_STATUS_CONNECTING, &cfg->status);
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
return err; return err;
} }
...@@ -1537,14 +1537,14 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1537,14 +1537,14 @@ brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *ndev,
static s32 static s32
brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
s32 err = 0; s32 err = 0;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (!check_sys_up(wiphy)) if (!check_sys_up(wiphy))
return -EIO; return -EIO;
brcmf_link_down(cfg_priv); brcmf_link_down(cfg);
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
...@@ -1554,7 +1554,7 @@ brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) ...@@ -1554,7 +1554,7 @@ brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
static s32 brcmf_set_wpa_version(struct net_device *ndev, static s32 brcmf_set_wpa_version(struct net_device *ndev,
struct cfg80211_connect_params *sme) struct cfg80211_connect_params *sme)
{ {
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
struct brcmf_cfg80211_security *sec; struct brcmf_cfg80211_security *sec;
s32 val = 0; s32 val = 0;
s32 err = 0; s32 err = 0;
...@@ -1571,7 +1571,7 @@ static s32 brcmf_set_wpa_version(struct net_device *ndev, ...@@ -1571,7 +1571,7 @@ static s32 brcmf_set_wpa_version(struct net_device *ndev,
WL_ERR("set wpa_auth failed (%d)\n", err); WL_ERR("set wpa_auth failed (%d)\n", err);
return err; return err;
} }
sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); sec = brcmf_read_prof(cfg, WL_PROF_SEC);
sec->wpa_versions = sme->crypto.wpa_versions; sec->wpa_versions = sme->crypto.wpa_versions;
return err; return err;
} }
...@@ -1579,7 +1579,7 @@ static s32 brcmf_set_wpa_version(struct net_device *ndev, ...@@ -1579,7 +1579,7 @@ static s32 brcmf_set_wpa_version(struct net_device *ndev,
static s32 brcmf_set_auth_type(struct net_device *ndev, static s32 brcmf_set_auth_type(struct net_device *ndev,
struct cfg80211_connect_params *sme) struct cfg80211_connect_params *sme)
{ {
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
struct brcmf_cfg80211_security *sec; struct brcmf_cfg80211_security *sec;
s32 val = 0; s32 val = 0;
s32 err = 0; s32 err = 0;
...@@ -1610,7 +1610,7 @@ static s32 brcmf_set_auth_type(struct net_device *ndev, ...@@ -1610,7 +1610,7 @@ static s32 brcmf_set_auth_type(struct net_device *ndev,
WL_ERR("set auth failed (%d)\n", err); WL_ERR("set auth failed (%d)\n", err);
return err; return err;
} }
sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); sec = brcmf_read_prof(cfg, WL_PROF_SEC);
sec->auth_type = sme->auth_type; sec->auth_type = sme->auth_type;
return err; return err;
} }
...@@ -1619,7 +1619,7 @@ static s32 ...@@ -1619,7 +1619,7 @@ static s32
brcmf_set_set_cipher(struct net_device *ndev, brcmf_set_set_cipher(struct net_device *ndev,
struct cfg80211_connect_params *sme) struct cfg80211_connect_params *sme)
{ {
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
struct brcmf_cfg80211_security *sec; struct brcmf_cfg80211_security *sec;
s32 pval = 0; s32 pval = 0;
s32 gval = 0; s32 gval = 0;
...@@ -1675,7 +1675,7 @@ brcmf_set_set_cipher(struct net_device *ndev, ...@@ -1675,7 +1675,7 @@ brcmf_set_set_cipher(struct net_device *ndev,
return err; return err;
} }
sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); sec = brcmf_read_prof(cfg, WL_PROF_SEC);
sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0]; sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0];
sec->cipher_group = sme->crypto.cipher_group; sec->cipher_group = sme->crypto.cipher_group;
...@@ -1685,7 +1685,7 @@ brcmf_set_set_cipher(struct net_device *ndev, ...@@ -1685,7 +1685,7 @@ brcmf_set_set_cipher(struct net_device *ndev,
static s32 static s32
brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme) brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
{ {
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
struct brcmf_cfg80211_security *sec; struct brcmf_cfg80211_security *sec;
s32 val = 0; s32 val = 0;
s32 err = 0; s32 err = 0;
...@@ -1731,7 +1731,7 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme) ...@@ -1731,7 +1731,7 @@ brcmf_set_key_mgmt(struct net_device *ndev, struct cfg80211_connect_params *sme)
return err; return err;
} }
} }
sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); sec = brcmf_read_prof(cfg, WL_PROF_SEC);
sec->wpa_auth = sme->crypto.akm_suites[0]; sec->wpa_auth = sme->crypto.akm_suites[0];
return err; return err;
...@@ -1741,7 +1741,7 @@ static s32 ...@@ -1741,7 +1741,7 @@ static s32
brcmf_set_sharedkey(struct net_device *ndev, brcmf_set_sharedkey(struct net_device *ndev,
struct cfg80211_connect_params *sme) struct cfg80211_connect_params *sme)
{ {
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
struct brcmf_cfg80211_security *sec; struct brcmf_cfg80211_security *sec;
struct brcmf_wsec_key key; struct brcmf_wsec_key key;
s32 val; s32 val;
...@@ -1753,7 +1753,7 @@ brcmf_set_sharedkey(struct net_device *ndev, ...@@ -1753,7 +1753,7 @@ brcmf_set_sharedkey(struct net_device *ndev,
if (sme->key_len == 0) if (sme->key_len == 0)
return 0; return 0;
sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); sec = brcmf_read_prof(cfg, WL_PROF_SEC);
WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n", WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n",
sec->wpa_versions, sec->cipher_pairwise); sec->wpa_versions, sec->cipher_pairwise);
...@@ -1789,8 +1789,8 @@ brcmf_set_sharedkey(struct net_device *ndev, ...@@ -1789,8 +1789,8 @@ brcmf_set_sharedkey(struct net_device *ndev,
WL_CONN("key length (%d) key index (%d) algo (%d)\n", WL_CONN("key length (%d) key index (%d) algo (%d)\n",
key.len, key.index, key.algo); key.len, key.index, key.algo);
WL_CONN("key \"%s\"\n", key.data); WL_CONN("key \"%s\"\n", key.data);
bssidx = brcmf_find_bssidx(cfg_priv, ndev); bssidx = brcmf_find_bssidx(cfg, ndev);
err = send_key_to_dongle(cfg_priv, bssidx, ndev, &key); err = send_key_to_dongle(cfg, bssidx, ndev, &key);
if (err) if (err)
return err; return err;
...@@ -1808,7 +1808,7 @@ static s32 ...@@ -1808,7 +1808,7 @@ static s32
brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_connect_params *sme) struct cfg80211_connect_params *sme)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct ieee80211_channel *chan = sme->channel; struct ieee80211_channel *chan = sme->channel;
struct brcmf_join_params join_params; struct brcmf_join_params join_params;
size_t join_params_size; size_t join_params_size;
...@@ -1825,15 +1825,15 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1825,15 +1825,15 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
set_bit(WL_STATUS_CONNECTING, &cfg_priv->status); set_bit(WL_STATUS_CONNECTING, &cfg->status);
if (chan) { if (chan) {
cfg_priv->channel = cfg->channel =
ieee80211_frequency_to_channel(chan->center_freq); ieee80211_frequency_to_channel(chan->center_freq);
WL_CONN("channel (%d), center_req (%d)\n", WL_CONN("channel (%d), center_req (%d)\n",
cfg_priv->channel, chan->center_freq); cfg->channel, chan->center_freq);
} else } else
cfg_priv->channel = 0; cfg->channel = 0;
WL_INFO("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len); WL_INFO("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len);
...@@ -1874,7 +1874,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1874,7 +1874,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid.SSID_len); memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid.SSID_len);
memcpy(&ssid.SSID, sme->ssid, ssid.SSID_len); memcpy(&ssid.SSID, sme->ssid, ssid.SSID_len);
join_params.ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len); join_params.ssid_le.SSID_len = cpu_to_le32(ssid.SSID_len);
brcmf_update_prof(cfg_priv, NULL, &ssid, WL_PROF_SSID); brcmf_update_prof(cfg, NULL, &ssid, WL_PROF_SSID);
memcpy(join_params.params_le.bssid, ether_bcast, ETH_ALEN); memcpy(join_params.params_le.bssid, ether_bcast, ETH_ALEN);
...@@ -1882,7 +1882,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1882,7 +1882,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
WL_CONN("ssid \"%s\", len (%d)\n", WL_CONN("ssid \"%s\", len (%d)\n",
ssid.SSID, ssid.SSID_len); ssid.SSID, ssid.SSID_len);
brcmf_ch_to_chanspec(cfg_priv->channel, brcmf_ch_to_chanspec(cfg->channel,
&join_params, &join_params_size); &join_params, &join_params_size);
err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_SSID, err = brcmf_exec_dcmd(ndev, BRCMF_C_SET_SSID,
&join_params, join_params_size); &join_params, join_params_size);
...@@ -1891,7 +1891,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1891,7 +1891,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
done: done:
if (err) if (err)
clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status); clear_bit(WL_STATUS_CONNECTING, &cfg->status);
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
return err; return err;
} }
...@@ -1900,7 +1900,7 @@ static s32 ...@@ -1900,7 +1900,7 @@ static s32
brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev, brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
u16 reason_code) u16 reason_code)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_scb_val_le scbval; struct brcmf_scb_val_le scbval;
s32 err = 0; s32 err = 0;
...@@ -1908,16 +1908,16 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev, ...@@ -1908,16 +1908,16 @@ brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *ndev,
if (!check_sys_up(wiphy)) if (!check_sys_up(wiphy))
return -EIO; return -EIO;
clear_bit(WL_STATUS_CONNECTED, &cfg_priv->status); clear_bit(WL_STATUS_CONNECTED, &cfg->status);
memcpy(&scbval.ea, brcmf_read_prof(cfg_priv, WL_PROF_BSSID), ETH_ALEN); memcpy(&scbval.ea, brcmf_read_prof(cfg, WL_PROF_BSSID), ETH_ALEN);
scbval.val = cpu_to_le32(reason_code); scbval.val = cpu_to_le32(reason_code);
err = brcmf_exec_dcmd(ndev, BRCMF_C_DISASSOC, &scbval, err = brcmf_exec_dcmd(ndev, BRCMF_C_DISASSOC, &scbval,
sizeof(struct brcmf_scb_val_le)); sizeof(struct brcmf_scb_val_le));
if (err) if (err)
WL_ERR("error (%d)\n", err); WL_ERR("error (%d)\n", err);
cfg_priv->link_up = false; cfg->link_up = false;
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
return err; return err;
...@@ -1928,8 +1928,8 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, ...@@ -1928,8 +1928,8 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy,
enum nl80211_tx_power_setting type, s32 mbm) enum nl80211_tx_power_setting type, s32 mbm)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct net_device *ndev = cfg_to_ndev(cfg_priv); struct net_device *ndev = cfg_to_ndev(cfg);
u16 txpwrmw; u16 txpwrmw;
s32 err = 0; s32 err = 0;
s32 disable = 0; s32 disable = 0;
...@@ -1965,7 +1965,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, ...@@ -1965,7 +1965,7 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy,
(s32) (brcmf_mw_to_qdbm(txpwrmw))); (s32) (brcmf_mw_to_qdbm(txpwrmw)));
if (err) if (err)
WL_ERR("qtxpower error (%d)\n", err); WL_ERR("qtxpower error (%d)\n", err);
cfg_priv->conf->tx_power = dbm; cfg->conf->tx_power = dbm;
done: done:
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
...@@ -1974,8 +1974,8 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, ...@@ -1974,8 +1974,8 @@ brcmf_cfg80211_set_tx_power(struct wiphy *wiphy,
static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm) static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct net_device *ndev = cfg_to_ndev(cfg_priv); struct net_device *ndev = cfg_to_ndev(cfg);
s32 txpwrdbm; s32 txpwrdbm;
u8 result; u8 result;
s32 err = 0; s32 err = 0;
...@@ -2002,7 +2002,7 @@ static s32 ...@@ -2002,7 +2002,7 @@ static s32
brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev, brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
u8 key_idx, bool unicast, bool multicast) u8 key_idx, bool unicast, bool multicast)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
u32 index; u32 index;
u32 wsec; u32 wsec;
s32 err = 0; s32 err = 0;
...@@ -2013,7 +2013,7 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2013,7 +2013,7 @@ brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *ndev,
if (!check_sys_up(wiphy)) if (!check_sys_up(wiphy))
return -EIO; return -EIO;
bssidx = brcmf_find_bssidx(cfg_priv, ndev); bssidx = brcmf_find_bssidx(cfg, ndev);
err = brcmf_dev_intvar_get_bsscfg(ndev, "wsec", &wsec, bssidx); err = brcmf_dev_intvar_get_bsscfg(ndev, "wsec", &wsec, bssidx);
if (err) { if (err) {
WL_ERR("WLC_GET_WSEC error (%d)\n", err); WL_ERR("WLC_GET_WSEC error (%d)\n", err);
...@@ -2037,7 +2037,7 @@ static s32 ...@@ -2037,7 +2037,7 @@ static s32
brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
u8 key_idx, const u8 *mac_addr, struct key_params *params) u8 key_idx, const u8 *mac_addr, struct key_params *params)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_wsec_key key; struct brcmf_wsec_key key;
struct brcmf_wsec_key_le key_le; struct brcmf_wsec_key_le key_le;
s32 err = 0; s32 err = 0;
...@@ -2050,11 +2050,11 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2050,11 +2050,11 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
if (!is_multicast_ether_addr(mac_addr)) if (!is_multicast_ether_addr(mac_addr))
memcpy((char *)&key.ea, (void *)mac_addr, ETH_ALEN); memcpy((char *)&key.ea, (void *)mac_addr, ETH_ALEN);
key.len = (u32) params->key_len; key.len = (u32) params->key_len;
bssidx = brcmf_find_bssidx(cfg_priv, ndev); bssidx = brcmf_find_bssidx(cfg, ndev);
/* check for key index change */ /* check for key index change */
if (key.len == 0) { if (key.len == 0) {
/* key delete */ /* key delete */
err = send_key_to_dongle(cfg_priv, bssidx, ndev, &key); err = send_key_to_dongle(cfg, bssidx, ndev, &key);
if (err) if (err)
WL_ERR("key delete error (%d)\n", err); WL_ERR("key delete error (%d)\n", err);
} else { } else {
...@@ -2114,7 +2114,7 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2114,7 +2114,7 @@ brcmf_add_keyext(struct wiphy *wiphy, struct net_device *ndev,
brcmf_netdev_wait_pend8021x(ndev); brcmf_netdev_wait_pend8021x(ndev);
err = brcmf_dev_iovar_setbuf_bsscfg(ndev, "wsec_key", &key_le, err = brcmf_dev_iovar_setbuf_bsscfg(ndev, "wsec_key", &key_le,
sizeof(key_le), sizeof(key_le),
cfg_priv->extra_buf, cfg->extra_buf,
WL_EXTRA_BUF_MAX, bssidx); WL_EXTRA_BUF_MAX, bssidx);
if (err) if (err)
WL_ERR("wsec_key error (%d)\n", err); WL_ERR("wsec_key error (%d)\n", err);
...@@ -2127,7 +2127,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2127,7 +2127,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
u8 key_idx, bool pairwise, const u8 *mac_addr, u8 key_idx, bool pairwise, const u8 *mac_addr,
struct key_params *params) struct key_params *params)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_wsec_key key; struct brcmf_wsec_key key;
s32 val; s32 val;
s32 wsec; s32 wsec;
...@@ -2169,7 +2169,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2169,7 +2169,7 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
WL_CONN("WLAN_CIPHER_SUITE_WEP104\n"); WL_CONN("WLAN_CIPHER_SUITE_WEP104\n");
break; break;
case WLAN_CIPHER_SUITE_TKIP: case WLAN_CIPHER_SUITE_TKIP:
if (cfg_priv->conf->mode != WL_MODE_AP) { if (cfg->conf->mode != WL_MODE_AP) {
WL_CONN("Swapping key\n"); WL_CONN("Swapping key\n");
memcpy(keybuf, &key.data[24], sizeof(keybuf)); memcpy(keybuf, &key.data[24], sizeof(keybuf));
memcpy(&key.data[24], &key.data[16], sizeof(keybuf)); 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,8 +2195,8 @@ brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
goto done; goto done;
} }
bssidx = brcmf_find_bssidx(cfg_priv, ndev); bssidx = brcmf_find_bssidx(cfg, ndev);
err = send_key_to_dongle(cfg_priv, bssidx, ndev, &key); err = send_key_to_dongle(cfg, bssidx, ndev, &key);
if (err) if (err)
goto done; goto done;
...@@ -2221,7 +2221,7 @@ static s32 ...@@ -2221,7 +2221,7 @@ static s32
brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
u8 key_idx, bool pairwise, const u8 *mac_addr) u8 key_idx, bool pairwise, const u8 *mac_addr)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_wsec_key key; struct brcmf_wsec_key key;
s32 err = 0; s32 err = 0;
s32 bssidx; s32 bssidx;
...@@ -2239,8 +2239,8 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2239,8 +2239,8 @@ brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev,
WL_CONN("key index (%d)\n", key_idx); WL_CONN("key index (%d)\n", key_idx);
/* Set the new key/index */ /* Set the new key/index */
bssidx = brcmf_find_bssidx(cfg_priv, ndev); bssidx = brcmf_find_bssidx(cfg, ndev);
err = send_key_to_dongle(cfg_priv, bssidx, ndev, &key); err = send_key_to_dongle(cfg, bssidx, ndev, &key);
if (err) { if (err) {
if (err == -EINVAL) { if (err == -EINVAL) {
if (key.index >= DOT11_MAX_DEFAULT_KEYS) if (key.index >= DOT11_MAX_DEFAULT_KEYS)
...@@ -2261,7 +2261,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2261,7 +2261,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
void (*callback) (void *cookie, struct key_params * params)) void (*callback) (void *cookie, struct key_params * params))
{ {
struct key_params params; struct key_params params;
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_cfg80211_security *sec; struct brcmf_cfg80211_security *sec;
s32 wsec; s32 wsec;
s32 err = 0; s32 err = 0;
...@@ -2274,7 +2274,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2274,7 +2274,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
memset(&params, 0, sizeof(params)); memset(&params, 0, sizeof(params));
bssidx = brcmf_find_bssidx(cfg_priv, ndev); bssidx = brcmf_find_bssidx(cfg, ndev);
err = brcmf_dev_intvar_get_bsscfg(ndev, "wsec", &wsec, bssidx); err = brcmf_dev_intvar_get_bsscfg(ndev, "wsec", &wsec, bssidx);
if (err) { if (err) {
WL_ERR("WLC_GET_WSEC error (%d)\n", err); 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,7 +2284,7 @@ brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev,
} }
switch (wsec & ~SES_OW_ENABLED) { switch (wsec & ~SES_OW_ENABLED) {
case WEP_ENABLED: case WEP_ENABLED:
sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); sec = brcmf_read_prof(cfg, WL_PROF_SEC);
if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) {
params.cipher = WLAN_CIPHER_SUITE_WEP40; params.cipher = WLAN_CIPHER_SUITE_WEP40;
WL_CONN("WLAN_CIPHER_SUITE_WEP40\n"); WL_CONN("WLAN_CIPHER_SUITE_WEP40\n");
...@@ -2326,27 +2326,27 @@ static s32 ...@@ -2326,27 +2326,27 @@ static s32
brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
u8 *mac, struct station_info *sinfo) u8 *mac, struct station_info *sinfo)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct brcmf_scb_val_le scb_val; struct brcmf_scb_val_le scb_val;
int rssi; int rssi;
s32 rate; s32 rate;
s32 err = 0; s32 err = 0;
u8 *bssid = brcmf_read_prof(cfg_priv, WL_PROF_BSSID); u8 *bssid = brcmf_read_prof(cfg, WL_PROF_BSSID);
struct brcmf_sta_info_le *sta_info_le; struct brcmf_sta_info_le *sta_info_le;
WL_TRACE("Enter, MAC %pM\n", mac); WL_TRACE("Enter, MAC %pM\n", mac);
if (!check_sys_up(wiphy)) if (!check_sys_up(wiphy))
return -EIO; return -EIO;
if (cfg_priv->conf->mode == WL_MODE_AP) { if (cfg->conf->mode == WL_MODE_AP) {
err = brcmf_dev_iovar_getbuf(ndev, "sta_info", mac, ETH_ALEN, err = brcmf_dev_iovar_getbuf(ndev, "sta_info", mac, ETH_ALEN,
cfg_priv->dcmd_buf, cfg->dcmd_buf,
WL_DCMD_LEN_MAX); WL_DCMD_LEN_MAX);
if (err < 0) { if (err < 0) {
WL_ERR("GET STA INFO failed, %d\n", err); WL_ERR("GET STA INFO failed, %d\n", err);
goto done; goto done;
} }
sta_info_le = (struct brcmf_sta_info_le *)cfg_priv->dcmd_buf; sta_info_le = (struct brcmf_sta_info_le *)cfg->dcmd_buf;
sinfo->filled = STATION_INFO_INACTIVE_TIME; sinfo->filled = STATION_INFO_INACTIVE_TIME;
sinfo->inactive_time = le32_to_cpu(sta_info_le->idle) * 1000; 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,7 +2356,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
} }
WL_TRACE("STA idle time : %d ms, connected time :%d sec\n", WL_TRACE("STA idle time : %d ms, connected time :%d sec\n",
sinfo->inactive_time, sinfo->connected_time); sinfo->inactive_time, sinfo->connected_time);
} else if (cfg_priv->conf->mode == WL_MODE_BSS) { } else if (cfg->conf->mode == WL_MODE_BSS) {
if (memcmp(mac, bssid, ETH_ALEN)) { if (memcmp(mac, bssid, ETH_ALEN)) {
WL_ERR("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n", WL_ERR("Wrong Mac address cfg_mac-%pM wl_bssid-%pM\n",
mac, bssid); mac, bssid);
...@@ -2374,7 +2374,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2374,7 +2374,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
WL_CONN("Rate %d Mbps\n", rate / 2); WL_CONN("Rate %d Mbps\n", rate / 2);
} }
if (test_bit(WL_STATUS_CONNECTED, &cfg_priv->status)) { if (test_bit(WL_STATUS_CONNECTED, &cfg->status)) {
memset(&scb_val, 0, sizeof(scb_val)); memset(&scb_val, 0, sizeof(scb_val));
err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_RSSI, &scb_val, err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_RSSI, &scb_val,
sizeof(scb_val)); sizeof(scb_val));
...@@ -2401,7 +2401,7 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2401,7 +2401,7 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
{ {
s32 pm; s32 pm;
s32 err = 0; s32 err = 0;
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
...@@ -2409,14 +2409,13 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2409,14 +2409,13 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev,
* Powersave enable/disable request is coming from the * Powersave enable/disable request is coming from the
* cfg80211 even before the interface is up. In that * cfg80211 even before the interface is up. In that
* scenario, driver will be storing the power save * scenario, driver will be storing the power save
* preference in cfg_priv struct to apply this to * preference in cfg struct to apply this to
* FW later while initializing the dongle * FW later while initializing the dongle
*/ */
cfg_priv->pwr_save = enabled; cfg->pwr_save = enabled;
if (!test_bit(WL_STATUS_READY, &cfg_priv->status)) { if (!test_bit(WL_STATUS_READY, &cfg->status)) {
WL_INFO("Device is not ready," WL_INFO("Device is not ready, storing the value in cfg_info struct\n");
"storing the value in cfg_priv struct\n");
goto done; goto done;
} }
...@@ -2494,10 +2493,10 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2494,10 +2493,10 @@ brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *ndev,
return err; return err;
} }
static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_priv *cfg_priv, static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg,
struct brcmf_bss_info_le *bi) struct brcmf_bss_info_le *bi)
{ {
struct wiphy *wiphy = cfg_to_wiphy(cfg_priv); struct wiphy *wiphy = cfg_to_wiphy(cfg);
struct ieee80211_channel *notify_channel; struct ieee80211_channel *notify_channel;
struct cfg80211_bss *bss; struct cfg80211_bss *bss;
struct ieee80211_supported_band *band; struct ieee80211_supported_band *band;
...@@ -2561,14 +2560,14 @@ next_bss_le(struct brcmf_scan_results *list, struct brcmf_bss_info_le *bss) ...@@ -2561,14 +2560,14 @@ next_bss_le(struct brcmf_scan_results *list, struct brcmf_bss_info_le *bss)
le32_to_cpu(bss->length)); le32_to_cpu(bss->length));
} }
static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_inform_bss(struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_scan_results *bss_list; struct brcmf_scan_results *bss_list;
struct brcmf_bss_info_le *bi = NULL; /* must be initialized */ struct brcmf_bss_info_le *bi = NULL; /* must be initialized */
s32 err = 0; s32 err = 0;
int i; int i;
bss_list = cfg_priv->bss_list; bss_list = cfg->bss_list;
if (bss_list->version != BRCMF_BSS_INFO_VERSION) { if (bss_list->version != BRCMF_BSS_INFO_VERSION) {
WL_ERR("Version %d != WL_BSS_INFO_VERSION\n", WL_ERR("Version %d != WL_BSS_INFO_VERSION\n",
bss_list->version); bss_list->version);
...@@ -2577,17 +2576,17 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -2577,17 +2576,17 @@ static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv)
WL_SCAN("scanned AP count (%d)\n", bss_list->count); WL_SCAN("scanned AP count (%d)\n", bss_list->count);
for (i = 0; i < bss_list->count && i < WL_AP_MAX; i++) { for (i = 0; i < bss_list->count && i < WL_AP_MAX; i++) {
bi = next_bss_le(bss_list, bi); bi = next_bss_le(bss_list, bi);
err = brcmf_inform_single_bss(cfg_priv, bi); err = brcmf_inform_single_bss(cfg, bi);
if (err) if (err)
break; break;
} }
return err; return err;
} }
static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv, static s32 wl_inform_ibss(struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, const u8 *bssid) struct net_device *ndev, const u8 *bssid)
{ {
struct wiphy *wiphy = cfg_to_wiphy(cfg_priv); struct wiphy *wiphy = cfg_to_wiphy(cfg);
struct ieee80211_channel *notify_channel; struct ieee80211_channel *notify_channel;
struct brcmf_bss_info_le *bi = NULL; struct brcmf_bss_info_le *bi = NULL;
struct ieee80211_supported_band *band; struct ieee80211_supported_band *band;
...@@ -2662,9 +2661,9 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -2662,9 +2661,9 @@ static s32 wl_inform_ibss(struct brcmf_cfg80211_priv *cfg_priv,
return err; return err;
} }
static bool brcmf_is_ibssmode(struct brcmf_cfg80211_priv *cfg_priv) static bool brcmf_is_ibssmode(struct brcmf_cfg80211_info *cfg)
{ {
return cfg_priv->conf->mode == WL_MODE_IBSS; return cfg->conf->mode == WL_MODE_IBSS;
} }
/* /*
...@@ -2734,7 +2733,7 @@ brcmf_find_wpaie(u8 *parse, u32 len) ...@@ -2734,7 +2733,7 @@ brcmf_find_wpaie(u8 *parse, u32 len)
return NULL; return NULL;
} }
static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_update_bss_info(struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_bss_info_le *bi; struct brcmf_bss_info_le *bi;
struct brcmf_ssid *ssid; struct brcmf_ssid *ssid;
...@@ -2746,21 +2745,21 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -2746,21 +2745,21 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv)
s32 err = 0; s32 err = 0;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (brcmf_is_ibssmode(cfg_priv)) if (brcmf_is_ibssmode(cfg))
return err; return err;
ssid = (struct brcmf_ssid *)brcmf_read_prof(cfg_priv, WL_PROF_SSID); ssid = (struct brcmf_ssid *)brcmf_read_prof(cfg, WL_PROF_SSID);
*(__le32 *)cfg_priv->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX); *(__le32 *)cfg->extra_buf = cpu_to_le32(WL_EXTRA_BUF_MAX);
err = brcmf_exec_dcmd(cfg_to_ndev(cfg_priv), BRCMF_C_GET_BSS_INFO, err = brcmf_exec_dcmd(cfg_to_ndev(cfg), BRCMF_C_GET_BSS_INFO,
cfg_priv->extra_buf, WL_EXTRA_BUF_MAX); cfg->extra_buf, WL_EXTRA_BUF_MAX);
if (err) { if (err) {
WL_ERR("Could not get bss info %d\n", err); WL_ERR("Could not get bss info %d\n", err);
goto update_bss_info_out; goto update_bss_info_out;
} }
bi = (struct brcmf_bss_info_le *)(cfg_priv->extra_buf + 4); bi = (struct brcmf_bss_info_le *)(cfg->extra_buf + 4);
err = brcmf_inform_single_bss(cfg_priv, bi); err = brcmf_inform_single_bss(cfg, bi);
if (err) if (err)
goto update_bss_info_out; goto update_bss_info_out;
...@@ -2778,7 +2777,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -2778,7 +2777,7 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv)
* so we speficially query dtim information to dongle. * so we speficially query dtim information to dongle.
*/ */
u32 var; u32 var;
err = brcmf_dev_intvar_get(cfg_to_ndev(cfg_priv), err = brcmf_dev_intvar_get(cfg_to_ndev(cfg),
"dtim_assoc", &var); "dtim_assoc", &var);
if (err) { if (err) {
WL_ERR("wl dtim_assoc failed (%d)\n", err); 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,22 +2786,22 @@ static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv)
dtim_period = (u8)var; dtim_period = (u8)var;
} }
brcmf_update_prof(cfg_priv, NULL, &beacon_interval, WL_PROF_BEACONINT); brcmf_update_prof(cfg, NULL, &beacon_interval, WL_PROF_BEACONINT);
brcmf_update_prof(cfg_priv, NULL, &dtim_period, WL_PROF_DTIMPERIOD); brcmf_update_prof(cfg, NULL, &dtim_period, WL_PROF_DTIMPERIOD);
update_bss_info_out: update_bss_info_out:
WL_TRACE("Exit"); WL_TRACE("Exit");
return err; return err;
} }
static void brcmf_abort_scanning(struct brcmf_cfg80211_priv *cfg_priv) static void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg_priv); struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg);
struct escan_info *escan = &cfg_priv->escan_info; struct escan_info *escan = &cfg->escan_info;
struct brcmf_ssid ssid; struct brcmf_ssid ssid;
set_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status); set_bit(WL_STATUS_SCAN_ABORTING, &cfg->status);
if (cfg_priv->iscan_on) { if (cfg->iscan_on) {
iscan->state = WL_ISCAN_STATE_IDLE; iscan->state = WL_ISCAN_STATE_IDLE;
if (iscan->timer_on) { if (iscan->timer_on) {
...@@ -2816,39 +2815,39 @@ static void brcmf_abort_scanning(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -2816,39 +2815,39 @@ static void brcmf_abort_scanning(struct brcmf_cfg80211_priv *cfg_priv)
memset(&ssid, 0, sizeof(ssid)); memset(&ssid, 0, sizeof(ssid));
brcmf_run_iscan(iscan, &ssid, WL_SCAN_ACTION_ABORT); brcmf_run_iscan(iscan, &ssid, WL_SCAN_ACTION_ABORT);
if (cfg_priv->scan_request) { if (cfg->scan_request) {
/* Indidate scan abort to cfg80211 layer */ /* Indidate scan abort to cfg80211 layer */
WL_INFO("Terminating scan in progress\n"); WL_INFO("Terminating scan in progress\n");
cfg80211_scan_done(cfg_priv->scan_request, true); cfg80211_scan_done(cfg->scan_request, true);
cfg_priv->scan_request = NULL; cfg->scan_request = NULL;
} }
} }
if (cfg_priv->escan_on && cfg_priv->scan_request) { if (cfg->escan_on && cfg->scan_request) {
escan->escan_state = WL_ESCAN_STATE_IDLE; escan->escan_state = WL_ESCAN_STATE_IDLE;
brcmf_notify_escan_complete(cfg_priv, escan->ndev, true, true); brcmf_notify_escan_complete(cfg, escan->ndev, true, true);
} }
clear_bit(WL_STATUS_SCANNING, &cfg_priv->status); clear_bit(WL_STATUS_SCANNING, &cfg->status);
clear_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status); clear_bit(WL_STATUS_SCAN_ABORTING, &cfg->status);
} }
static void brcmf_notify_iscan_complete(struct brcmf_cfg80211_iscan_ctrl *iscan, static void brcmf_notify_iscan_complete(struct brcmf_cfg80211_iscan_ctrl *iscan,
bool aborted) bool aborted)
{ {
struct brcmf_cfg80211_priv *cfg_priv = iscan_to_cfg(iscan); struct brcmf_cfg80211_info *cfg = iscan_to_cfg(iscan);
struct net_device *ndev = cfg_to_ndev(cfg_priv); struct net_device *ndev = cfg_to_ndev(cfg);
if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg->status)) {
WL_ERR("Scan complete while device not scanning\n"); WL_ERR("Scan complete while device not scanning\n");
return; return;
} }
if (cfg_priv->scan_request) { if (cfg->scan_request) {
WL_SCAN("ISCAN Completed scan: %s\n", WL_SCAN("ISCAN Completed scan: %s\n",
aborted ? "Aborted" : "Done"); aborted ? "Aborted" : "Done");
cfg80211_scan_done(cfg_priv->scan_request, aborted); cfg80211_scan_done(cfg->scan_request, aborted);
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ndev, 1);
cfg_priv->scan_request = NULL; cfg->scan_request = NULL;
} }
cfg_priv->iscan_kickstart = false; cfg->iscan_kickstart = false;
} }
static s32 brcmf_wakeup_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan) static 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,21 +2900,21 @@ brcmf_get_iscan_results(struct brcmf_cfg80211_iscan_ctrl *iscan, u32 *status,
return err; return err;
} }
static s32 brcmf_iscan_done(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_iscan_done(struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; struct brcmf_cfg80211_iscan_ctrl *iscan = cfg->iscan;
s32 err = 0; s32 err = 0;
iscan->state = WL_ISCAN_STATE_IDLE; iscan->state = WL_ISCAN_STATE_IDLE;
brcmf_inform_bss(cfg_priv); brcmf_inform_bss(cfg);
brcmf_notify_iscan_complete(iscan, false); brcmf_notify_iscan_complete(iscan, false);
return err; return err;
} }
static s32 brcmf_iscan_pending(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_iscan_pending(struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; struct brcmf_cfg80211_iscan_ctrl *iscan = cfg->iscan;
s32 err = 0; s32 err = 0;
/* Reschedule the timer */ /* Reschedule the timer */
...@@ -2925,12 +2924,12 @@ static s32 brcmf_iscan_pending(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -2925,12 +2924,12 @@ static s32 brcmf_iscan_pending(struct brcmf_cfg80211_priv *cfg_priv)
return err; return err;
} }
static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; struct brcmf_cfg80211_iscan_ctrl *iscan = cfg->iscan;
s32 err = 0; s32 err = 0;
brcmf_inform_bss(cfg_priv); brcmf_inform_bss(cfg);
brcmf_run_iscan(iscan, NULL, BRCMF_SCAN_ACTION_CONTINUE); brcmf_run_iscan(iscan, NULL, BRCMF_SCAN_ACTION_CONTINUE);
/* Reschedule the timer */ /* Reschedule the timer */
mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000); 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,9 +2938,9 @@ static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv)
return err; return err;
} }
static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; struct brcmf_cfg80211_iscan_ctrl *iscan = cfg->iscan;
s32 err = 0; s32 err = 0;
iscan->state = WL_ISCAN_STATE_IDLE; iscan->state = WL_ISCAN_STATE_IDLE;
...@@ -2955,7 +2954,7 @@ static void brcmf_cfg80211_iscan_handler(struct work_struct *work) ...@@ -2955,7 +2954,7 @@ static void brcmf_cfg80211_iscan_handler(struct work_struct *work)
struct brcmf_cfg80211_iscan_ctrl *iscan = struct brcmf_cfg80211_iscan_ctrl *iscan =
container_of(work, struct brcmf_cfg80211_iscan_ctrl, container_of(work, struct brcmf_cfg80211_iscan_ctrl,
work); work);
struct brcmf_cfg80211_priv *cfg_priv = iscan_to_cfg(iscan); struct brcmf_cfg80211_info *cfg = iscan_to_cfg(iscan);
struct brcmf_cfg80211_iscan_eloop *el = &iscan->el; struct brcmf_cfg80211_iscan_eloop *el = &iscan->el;
u32 status = BRCMF_SCAN_RESULTS_PARTIAL; u32 status = BRCMF_SCAN_RESULTS_PARTIAL;
...@@ -2964,12 +2963,12 @@ static void brcmf_cfg80211_iscan_handler(struct work_struct *work) ...@@ -2964,12 +2963,12 @@ static void brcmf_cfg80211_iscan_handler(struct work_struct *work)
iscan->timer_on = 0; iscan->timer_on = 0;
} }
if (brcmf_get_iscan_results(iscan, &status, &cfg_priv->bss_list)) { if (brcmf_get_iscan_results(iscan, &status, &cfg->bss_list)) {
status = BRCMF_SCAN_RESULTS_ABORTED; status = BRCMF_SCAN_RESULTS_ABORTED;
WL_ERR("Abort iscan\n"); WL_ERR("Abort iscan\n");
} }
el->handler[status](cfg_priv); el->handler[status](cfg);
} }
static void brcmf_iscan_timer(unsigned long data) static void brcmf_iscan_timer(unsigned long data)
...@@ -2984,11 +2983,11 @@ static void brcmf_iscan_timer(unsigned long data) ...@@ -2984,11 +2983,11 @@ static void brcmf_iscan_timer(unsigned long data)
} }
} }
static s32 brcmf_invoke_iscan(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_invoke_iscan(struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg_priv); struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg);
if (cfg_priv->iscan_on) { if (cfg->iscan_on) {
iscan->state = WL_ISCAN_STATE_IDLE; iscan->state = WL_ISCAN_STATE_IDLE;
INIT_WORK(&iscan->work, brcmf_cfg80211_iscan_handler); INIT_WORK(&iscan->work, brcmf_cfg80211_iscan_handler);
} }
...@@ -3006,21 +3005,21 @@ static void brcmf_init_iscan_eloop(struct brcmf_cfg80211_iscan_eloop *el) ...@@ -3006,21 +3005,21 @@ static void brcmf_init_iscan_eloop(struct brcmf_cfg80211_iscan_eloop *el)
el->handler[BRCMF_SCAN_RESULTS_NO_MEM] = brcmf_iscan_aborted; el->handler[BRCMF_SCAN_RESULTS_NO_MEM] = brcmf_iscan_aborted;
} }
static s32 brcmf_init_iscan(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_init_iscan(struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg_priv); struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg);
int err = 0; int err = 0;
if (cfg_priv->iscan_on) { if (cfg->iscan_on) {
iscan->ndev = cfg_to_ndev(cfg_priv); iscan->ndev = cfg_to_ndev(cfg);
brcmf_init_iscan_eloop(&iscan->el); brcmf_init_iscan_eloop(&iscan->el);
iscan->timer_ms = WL_ISCAN_TIMER_INTERVAL_MS; iscan->timer_ms = WL_ISCAN_TIMER_INTERVAL_MS;
init_timer(&iscan->timer); init_timer(&iscan->timer);
iscan->timer.data = (unsigned long) iscan; iscan->timer.data = (unsigned long) iscan;
iscan->timer.function = brcmf_iscan_timer; iscan->timer.function = brcmf_iscan_timer;
err = brcmf_invoke_iscan(cfg_priv); err = brcmf_invoke_iscan(cfg);
if (!err) if (!err)
iscan->data = cfg_priv; iscan->data = cfg;
} }
return err; return err;
...@@ -3028,23 +3027,23 @@ static s32 brcmf_init_iscan(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -3028,23 +3027,23 @@ static s32 brcmf_init_iscan(struct brcmf_cfg80211_priv *cfg_priv)
static void brcmf_cfg80211_escan_timeout_worker(struct work_struct *work) static void brcmf_cfg80211_escan_timeout_worker(struct work_struct *work)
{ {
struct brcmf_cfg80211_priv *cfg_priv = struct brcmf_cfg80211_info *cfg =
container_of(work, struct brcmf_cfg80211_priv, container_of(work, struct brcmf_cfg80211_info,
escan_timeout_work); escan_timeout_work);
brcmf_notify_escan_complete(cfg_priv, brcmf_notify_escan_complete(cfg,
cfg_priv->escan_info.ndev, true, true); cfg->escan_info.ndev, true, true);
} }
static void brcmf_escan_timeout(unsigned long data) static void brcmf_escan_timeout(unsigned long data)
{ {
struct brcmf_cfg80211_priv *cfg_priv = struct brcmf_cfg80211_info *cfg =
(struct brcmf_cfg80211_priv *)data; (struct brcmf_cfg80211_info *)data;
if (cfg_priv->scan_request) { if (cfg->scan_request) {
WL_ERR("timer expired\n"); WL_ERR("timer expired\n");
if (cfg_priv->escan_on) if (cfg->escan_on)
schedule_work(&cfg_priv->escan_timeout_work); schedule_work(&cfg->escan_timeout_work);
} }
} }
...@@ -3081,7 +3080,7 @@ brcmf_compare_update_same_bss(struct brcmf_bss_info_le *bss, ...@@ -3081,7 +3080,7 @@ brcmf_compare_update_same_bss(struct brcmf_bss_info_le *bss,
} }
static s32 static s32
brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv, brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, struct net_device *ndev,
const struct brcmf_event_msg *e, void *data) const struct brcmf_event_msg *e, void *data)
{ {
...@@ -3097,11 +3096,11 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -3097,11 +3096,11 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv,
status = be32_to_cpu(e->status); status = be32_to_cpu(e->status);
if (!ndev || !cfg_priv->escan_on || if (!ndev || !cfg->escan_on ||
!test_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { !test_bit(WL_STATUS_SCANNING, &cfg->status)) {
WL_ERR("scan not ready ndev %p wl->escan_on %d drv_status %x\n", WL_ERR("scan not ready ndev %p wl->escan_on %d drv_status %x\n",
ndev, cfg_priv->escan_on, ndev, cfg->escan_on,
!test_bit(WL_STATUS_SCANNING, &cfg_priv->status)); !test_bit(WL_STATUS_SCANNING, &cfg->status));
return -EPERM; return -EPERM;
} }
...@@ -3112,7 +3111,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -3112,7 +3111,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv,
WL_ERR("Invalid escan result (NULL pointer)\n"); WL_ERR("Invalid escan result (NULL pointer)\n");
goto exit; goto exit;
} }
if (!cfg_priv->scan_request) { if (!cfg->scan_request) {
WL_SCAN("result without cfg80211 request\n"); WL_SCAN("result without cfg80211 request\n");
goto exit; goto exit;
} }
...@@ -3132,7 +3131,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -3132,7 +3131,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv,
goto exit; goto exit;
} }
if (!(cfg_to_wiphy(cfg_priv)->interface_modes & if (!(cfg_to_wiphy(cfg)->interface_modes &
BIT(NL80211_IFTYPE_ADHOC))) { BIT(NL80211_IFTYPE_ADHOC))) {
if (le16_to_cpu(bss_info_le->capability) & if (le16_to_cpu(bss_info_le->capability) &
WLAN_CAPABILITY_IBSS) { WLAN_CAPABILITY_IBSS) {
...@@ -3142,7 +3141,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -3142,7 +3141,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv,
} }
list = (struct brcmf_scan_results *) list = (struct brcmf_scan_results *)
cfg_priv->escan_info.escan_buf; cfg->escan_info.escan_buf;
if (bi_length > WL_ESCAN_BUF_SIZE - list->buflen) { if (bi_length > WL_ESCAN_BUF_SIZE - list->buflen) {
WL_ERR("Buffer is too small: ignoring\n"); WL_ERR("Buffer is too small: ignoring\n");
goto exit; goto exit;
...@@ -3155,19 +3154,19 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -3155,19 +3154,19 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv,
if (brcmf_compare_update_same_bss(bss, bss_info_le)) if (brcmf_compare_update_same_bss(bss, bss_info_le))
goto exit; goto exit;
} }
memcpy(&(cfg_priv->escan_info.escan_buf[list->buflen]), memcpy(&(cfg->escan_info.escan_buf[list->buflen]),
bss_info_le, bi_length); bss_info_le, bi_length);
list->version = le32_to_cpu(bss_info_le->version); list->version = le32_to_cpu(bss_info_le->version);
list->buflen += bi_length; list->buflen += bi_length;
list->count++; list->count++;
} else { } else {
cfg_priv->escan_info.escan_state = WL_ESCAN_STATE_IDLE; cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE;
if (cfg_priv->scan_request) { if (cfg->scan_request) {
cfg_priv->bss_list = (struct brcmf_scan_results *) cfg->bss_list = (struct brcmf_scan_results *)
cfg_priv->escan_info.escan_buf; cfg->escan_info.escan_buf;
brcmf_inform_bss(cfg_priv); brcmf_inform_bss(cfg);
aborted = status != BRCMF_E_STATUS_SUCCESS; aborted = status != BRCMF_E_STATUS_SUCCESS;
brcmf_notify_escan_complete(cfg_priv, ndev, aborted, brcmf_notify_escan_complete(cfg, ndev, aborted,
false); false);
} else } else
WL_ERR("Unexpected scan result 0x%x\n", status); WL_ERR("Unexpected scan result 0x%x\n", status);
...@@ -3176,18 +3175,18 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -3176,18 +3175,18 @@ brcmf_cfg80211_escan_handler(struct brcmf_cfg80211_priv *cfg_priv,
return err; return err;
} }
static void brcmf_init_escan(struct brcmf_cfg80211_priv *cfg_priv) static void brcmf_init_escan(struct brcmf_cfg80211_info *cfg)
{ {
if (cfg_priv->escan_on) { if (cfg->escan_on) {
cfg_priv->el.handler[BRCMF_E_ESCAN_RESULT] = cfg->el.handler[BRCMF_E_ESCAN_RESULT] =
brcmf_cfg80211_escan_handler; brcmf_cfg80211_escan_handler;
cfg_priv->escan_info.escan_state = WL_ESCAN_STATE_IDLE; cfg->escan_info.escan_state = WL_ESCAN_STATE_IDLE;
/* Init scan_timeout timer */ /* Init scan_timeout timer */
init_timer(&cfg_priv->escan_timeout); init_timer(&cfg->escan_timeout);
cfg_priv->escan_timeout.data = (unsigned long) cfg_priv; cfg->escan_timeout.data = (unsigned long) cfg;
cfg_priv->escan_timeout.function = brcmf_escan_timeout; cfg->escan_timeout.function = brcmf_escan_timeout;
INIT_WORK(&cfg_priv->escan_timeout_work, INIT_WORK(&cfg->escan_timeout_work,
brcmf_cfg80211_escan_timeout_worker); brcmf_cfg80211_escan_timeout_worker);
} }
} }
...@@ -3204,7 +3203,7 @@ static __always_inline void brcmf_delay(u32 ms) ...@@ -3204,7 +3203,7 @@ static __always_inline void brcmf_delay(u32 ms)
static s32 brcmf_cfg80211_resume(struct wiphy *wiphy) static s32 brcmf_cfg80211_resume(struct wiphy *wiphy)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
/* /*
* Check for WL_STATUS_READY before any function call which * Check for WL_STATUS_READY before any function call which
...@@ -3213,7 +3212,7 @@ static s32 brcmf_cfg80211_resume(struct wiphy *wiphy) ...@@ -3213,7 +3212,7 @@ static s32 brcmf_cfg80211_resume(struct wiphy *wiphy)
*/ */
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (test_bit(WL_STATUS_READY, &cfg_priv->status)) if (test_bit(WL_STATUS_READY, &cfg->status))
brcmf_invoke_iscan(wiphy_to_cfg(wiphy)); brcmf_invoke_iscan(wiphy_to_cfg(wiphy));
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
...@@ -3223,8 +3222,8 @@ static s32 brcmf_cfg80211_resume(struct wiphy *wiphy) ...@@ -3223,8 +3222,8 @@ static s32 brcmf_cfg80211_resume(struct wiphy *wiphy)
static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
struct cfg80211_wowlan *wow) struct cfg80211_wowlan *wow)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct net_device *ndev = cfg_to_ndev(cfg_priv); struct net_device *ndev = cfg_to_ndev(cfg);
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
...@@ -3238,12 +3237,12 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, ...@@ -3238,12 +3237,12 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
* While going to suspend if associated with AP disassociate * While going to suspend if associated with AP disassociate
* from AP to save power while system is in suspended state * from AP to save power while system is in suspended state
*/ */
if ((test_bit(WL_STATUS_CONNECTED, &cfg_priv->status) || if ((test_bit(WL_STATUS_CONNECTED, &cfg->status) ||
test_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) && test_bit(WL_STATUS_CONNECTING, &cfg->status)) &&
test_bit(WL_STATUS_READY, &cfg_priv->status)) { test_bit(WL_STATUS_READY, &cfg->status)) {
WL_INFO("Disassociating from AP" WL_INFO("Disassociating from AP"
" while entering suspend state\n"); " while entering suspend state\n");
brcmf_link_down(cfg_priv); brcmf_link_down(cfg);
/* /*
* Make sure WPA_Supplicant receives all the event * Make sure WPA_Supplicant receives all the event
...@@ -3253,13 +3252,13 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, ...@@ -3253,13 +3252,13 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
brcmf_delay(500); brcmf_delay(500);
} }
if (test_bit(WL_STATUS_READY, &cfg_priv->status)) if (test_bit(WL_STATUS_READY, &cfg->status))
brcmf_abort_scanning(cfg_priv); brcmf_abort_scanning(cfg);
else else
clear_bit(WL_STATUS_SCANNING, &cfg_priv->status); clear_bit(WL_STATUS_SCANNING, &cfg->status);
/* Turn off watchdog timer */ /* Turn off watchdog timer */
if (test_bit(WL_STATUS_READY, &cfg_priv->status)) if (test_bit(WL_STATUS_READY, &cfg->status))
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ndev, 1);
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
...@@ -3270,14 +3269,14 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, ...@@ -3270,14 +3269,14 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
static __used s32 static __used s32
brcmf_dev_bufvar_set(struct net_device *ndev, s8 *name, s8 *buf, s32 len) brcmf_dev_bufvar_set(struct net_device *ndev, s8 *name, s8 *buf, s32 len)
{ {
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
u32 buflen; u32 buflen;
buflen = brcmf_c_mkiovar(name, buf, len, cfg_priv->dcmd_buf, buflen = brcmf_c_mkiovar(name, buf, len, cfg->dcmd_buf,
WL_DCMD_LEN_MAX); WL_DCMD_LEN_MAX);
BUG_ON(!buflen); BUG_ON(!buflen);
return brcmf_exec_dcmd(ndev, BRCMF_C_SET_VAR, cfg_priv->dcmd_buf, return brcmf_exec_dcmd(ndev, BRCMF_C_SET_VAR, cfg->dcmd_buf,
buflen); buflen);
} }
...@@ -3285,20 +3284,20 @@ static s32 ...@@ -3285,20 +3284,20 @@ static s32
brcmf_dev_bufvar_get(struct net_device *ndev, s8 *name, s8 *buf, brcmf_dev_bufvar_get(struct net_device *ndev, s8 *name, s8 *buf,
s32 buf_len) s32 buf_len)
{ {
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
u32 len; u32 len;
s32 err = 0; s32 err = 0;
len = brcmf_c_mkiovar(name, NULL, 0, cfg_priv->dcmd_buf, len = brcmf_c_mkiovar(name, NULL, 0, cfg->dcmd_buf,
WL_DCMD_LEN_MAX); WL_DCMD_LEN_MAX);
BUG_ON(!len); BUG_ON(!len);
err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_VAR, cfg_priv->dcmd_buf, err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_VAR, cfg->dcmd_buf,
WL_DCMD_LEN_MAX); WL_DCMD_LEN_MAX);
if (err) { if (err) {
WL_ERR("error (%d)\n", err); WL_ERR("error (%d)\n", err);
return err; return err;
} }
memcpy(buf, cfg_priv->dcmd_buf, buf_len); memcpy(buf, cfg->dcmd_buf, buf_len);
return err; return err;
} }
...@@ -3331,8 +3330,8 @@ static s32 ...@@ -3331,8 +3330,8 @@ static s32
brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev, brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_pmksa *pmksa) struct cfg80211_pmksa *pmksa)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct pmkid_list *pmkids = &cfg_priv->pmk_list->pmkids; struct pmkid_list *pmkids = &cfg->pmk_list->pmkids;
s32 err = 0; s32 err = 0;
int i; int i;
int pmkid_len; int pmkid_len;
...@@ -3360,7 +3359,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev, ...@@ -3360,7 +3359,7 @@ brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *ndev,
for (i = 0; i < WLAN_PMKID_LEN; i++) for (i = 0; i < WLAN_PMKID_LEN; i++)
WL_CONN("%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]); WL_CONN("%02x\n", pmkids->pmkid[pmkid_len].PMKID[i]);
err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err); err = brcmf_update_pmklist(ndev, cfg->pmk_list, err);
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
return err; return err;
...@@ -3370,7 +3369,7 @@ static s32 ...@@ -3370,7 +3369,7 @@ static s32
brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
struct cfg80211_pmksa *pmksa) struct cfg80211_pmksa *pmksa)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct pmkid_list pmkid; struct pmkid_list pmkid;
s32 err = 0; s32 err = 0;
int i, pmkid_len; int i, pmkid_len;
...@@ -3387,30 +3386,30 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, ...@@ -3387,30 +3386,30 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
for (i = 0; i < WLAN_PMKID_LEN; i++) for (i = 0; i < WLAN_PMKID_LEN; i++)
WL_CONN("%02x\n", pmkid.pmkid[0].PMKID[i]); WL_CONN("%02x\n", pmkid.pmkid[0].PMKID[i]);
pmkid_len = le32_to_cpu(cfg_priv->pmk_list->pmkids.npmkid); pmkid_len = le32_to_cpu(cfg->pmk_list->pmkids.npmkid);
for (i = 0; i < pmkid_len; i++) for (i = 0; i < pmkid_len; i++)
if (!memcmp if (!memcmp
(pmksa->bssid, &cfg_priv->pmk_list->pmkids.pmkid[i].BSSID, (pmksa->bssid, &cfg->pmk_list->pmkids.pmkid[i].BSSID,
ETH_ALEN)) ETH_ALEN))
break; break;
if ((pmkid_len > 0) if ((pmkid_len > 0)
&& (i < pmkid_len)) { && (i < pmkid_len)) {
memset(&cfg_priv->pmk_list->pmkids.pmkid[i], 0, memset(&cfg->pmk_list->pmkids.pmkid[i], 0,
sizeof(struct pmkid)); sizeof(struct pmkid));
for (; i < (pmkid_len - 1); i++) { for (; i < (pmkid_len - 1); i++) {
memcpy(&cfg_priv->pmk_list->pmkids.pmkid[i].BSSID, memcpy(&cfg->pmk_list->pmkids.pmkid[i].BSSID,
&cfg_priv->pmk_list->pmkids.pmkid[i + 1].BSSID, &cfg->pmk_list->pmkids.pmkid[i + 1].BSSID,
ETH_ALEN); ETH_ALEN);
memcpy(&cfg_priv->pmk_list->pmkids.pmkid[i].PMKID, memcpy(&cfg->pmk_list->pmkids.pmkid[i].PMKID,
&cfg_priv->pmk_list->pmkids.pmkid[i + 1].PMKID, &cfg->pmk_list->pmkids.pmkid[i + 1].PMKID,
WLAN_PMKID_LEN); WLAN_PMKID_LEN);
} }
cfg_priv->pmk_list->pmkids.npmkid = cpu_to_le32(pmkid_len - 1); cfg->pmk_list->pmkids.npmkid = cpu_to_le32(pmkid_len - 1);
} else } else
err = -EINVAL; err = -EINVAL;
err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err); err = brcmf_update_pmklist(ndev, cfg->pmk_list, err);
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
return err; return err;
...@@ -3420,15 +3419,15 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev, ...@@ -3420,15 +3419,15 @@ brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *ndev,
static s32 static s32
brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev) brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
s32 err = 0; s32 err = 0;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (!check_sys_up(wiphy)) if (!check_sys_up(wiphy))
return -EIO; return -EIO;
memset(cfg_priv->pmk_list, 0, sizeof(*cfg_priv->pmk_list)); memset(cfg->pmk_list, 0, sizeof(*cfg->pmk_list));
err = brcmf_update_pmklist(ndev, cfg_priv->pmk_list, err); err = brcmf_update_pmklist(ndev, cfg->pmk_list, err);
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
return err; return err;
...@@ -3444,7 +3443,7 @@ brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev) ...@@ -3444,7 +3443,7 @@ brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *ndev)
* cfg80211_scan_request one out of the received PNO event. * cfg80211_scan_request one out of the received PNO event.
*/ */
static s32 static s32
brcmf_notify_sched_scan_results(struct brcmf_cfg80211_priv *cfg_priv, brcmf_notify_sched_scan_results(struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, struct net_device *ndev,
const struct brcmf_event_msg *e, void *data) const struct brcmf_event_msg *e, void *data)
{ {
...@@ -3452,7 +3451,7 @@ brcmf_notify_sched_scan_results(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -3452,7 +3451,7 @@ brcmf_notify_sched_scan_results(struct brcmf_cfg80211_priv *cfg_priv,
struct cfg80211_scan_request *request = NULL; struct cfg80211_scan_request *request = NULL;
struct cfg80211_ssid *ssid = NULL; struct cfg80211_ssid *ssid = NULL;
struct ieee80211_channel *channel = NULL; struct ieee80211_channel *channel = NULL;
struct wiphy *wiphy = cfg_to_wiphy(cfg_priv); struct wiphy *wiphy = cfg_to_wiphy(cfg);
int err = 0; int err = 0;
int channel_req = 0; int channel_req = 0;
int band = 0; int band = 0;
...@@ -3524,19 +3523,19 @@ brcmf_notify_sched_scan_results(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -3524,19 +3523,19 @@ brcmf_notify_sched_scan_results(struct brcmf_cfg80211_priv *cfg_priv,
if (request->n_ssids) if (request->n_ssids)
request->ssids = &ssid[0]; request->ssids = &ssid[0];
if (test_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { if (test_bit(WL_STATUS_SCANNING, &cfg->status)) {
/* Abort any on-going scan */ /* Abort any on-going scan */
brcmf_abort_scanning(cfg_priv); brcmf_abort_scanning(cfg);
} }
set_bit(WL_STATUS_SCANNING, &cfg_priv->status); set_bit(WL_STATUS_SCANNING, &cfg->status);
err = brcmf_do_escan(cfg_priv, wiphy, ndev, request); err = brcmf_do_escan(cfg, wiphy, ndev, request);
if (err) { if (err) {
clear_bit(WL_STATUS_SCANNING, &cfg_priv->status); clear_bit(WL_STATUS_SCANNING, &cfg->status);
goto out_err; goto out_err;
} }
cfg_priv->sched_escan = true; cfg->sched_escan = true;
cfg_priv->scan_request = request; cfg->scan_request = request;
} else { } else {
WL_ERR("FALSE PNO Event. (pfn_count == 0)\n"); WL_ERR("FALSE PNO Event. (pfn_count == 0)\n");
goto out_err; goto out_err;
...@@ -3601,15 +3600,15 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy, ...@@ -3601,15 +3600,15 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy,
struct cfg80211_sched_scan_request *request) struct cfg80211_sched_scan_request *request)
{ {
char iovbuf[128]; char iovbuf[128];
struct brcmf_cfg80211_priv *cfg_priv = wiphy_priv(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy);
struct brcmf_pno_net_param_le pfn; struct brcmf_pno_net_param_le pfn;
int i; int i;
int ret = 0; int ret = 0;
WL_SCAN("Enter n_match_sets:%d n_ssids:%d\n", WL_SCAN("Enter n_match_sets:%d n_ssids:%d\n",
request->n_match_sets, request->n_ssids); request->n_match_sets, request->n_ssids);
if (test_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { if (test_bit(WL_STATUS_SCANNING, &cfg->status)) {
WL_ERR("Scanning already : status (%lu)\n", cfg_priv->status); WL_ERR("Scanning already : status (%lu)\n", cfg->status);
return -EAGAIN; return -EAGAIN;
} }
...@@ -3688,12 +3687,12 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy, ...@@ -3688,12 +3687,12 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy,
static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy, static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy,
struct net_device *ndev) struct net_device *ndev)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
WL_SCAN("enter\n"); WL_SCAN("enter\n");
brcmf_dev_pno_clean(ndev); brcmf_dev_pno_clean(ndev);
if (cfg_priv->sched_escan) if (cfg->sched_escan)
brcmf_notify_escan_complete(cfg_priv, ndev, true, true); brcmf_notify_escan_complete(cfg, ndev, true, true);
return 0; return 0;
} }
#endif /* CONFIG_BRCMISCAN */ #endif /* CONFIG_BRCMISCAN */
...@@ -3701,8 +3700,8 @@ static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy, ...@@ -3701,8 +3700,8 @@ static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy,
#ifdef CONFIG_NL80211_TESTMODE #ifdef CONFIG_NL80211_TESTMODE
static int brcmf_cfg80211_testmode(struct wiphy *wiphy, void *data, int len) static int brcmf_cfg80211_testmode(struct wiphy *wiphy, void *data, int len)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct net_device *ndev = cfg_priv->wdev->netdev; struct net_device *ndev = cfg->wdev->netdev;
struct brcmf_dcmd *dcmd = data; struct brcmf_dcmd *dcmd = data;
struct sk_buff *reply; struct sk_buff *reply;
int ret; int ret;
...@@ -4010,7 +4009,7 @@ brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 *ie_ptr, u32 ie_len, s8 *add_del_cmd) ...@@ -4010,7 +4009,7 @@ brcmf_vndr_ie(u8 *iebuf, s32 pktflag, u8 *ie_ptr, u32 ie_len, s8 *add_del_cmd)
} }
s32 s32
brcmf_set_management_ie(struct brcmf_cfg80211_priv *cfg_priv, brcmf_set_management_ie(struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, s32 bssidx, s32 pktflag, struct net_device *ndev, s32 bssidx, s32 pktflag,
u8 *vndr_ie_buf, u32 vndr_ie_len) u8 *vndr_ie_buf, u32 vndr_ie_len)
{ {
...@@ -4035,19 +4034,19 @@ brcmf_set_management_ie(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4035,19 +4034,19 @@ brcmf_set_management_ie(struct brcmf_cfg80211_priv *cfg_priv,
if (!iovar_ie_buf) if (!iovar_ie_buf)
return -ENOMEM; return -ENOMEM;
curr_ie_buf = iovar_ie_buf; curr_ie_buf = iovar_ie_buf;
if (test_bit(WL_STATUS_AP_CREATING, &cfg_priv->status) || if (test_bit(WL_STATUS_AP_CREATING, &cfg->status) ||
test_bit(WL_STATUS_AP_CREATED, &cfg_priv->status)) { test_bit(WL_STATUS_AP_CREATED, &cfg->status)) {
switch (pktflag) { switch (pktflag) {
case VNDR_IE_PRBRSP_FLAG: case VNDR_IE_PRBRSP_FLAG:
mgmt_ie_buf = cfg_priv->ap_info->probe_res_ie; mgmt_ie_buf = cfg->ap_info->probe_res_ie;
mgmt_ie_len = &cfg_priv->ap_info->probe_res_ie_len; mgmt_ie_len = &cfg->ap_info->probe_res_ie_len;
mgmt_ie_buf_len = mgmt_ie_buf_len =
sizeof(cfg_priv->ap_info->probe_res_ie); sizeof(cfg->ap_info->probe_res_ie);
break; break;
case VNDR_IE_BEACON_FLAG: case VNDR_IE_BEACON_FLAG:
mgmt_ie_buf = cfg_priv->ap_info->beacon_ie; mgmt_ie_buf = cfg->ap_info->beacon_ie;
mgmt_ie_len = &cfg_priv->ap_info->beacon_ie_len; mgmt_ie_len = &cfg->ap_info->beacon_ie_len;
mgmt_ie_buf_len = sizeof(cfg_priv->ap_info->beacon_ie); mgmt_ie_buf_len = sizeof(cfg->ap_info->beacon_ie);
break; break;
default: default:
err = -EPERM; err = -EPERM;
...@@ -4153,7 +4152,7 @@ brcmf_set_management_ie(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4153,7 +4152,7 @@ brcmf_set_management_ie(struct brcmf_cfg80211_priv *cfg_priv,
err = brcmf_dev_iovar_setbuf_bsscfg(ndev, "vndr_ie", err = brcmf_dev_iovar_setbuf_bsscfg(ndev, "vndr_ie",
iovar_ie_buf, iovar_ie_buf,
total_ie_buf_len, total_ie_buf_len,
cfg_priv->extra_buf, cfg->extra_buf,
WL_EXTRA_BUF_MAX, bssidx); WL_EXTRA_BUF_MAX, bssidx);
if (err) if (err)
WL_ERR("vndr ie set error : %d\n", err); 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,7 +4175,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
struct brcmf_tlv *rsn_ie; struct brcmf_tlv *rsn_ie;
struct brcmf_vs_tlv *wpa_ie; struct brcmf_vs_tlv *wpa_ie;
struct brcmf_join_params join_params; struct brcmf_join_params join_params;
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
s32 bssidx = 0; s32 bssidx = 0;
WL_TRACE("channel_type=%d, beacon_interval=%d, dtim_period=%d,\n", 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,7 +4185,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
settings->ssid, settings->ssid_len, settings->auth_type, settings->ssid, settings->ssid_len, settings->auth_type,
settings->inactivity_timeout); settings->inactivity_timeout);
if (!test_bit(WL_STATUS_AP_CREATING, &cfg_priv->status)) { if (!test_bit(WL_STATUS_AP_CREATING, &cfg->status)) {
WL_ERR("Not in AP creation mode\n"); WL_ERR("Not in AP creation mode\n");
return -EPERM; return -EPERM;
} }
...@@ -4237,10 +4236,10 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, ...@@ -4237,10 +4236,10 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
wpa_ie = brcmf_find_wpaie((u8 *)settings->beacon.tail, wpa_ie = brcmf_find_wpaie((u8 *)settings->beacon.tail,
settings->beacon.tail_len); settings->beacon.tail_len);
kfree(cfg_priv->ap_info->rsn_ie); kfree(cfg->ap_info->rsn_ie);
cfg_priv->ap_info->rsn_ie = NULL; cfg->ap_info->rsn_ie = NULL;
kfree(cfg_priv->ap_info->wpa_ie); kfree(cfg->ap_info->wpa_ie);
cfg_priv->ap_info->wpa_ie = NULL; cfg->ap_info->wpa_ie = NULL;
if ((wpa_ie != NULL || rsn_ie != NULL)) { if ((wpa_ie != NULL || rsn_ie != NULL)) {
WL_TRACE("WPA(2) IE is found\n"); WL_TRACE("WPA(2) IE is found\n");
...@@ -4250,7 +4249,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, ...@@ -4250,7 +4249,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
bssidx); bssidx);
if (err < 0) if (err < 0)
goto exit; goto exit;
cfg_priv->ap_info->wpa_ie = kmemdup(wpa_ie, cfg->ap_info->wpa_ie = kmemdup(wpa_ie,
wpa_ie->len + wpa_ie->len +
TLV_HDR_LEN, TLV_HDR_LEN,
GFP_KERNEL); GFP_KERNEL);
...@@ -4260,19 +4259,19 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, ...@@ -4260,19 +4259,19 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
(struct brcmf_vs_tlv *)rsn_ie, true, bssidx); (struct brcmf_vs_tlv *)rsn_ie, true, bssidx);
if (err < 0) if (err < 0)
goto exit; goto exit;
cfg_priv->ap_info->rsn_ie = kmemdup(rsn_ie, cfg->ap_info->rsn_ie = kmemdup(rsn_ie,
rsn_ie->len + rsn_ie->len +
TLV_HDR_LEN, TLV_HDR_LEN,
GFP_KERNEL); GFP_KERNEL);
} }
cfg_priv->ap_info->security_mode = true; cfg->ap_info->security_mode = true;
} else { } else {
WL_TRACE("No WPA(2) IEs found\n"); WL_TRACE("No WPA(2) IEs found\n");
brcmf_configure_opensecurity(ndev, bssidx); brcmf_configure_opensecurity(ndev, bssidx);
cfg_priv->ap_info->security_mode = false; cfg->ap_info->security_mode = false;
} }
/* Set Beacon IEs to FW */ /* Set Beacon IEs to FW */
err = brcmf_set_management_ie(cfg_priv, ndev, bssidx, err = brcmf_set_management_ie(cfg, ndev, bssidx,
VNDR_IE_BEACON_FLAG, VNDR_IE_BEACON_FLAG,
(u8 *)settings->beacon.tail, (u8 *)settings->beacon.tail,
settings->beacon.tail_len); settings->beacon.tail_len);
...@@ -4282,7 +4281,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, ...@@ -4282,7 +4281,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
WL_TRACE("Applied Vndr IEs for Beacon\n"); WL_TRACE("Applied Vndr IEs for Beacon\n");
/* Set Probe Response IEs to FW */ /* Set Probe Response IEs to FW */
err = brcmf_set_management_ie(cfg_priv, ndev, bssidx, err = brcmf_set_management_ie(cfg, ndev, bssidx,
VNDR_IE_PRBRSP_FLAG, VNDR_IE_PRBRSP_FLAG,
(u8 *)settings->beacon.proberesp_ies, (u8 *)settings->beacon.proberesp_ies,
settings->beacon.proberesp_ies_len); settings->beacon.proberesp_ies_len);
...@@ -4326,8 +4325,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, ...@@ -4326,8 +4325,8 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
WL_ERR("SET SSID error (%d)\n", err); WL_ERR("SET SSID error (%d)\n", err);
goto exit; goto exit;
} }
clear_bit(WL_STATUS_AP_CREATING, &cfg_priv->status); clear_bit(WL_STATUS_AP_CREATING, &cfg->status);
set_bit(WL_STATUS_AP_CREATED, &cfg_priv->status); set_bit(WL_STATUS_AP_CREATED, &cfg->status);
exit: exit:
if (err) if (err)
...@@ -4337,13 +4336,13 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, ...@@ -4337,13 +4336,13 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
{ {
struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
s32 ioctl_value; s32 ioctl_value;
s32 err = -EPERM; s32 err = -EPERM;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (cfg_priv->conf->mode == WL_MODE_AP) { if (cfg->conf->mode == WL_MODE_AP) {
/* Due to most likely deauths outstanding we sleep */ /* Due to most likely deauths outstanding we sleep */
/* first to make sure they get processed by fw. */ /* first to make sure they get processed by fw. */
msleep(400); msleep(400);
...@@ -4360,8 +4359,8 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) ...@@ -4360,8 +4359,8 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
goto exit; goto exit;
} }
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ndev, 1);
clear_bit(WL_STATUS_AP_CREATING, &cfg_priv->status); clear_bit(WL_STATUS_AP_CREATING, &cfg->status);
clear_bit(WL_STATUS_AP_CREATED, &cfg_priv->status); clear_bit(WL_STATUS_AP_CREATED, &cfg->status);
} }
exit: exit:
return err; return err;
...@@ -4466,7 +4465,7 @@ static struct wireless_dev *brcmf_alloc_wdev(struct device *ndev) ...@@ -4466,7 +4465,7 @@ static struct wireless_dev *brcmf_alloc_wdev(struct device *ndev)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
wdev->wiphy = wiphy_new(&wl_cfg80211_ops, wdev->wiphy = wiphy_new(&wl_cfg80211_ops,
sizeof(struct brcmf_cfg80211_priv)); sizeof(struct brcmf_cfg80211_info));
if (!wdev->wiphy) { if (!wdev->wiphy) {
WL_ERR("Could not allocate wiphy device\n"); WL_ERR("Could not allocate wiphy device\n");
err = -ENOMEM; err = -ENOMEM;
...@@ -4510,9 +4509,9 @@ static struct wireless_dev *brcmf_alloc_wdev(struct device *ndev) ...@@ -4510,9 +4509,9 @@ static struct wireless_dev *brcmf_alloc_wdev(struct device *ndev)
return ERR_PTR(err); return ERR_PTR(err);
} }
static void brcmf_free_wdev(struct brcmf_cfg80211_priv *cfg_priv) static void brcmf_free_wdev(struct brcmf_cfg80211_info *cfg)
{ {
struct wireless_dev *wdev = cfg_priv->wdev; struct wireless_dev *wdev = cfg->wdev;
if (!wdev) { if (!wdev) {
WL_ERR("wdev is invalid\n"); WL_ERR("wdev is invalid\n");
...@@ -4521,10 +4520,10 @@ static void brcmf_free_wdev(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -4521,10 +4520,10 @@ static void brcmf_free_wdev(struct brcmf_cfg80211_priv *cfg_priv)
wiphy_unregister(wdev->wiphy); wiphy_unregister(wdev->wiphy);
wiphy_free(wdev->wiphy); wiphy_free(wdev->wiphy);
kfree(wdev); kfree(wdev);
cfg_priv->wdev = NULL; cfg->wdev = NULL;
} }
static bool brcmf_is_linkup(struct brcmf_cfg80211_priv *cfg_priv, static bool brcmf_is_linkup(struct brcmf_cfg80211_info *cfg,
const struct brcmf_event_msg *e) const struct brcmf_event_msg *e)
{ {
u32 event = be32_to_cpu(e->event_type); u32 event = be32_to_cpu(e->event_type);
...@@ -4532,14 +4531,14 @@ static bool brcmf_is_linkup(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4532,14 +4531,14 @@ static bool brcmf_is_linkup(struct brcmf_cfg80211_priv *cfg_priv,
if (event == BRCMF_E_SET_SSID && status == BRCMF_E_STATUS_SUCCESS) { if (event == BRCMF_E_SET_SSID && status == BRCMF_E_STATUS_SUCCESS) {
WL_CONN("Processing set ssid\n"); WL_CONN("Processing set ssid\n");
cfg_priv->link_up = true; cfg->link_up = true;
return true; return true;
} }
return false; return false;
} }
static bool brcmf_is_linkdown(struct brcmf_cfg80211_priv *cfg_priv, static bool brcmf_is_linkdown(struct brcmf_cfg80211_info *cfg,
const struct brcmf_event_msg *e) const struct brcmf_event_msg *e)
{ {
u32 event = be32_to_cpu(e->event_type); u32 event = be32_to_cpu(e->event_type);
...@@ -4552,7 +4551,7 @@ static bool brcmf_is_linkdown(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4552,7 +4551,7 @@ static bool brcmf_is_linkdown(struct brcmf_cfg80211_priv *cfg_priv,
return false; return false;
} }
static bool brcmf_is_nonetwork(struct brcmf_cfg80211_priv *cfg_priv, static bool brcmf_is_nonetwork(struct brcmf_cfg80211_info *cfg,
const struct brcmf_event_msg *e) const struct brcmf_event_msg *e)
{ {
u32 event = be32_to_cpu(e->event_type); u32 event = be32_to_cpu(e->event_type);
...@@ -4573,9 +4572,9 @@ static bool brcmf_is_nonetwork(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4573,9 +4572,9 @@ static bool brcmf_is_nonetwork(struct brcmf_cfg80211_priv *cfg_priv,
return false; return false;
} }
static void brcmf_clear_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv) static void brcmf_clear_assoc_ies(struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg_priv); struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
kfree(conn_info->req_ie); kfree(conn_info->req_ie);
conn_info->req_ie = NULL; conn_info->req_ie = NULL;
...@@ -4585,30 +4584,30 @@ static void brcmf_clear_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -4585,30 +4584,30 @@ static void brcmf_clear_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
conn_info->resp_ie_len = 0; conn_info->resp_ie_len = 0;
} }
static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg)
{ {
struct net_device *ndev = cfg_to_ndev(cfg_priv); struct net_device *ndev = cfg_to_ndev(cfg);
struct brcmf_cfg80211_assoc_ielen_le *assoc_info; struct brcmf_cfg80211_assoc_ielen_le *assoc_info;
struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg_priv); struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
u32 req_len; u32 req_len;
u32 resp_len; u32 resp_len;
s32 err = 0; s32 err = 0;
brcmf_clear_assoc_ies(cfg_priv); brcmf_clear_assoc_ies(cfg);
err = brcmf_dev_bufvar_get(ndev, "assoc_info", cfg_priv->extra_buf, err = brcmf_dev_bufvar_get(ndev, "assoc_info", cfg->extra_buf,
WL_ASSOC_INFO_MAX); WL_ASSOC_INFO_MAX);
if (err) { if (err) {
WL_ERR("could not get assoc info (%d)\n", err); WL_ERR("could not get assoc info (%d)\n", err);
return err; return err;
} }
assoc_info = assoc_info =
(struct brcmf_cfg80211_assoc_ielen_le *)cfg_priv->extra_buf; (struct brcmf_cfg80211_assoc_ielen_le *)cfg->extra_buf;
req_len = le32_to_cpu(assoc_info->req_len); req_len = le32_to_cpu(assoc_info->req_len);
resp_len = le32_to_cpu(assoc_info->resp_len); resp_len = le32_to_cpu(assoc_info->resp_len);
if (req_len) { if (req_len) {
err = brcmf_dev_bufvar_get(ndev, "assoc_req_ies", err = brcmf_dev_bufvar_get(ndev, "assoc_req_ies",
cfg_priv->extra_buf, cfg->extra_buf,
WL_ASSOC_INFO_MAX); WL_ASSOC_INFO_MAX);
if (err) { if (err) {
WL_ERR("could not get assoc req (%d)\n", err); 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,7 +4615,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
} }
conn_info->req_ie_len = req_len; conn_info->req_ie_len = req_len;
conn_info->req_ie = conn_info->req_ie =
kmemdup(cfg_priv->extra_buf, conn_info->req_ie_len, kmemdup(cfg->extra_buf, conn_info->req_ie_len,
GFP_KERNEL); GFP_KERNEL);
} else { } else {
conn_info->req_ie_len = 0; conn_info->req_ie_len = 0;
...@@ -4624,7 +4623,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -4624,7 +4623,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
} }
if (resp_len) { if (resp_len) {
err = brcmf_dev_bufvar_get(ndev, "assoc_resp_ies", err = brcmf_dev_bufvar_get(ndev, "assoc_resp_ies",
cfg_priv->extra_buf, cfg->extra_buf,
WL_ASSOC_INFO_MAX); WL_ASSOC_INFO_MAX);
if (err) { if (err) {
WL_ERR("could not get assoc resp (%d)\n", err); 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,7 +4631,7 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
} }
conn_info->resp_ie_len = resp_len; conn_info->resp_ie_len = resp_len;
conn_info->resp_ie = conn_info->resp_ie =
kmemdup(cfg_priv->extra_buf, conn_info->resp_ie_len, kmemdup(cfg->extra_buf, conn_info->resp_ie_len,
GFP_KERNEL); GFP_KERNEL);
} else { } else {
conn_info->resp_ie_len = 0; conn_info->resp_ie_len = 0;
...@@ -4645,12 +4644,12 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -4645,12 +4644,12 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv)
} }
static s32 static s32
brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv, brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, struct net_device *ndev,
const struct brcmf_event_msg *e) const struct brcmf_event_msg *e)
{ {
struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg_priv); struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
struct wiphy *wiphy = cfg_to_wiphy(cfg_priv); struct wiphy *wiphy = cfg_to_wiphy(cfg);
struct brcmf_channel_info_le channel_le; struct brcmf_channel_info_le channel_le;
struct ieee80211_channel *notify_channel; struct ieee80211_channel *notify_channel;
struct ieee80211_supported_band *band; struct ieee80211_supported_band *band;
...@@ -4660,9 +4659,9 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4660,9 +4659,9 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv,
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
brcmf_get_assoc_ies(cfg_priv); brcmf_get_assoc_ies(cfg);
brcmf_update_prof(cfg_priv, NULL, &e->addr, WL_PROF_BSSID); brcmf_update_prof(cfg, NULL, &e->addr, WL_PROF_BSSID);
brcmf_update_bss_info(cfg_priv); brcmf_update_bss_info(cfg);
brcmf_exec_dcmd(ndev, BRCMF_C_GET_CHANNEL, &channel_le, brcmf_exec_dcmd(ndev, BRCMF_C_GET_CHANNEL, &channel_le,
sizeof(channel_le)); sizeof(channel_le));
...@@ -4679,35 +4678,35 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4679,35 +4678,35 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv,
notify_channel = ieee80211_get_channel(wiphy, freq); notify_channel = ieee80211_get_channel(wiphy, freq);
cfg80211_roamed(ndev, notify_channel, cfg80211_roamed(ndev, notify_channel,
(u8 *)brcmf_read_prof(cfg_priv, WL_PROF_BSSID), (u8 *)brcmf_read_prof(cfg, WL_PROF_BSSID),
conn_info->req_ie, conn_info->req_ie_len, conn_info->req_ie, conn_info->req_ie_len,
conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
WL_CONN("Report roaming result\n"); WL_CONN("Report roaming result\n");
set_bit(WL_STATUS_CONNECTED, &cfg_priv->status); set_bit(WL_STATUS_CONNECTED, &cfg->status);
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
return err; return err;
} }
static s32 static s32
brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv, brcmf_bss_connect_done(struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, const struct brcmf_event_msg *e, struct net_device *ndev, const struct brcmf_event_msg *e,
bool completed) bool completed)
{ {
struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg_priv); struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
s32 err = 0; s32 err = 0;
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (test_and_clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) { if (test_and_clear_bit(WL_STATUS_CONNECTING, &cfg->status)) {
if (completed) { if (completed) {
brcmf_get_assoc_ies(cfg_priv); brcmf_get_assoc_ies(cfg);
brcmf_update_prof(cfg_priv, NULL, &e->addr, brcmf_update_prof(cfg, NULL, &e->addr,
WL_PROF_BSSID); WL_PROF_BSSID);
brcmf_update_bss_info(cfg_priv); brcmf_update_bss_info(cfg);
} }
cfg80211_connect_result(ndev, cfg80211_connect_result(ndev,
(u8 *)brcmf_read_prof(cfg_priv, (u8 *)brcmf_read_prof(cfg,
WL_PROF_BSSID), WL_PROF_BSSID),
conn_info->req_ie, conn_info->req_ie,
conn_info->req_ie_len, conn_info->req_ie_len,
...@@ -4717,7 +4716,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4717,7 +4716,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv,
WLAN_STATUS_AUTH_TIMEOUT, WLAN_STATUS_AUTH_TIMEOUT,
GFP_KERNEL); GFP_KERNEL);
if (completed) if (completed)
set_bit(WL_STATUS_CONNECTED, &cfg_priv->status); set_bit(WL_STATUS_CONNECTED, &cfg->status);
WL_CONN("Report connect result - connection %s\n", WL_CONN("Report connect result - connection %s\n",
completed ? "succeeded" : "failed"); completed ? "succeeded" : "failed");
} }
...@@ -4726,7 +4725,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4726,7 +4725,7 @@ brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv,
} }
static s32 static s32
brcmf_notify_connect_status_ap(struct brcmf_cfg80211_priv *cfg_priv, brcmf_notify_connect_status_ap(struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, struct net_device *ndev,
const struct brcmf_event_msg *e, void *data) const struct brcmf_event_msg *e, void *data)
{ {
...@@ -4765,54 +4764,54 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4765,54 +4764,54 @@ brcmf_notify_connect_status_ap(struct brcmf_cfg80211_priv *cfg_priv,
} }
static s32 static s32
brcmf_notify_connect_status(struct brcmf_cfg80211_priv *cfg_priv, brcmf_notify_connect_status(struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, struct net_device *ndev,
const struct brcmf_event_msg *e, void *data) const struct brcmf_event_msg *e, void *data)
{ {
s32 err = 0; s32 err = 0;
if (cfg_priv->conf->mode == WL_MODE_AP) { if (cfg->conf->mode == WL_MODE_AP) {
err = brcmf_notify_connect_status_ap(cfg_priv, ndev, e, data); err = brcmf_notify_connect_status_ap(cfg, ndev, e, data);
} else if (brcmf_is_linkup(cfg_priv, e)) { } else if (brcmf_is_linkup(cfg, e)) {
WL_CONN("Linkup\n"); WL_CONN("Linkup\n");
if (brcmf_is_ibssmode(cfg_priv)) { if (brcmf_is_ibssmode(cfg)) {
brcmf_update_prof(cfg_priv, NULL, (void *)e->addr, brcmf_update_prof(cfg, NULL, (void *)e->addr,
WL_PROF_BSSID); WL_PROF_BSSID);
wl_inform_ibss(cfg_priv, ndev, e->addr); wl_inform_ibss(cfg, ndev, e->addr);
cfg80211_ibss_joined(ndev, e->addr, GFP_KERNEL); cfg80211_ibss_joined(ndev, e->addr, GFP_KERNEL);
clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status); clear_bit(WL_STATUS_CONNECTING, &cfg->status);
set_bit(WL_STATUS_CONNECTED, &cfg_priv->status); set_bit(WL_STATUS_CONNECTED, &cfg->status);
} else } else
brcmf_bss_connect_done(cfg_priv, ndev, e, true); brcmf_bss_connect_done(cfg, ndev, e, true);
} else if (brcmf_is_linkdown(cfg_priv, e)) { } else if (brcmf_is_linkdown(cfg, e)) {
WL_CONN("Linkdown\n"); WL_CONN("Linkdown\n");
if (brcmf_is_ibssmode(cfg_priv)) { if (brcmf_is_ibssmode(cfg)) {
clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status); clear_bit(WL_STATUS_CONNECTING, &cfg->status);
if (test_and_clear_bit(WL_STATUS_CONNECTED, if (test_and_clear_bit(WL_STATUS_CONNECTED,
&cfg_priv->status)) &cfg->status))
brcmf_link_down(cfg_priv); brcmf_link_down(cfg);
} else { } else {
brcmf_bss_connect_done(cfg_priv, ndev, e, false); brcmf_bss_connect_done(cfg, ndev, e, false);
if (test_and_clear_bit(WL_STATUS_CONNECTED, if (test_and_clear_bit(WL_STATUS_CONNECTED,
&cfg_priv->status)) { &cfg->status)) {
cfg80211_disconnected(ndev, 0, NULL, 0, cfg80211_disconnected(ndev, 0, NULL, 0,
GFP_KERNEL); GFP_KERNEL);
brcmf_link_down(cfg_priv); brcmf_link_down(cfg);
} }
} }
brcmf_init_prof(cfg_priv->profile); brcmf_init_prof(cfg->profile);
} else if (brcmf_is_nonetwork(cfg_priv, e)) { } else if (brcmf_is_nonetwork(cfg, e)) {
if (brcmf_is_ibssmode(cfg_priv)) if (brcmf_is_ibssmode(cfg))
clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status); clear_bit(WL_STATUS_CONNECTING, &cfg->status);
else else
brcmf_bss_connect_done(cfg_priv, ndev, e, false); brcmf_bss_connect_done(cfg, ndev, e, false);
} }
return err; return err;
} }
static s32 static s32
brcmf_notify_roaming_status(struct brcmf_cfg80211_priv *cfg_priv, brcmf_notify_roaming_status(struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, struct net_device *ndev,
const struct brcmf_event_msg *e, void *data) const struct brcmf_event_msg *e, void *data)
{ {
...@@ -4821,17 +4820,17 @@ brcmf_notify_roaming_status(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4821,17 +4820,17 @@ brcmf_notify_roaming_status(struct brcmf_cfg80211_priv *cfg_priv,
u32 status = be32_to_cpu(e->status); u32 status = be32_to_cpu(e->status);
if (event == BRCMF_E_ROAM && status == BRCMF_E_STATUS_SUCCESS) { if (event == BRCMF_E_ROAM && status == BRCMF_E_STATUS_SUCCESS) {
if (test_bit(WL_STATUS_CONNECTED, &cfg_priv->status)) if (test_bit(WL_STATUS_CONNECTED, &cfg->status))
brcmf_bss_roaming_done(cfg_priv, ndev, e); brcmf_bss_roaming_done(cfg, ndev, e);
else else
brcmf_bss_connect_done(cfg_priv, ndev, e, true); brcmf_bss_connect_done(cfg, ndev, e, true);
} }
return err; return err;
} }
static s32 static s32
brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv, brcmf_notify_mic_status(struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, struct net_device *ndev,
const struct brcmf_event_msg *e, void *data) const struct brcmf_event_msg *e, void *data)
{ {
...@@ -4850,7 +4849,7 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4850,7 +4849,7 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv,
} }
static s32 static s32
brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv, brcmf_notify_scan_status(struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, struct net_device *ndev,
const struct brcmf_event_msg *e, void *data) const struct brcmf_event_msg *e, void *data)
{ {
...@@ -4863,12 +4862,12 @@ brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4863,12 +4862,12 @@ brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
WL_TRACE("Enter\n"); WL_TRACE("Enter\n");
if (cfg_priv->iscan_on && cfg_priv->iscan_kickstart) { if (cfg->iscan_on && cfg->iscan_kickstart) {
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
return brcmf_wakeup_iscan(cfg_to_iscan(cfg_priv)); return brcmf_wakeup_iscan(cfg_to_iscan(cfg));
} }
if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg_priv->status)) { if (!test_and_clear_bit(WL_STATUS_SCANNING, &cfg->status)) {
WL_ERR("Scan complete while device not scanning\n"); WL_ERR("Scan complete while device not scanning\n");
scan_abort = true; scan_abort = true;
err = -EINVAL; err = -EINVAL;
...@@ -4885,33 +4884,33 @@ brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv, ...@@ -4885,33 +4884,33 @@ brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv,
scan_channel = le32_to_cpu(channel_inform_le.scan_channel); scan_channel = le32_to_cpu(channel_inform_le.scan_channel);
if (scan_channel) if (scan_channel)
WL_CONN("channel_inform.scan_channel (%d)\n", scan_channel); WL_CONN("channel_inform.scan_channel (%d)\n", scan_channel);
cfg_priv->bss_list = cfg_priv->scan_results; cfg->bss_list = cfg->scan_results;
bss_list_le = (struct brcmf_scan_results_le *) cfg_priv->bss_list; bss_list_le = (struct brcmf_scan_results_le *) cfg->bss_list;
memset(cfg_priv->scan_results, 0, len); memset(cfg->scan_results, 0, len);
bss_list_le->buflen = cpu_to_le32(len); bss_list_le->buflen = cpu_to_le32(len);
err = brcmf_exec_dcmd(ndev, BRCMF_C_SCAN_RESULTS, err = brcmf_exec_dcmd(ndev, BRCMF_C_SCAN_RESULTS,
cfg_priv->scan_results, len); cfg->scan_results, len);
if (err) { if (err) {
WL_ERR("%s Scan_results error (%d)\n", ndev->name, err); WL_ERR("%s Scan_results error (%d)\n", ndev->name, err);
err = -EINVAL; err = -EINVAL;
scan_abort = true; scan_abort = true;
goto scan_done_out; goto scan_done_out;
} }
cfg_priv->scan_results->buflen = le32_to_cpu(bss_list_le->buflen); cfg->scan_results->buflen = le32_to_cpu(bss_list_le->buflen);
cfg_priv->scan_results->version = le32_to_cpu(bss_list_le->version); cfg->scan_results->version = le32_to_cpu(bss_list_le->version);
cfg_priv->scan_results->count = le32_to_cpu(bss_list_le->count); cfg->scan_results->count = le32_to_cpu(bss_list_le->count);
err = brcmf_inform_bss(cfg_priv); err = brcmf_inform_bss(cfg);
if (err) if (err)
scan_abort = true; scan_abort = true;
scan_done_out: scan_done_out:
if (cfg_priv->scan_request) { if (cfg->scan_request) {
WL_SCAN("calling cfg80211_scan_done\n"); WL_SCAN("calling cfg80211_scan_done\n");
cfg80211_scan_done(cfg_priv->scan_request, scan_abort); cfg80211_scan_done(cfg->scan_request, scan_abort);
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ndev, 1);
cfg_priv->scan_request = NULL; cfg->scan_request = NULL;
} }
WL_TRACE("Exit\n"); WL_TRACE("Exit\n");
...@@ -4945,74 +4944,74 @@ static void brcmf_init_eloop_handler(struct brcmf_cfg80211_event_loop *el) ...@@ -4945,74 +4944,74 @@ static void brcmf_init_eloop_handler(struct brcmf_cfg80211_event_loop *el)
el->handler[BRCMF_E_PFN_NET_FOUND] = brcmf_notify_sched_scan_results; el->handler[BRCMF_E_PFN_NET_FOUND] = brcmf_notify_sched_scan_results;
} }
static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_priv *cfg_priv) static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_info *cfg)
{ {
kfree(cfg_priv->scan_results); kfree(cfg->scan_results);
cfg_priv->scan_results = NULL; cfg->scan_results = NULL;
kfree(cfg_priv->bss_info); kfree(cfg->bss_info);
cfg_priv->bss_info = NULL; cfg->bss_info = NULL;
kfree(cfg_priv->conf); kfree(cfg->conf);
cfg_priv->conf = NULL; cfg->conf = NULL;
kfree(cfg_priv->profile); kfree(cfg->profile);
cfg_priv->profile = NULL; cfg->profile = NULL;
kfree(cfg_priv->scan_req_int); kfree(cfg->scan_req_int);
cfg_priv->scan_req_int = NULL; cfg->scan_req_int = NULL;
kfree(cfg_priv->escan_ioctl_buf); kfree(cfg->escan_ioctl_buf);
cfg_priv->escan_ioctl_buf = NULL; cfg->escan_ioctl_buf = NULL;
kfree(cfg_priv->dcmd_buf); kfree(cfg->dcmd_buf);
cfg_priv->dcmd_buf = NULL; cfg->dcmd_buf = NULL;
kfree(cfg_priv->extra_buf); kfree(cfg->extra_buf);
cfg_priv->extra_buf = NULL; cfg->extra_buf = NULL;
kfree(cfg_priv->iscan); kfree(cfg->iscan);
cfg_priv->iscan = NULL; cfg->iscan = NULL;
kfree(cfg_priv->pmk_list); kfree(cfg->pmk_list);
cfg_priv->pmk_list = NULL; cfg->pmk_list = NULL;
if (cfg_priv->ap_info) { if (cfg->ap_info) {
kfree(cfg_priv->ap_info->wpa_ie); kfree(cfg->ap_info->wpa_ie);
kfree(cfg_priv->ap_info->rsn_ie); kfree(cfg->ap_info->rsn_ie);
kfree(cfg_priv->ap_info); kfree(cfg->ap_info);
cfg_priv->ap_info = NULL; cfg->ap_info = NULL;
} }
} }
static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_info *cfg)
{ {
cfg_priv->scan_results = kzalloc(WL_SCAN_BUF_MAX, GFP_KERNEL); cfg->scan_results = kzalloc(WL_SCAN_BUF_MAX, GFP_KERNEL);
if (!cfg_priv->scan_results) if (!cfg->scan_results)
goto init_priv_mem_out; goto init_priv_mem_out;
cfg_priv->conf = kzalloc(sizeof(*cfg_priv->conf), GFP_KERNEL); cfg->conf = kzalloc(sizeof(*cfg->conf), GFP_KERNEL);
if (!cfg_priv->conf) if (!cfg->conf)
goto init_priv_mem_out; goto init_priv_mem_out;
cfg_priv->profile = kzalloc(sizeof(*cfg_priv->profile), GFP_KERNEL); cfg->profile = kzalloc(sizeof(*cfg->profile), GFP_KERNEL);
if (!cfg_priv->profile) if (!cfg->profile)
goto init_priv_mem_out; goto init_priv_mem_out;
cfg_priv->bss_info = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL); cfg->bss_info = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
if (!cfg_priv->bss_info) if (!cfg->bss_info)
goto init_priv_mem_out; goto init_priv_mem_out;
cfg_priv->scan_req_int = kzalloc(sizeof(*cfg_priv->scan_req_int), cfg->scan_req_int = kzalloc(sizeof(*cfg->scan_req_int),
GFP_KERNEL); GFP_KERNEL);
if (!cfg_priv->scan_req_int) if (!cfg->scan_req_int)
goto init_priv_mem_out; goto init_priv_mem_out;
cfg_priv->escan_ioctl_buf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL); cfg->escan_ioctl_buf = kzalloc(BRCMF_DCMD_MEDLEN, GFP_KERNEL);
if (!cfg_priv->escan_ioctl_buf) if (!cfg->escan_ioctl_buf)
goto init_priv_mem_out; goto init_priv_mem_out;
cfg_priv->dcmd_buf = kzalloc(WL_DCMD_LEN_MAX, GFP_KERNEL); cfg->dcmd_buf = kzalloc(WL_DCMD_LEN_MAX, GFP_KERNEL);
if (!cfg_priv->dcmd_buf) if (!cfg->dcmd_buf)
goto init_priv_mem_out; goto init_priv_mem_out;
cfg_priv->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); cfg->extra_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
if (!cfg_priv->extra_buf) if (!cfg->extra_buf)
goto init_priv_mem_out; goto init_priv_mem_out;
cfg_priv->iscan = kzalloc(sizeof(*cfg_priv->iscan), GFP_KERNEL); cfg->iscan = kzalloc(sizeof(*cfg->iscan), GFP_KERNEL);
if (!cfg_priv->iscan) if (!cfg->iscan)
goto init_priv_mem_out; goto init_priv_mem_out;
cfg_priv->pmk_list = kzalloc(sizeof(*cfg_priv->pmk_list), GFP_KERNEL); cfg->pmk_list = kzalloc(sizeof(*cfg->pmk_list), GFP_KERNEL);
if (!cfg_priv->pmk_list) if (!cfg->pmk_list)
goto init_priv_mem_out; goto init_priv_mem_out;
return 0; return 0;
init_priv_mem_out: init_priv_mem_out:
brcmf_deinit_priv_mem(cfg_priv); brcmf_deinit_priv_mem(cfg);
return -ENOMEM; return -ENOMEM;
} }
...@@ -5022,17 +5021,17 @@ static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -5022,17 +5021,17 @@ static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_priv *cfg_priv)
*/ */
static struct brcmf_cfg80211_event_q *brcmf_deq_event( static struct brcmf_cfg80211_event_q *brcmf_deq_event(
struct brcmf_cfg80211_priv *cfg_priv) struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_cfg80211_event_q *e = NULL; struct brcmf_cfg80211_event_q *e = NULL;
spin_lock_irq(&cfg_priv->evt_q_lock); spin_lock_irq(&cfg->evt_q_lock);
if (!list_empty(&cfg_priv->evt_q_list)) { if (!list_empty(&cfg->evt_q_list)) {
e = list_first_entry(&cfg_priv->evt_q_list, e = list_first_entry(&cfg->evt_q_list,
struct brcmf_cfg80211_event_q, evt_q_list); struct brcmf_cfg80211_event_q, evt_q_list);
list_del(&e->evt_q_list); list_del(&e->evt_q_list);
} }
spin_unlock_irq(&cfg_priv->evt_q_lock); spin_unlock_irq(&cfg->evt_q_lock);
return e; return e;
} }
...@@ -5044,7 +5043,7 @@ static struct brcmf_cfg80211_event_q *brcmf_deq_event( ...@@ -5044,7 +5043,7 @@ static struct brcmf_cfg80211_event_q *brcmf_deq_event(
*/ */
static s32 static s32
brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 event, brcmf_enq_event(struct brcmf_cfg80211_info *cfg, u32 event,
const struct brcmf_event_msg *msg, void *data) const struct brcmf_event_msg *msg, void *data)
{ {
struct brcmf_cfg80211_event_q *e; struct brcmf_cfg80211_event_q *e;
...@@ -5068,9 +5067,9 @@ brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 event, ...@@ -5068,9 +5067,9 @@ brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 event,
if (data) if (data)
memcpy(&e->edata, data, data_len); memcpy(&e->edata, data, data_len);
spin_lock_irqsave(&cfg_priv->evt_q_lock, flags); spin_lock_irqsave(&cfg->evt_q_lock, flags);
list_add_tail(&e->evt_q_list, &cfg_priv->evt_q_list); list_add_tail(&e->evt_q_list, &cfg->evt_q_list);
spin_unlock_irqrestore(&cfg_priv->evt_q_lock, flags); spin_unlock_irqrestore(&cfg->evt_q_lock, flags);
return err; return err;
} }
...@@ -5082,12 +5081,12 @@ static void brcmf_put_event(struct brcmf_cfg80211_event_q *e) ...@@ -5082,12 +5081,12 @@ static void brcmf_put_event(struct brcmf_cfg80211_event_q *e)
static void brcmf_cfg80211_event_handler(struct work_struct *work) static void brcmf_cfg80211_event_handler(struct work_struct *work)
{ {
struct brcmf_cfg80211_priv *cfg_priv = struct brcmf_cfg80211_info *cfg =
container_of(work, struct brcmf_cfg80211_priv, container_of(work, struct brcmf_cfg80211_info,
event_work); event_work);
struct brcmf_cfg80211_event_q *e; struct brcmf_cfg80211_event_q *e;
e = brcmf_deq_event(cfg_priv); e = brcmf_deq_event(cfg);
if (unlikely(!e)) { if (unlikely(!e)) {
WL_ERR("event queue empty...\n"); WL_ERR("event queue empty...\n");
return; return;
...@@ -5095,95 +5094,95 @@ static void brcmf_cfg80211_event_handler(struct work_struct *work) ...@@ -5095,95 +5094,95 @@ static void brcmf_cfg80211_event_handler(struct work_struct *work)
do { do {
WL_INFO("event type (%d)\n", e->etype); WL_INFO("event type (%d)\n", e->etype);
if (cfg_priv->el.handler[e->etype]) if (cfg->el.handler[e->etype])
cfg_priv->el.handler[e->etype](cfg_priv, cfg->el.handler[e->etype](cfg,
cfg_to_ndev(cfg_priv), cfg_to_ndev(cfg),
&e->emsg, e->edata); &e->emsg, e->edata);
else else
WL_INFO("Unknown Event (%d): ignoring\n", e->etype); WL_INFO("Unknown Event (%d): ignoring\n", e->etype);
brcmf_put_event(e); brcmf_put_event(e);
} while ((e = brcmf_deq_event(cfg_priv))); } while ((e = brcmf_deq_event(cfg)));
} }
static void brcmf_init_eq(struct brcmf_cfg80211_priv *cfg_priv) static void brcmf_init_eq(struct brcmf_cfg80211_info *cfg)
{ {
spin_lock_init(&cfg_priv->evt_q_lock); spin_lock_init(&cfg->evt_q_lock);
INIT_LIST_HEAD(&cfg_priv->evt_q_list); INIT_LIST_HEAD(&cfg->evt_q_list);
} }
static void brcmf_flush_eq(struct brcmf_cfg80211_priv *cfg_priv) static void brcmf_flush_eq(struct brcmf_cfg80211_info *cfg)
{ {
struct brcmf_cfg80211_event_q *e; struct brcmf_cfg80211_event_q *e;
spin_lock_irq(&cfg_priv->evt_q_lock); spin_lock_irq(&cfg->evt_q_lock);
while (!list_empty(&cfg_priv->evt_q_list)) { while (!list_empty(&cfg->evt_q_list)) {
e = list_first_entry(&cfg_priv->evt_q_list, e = list_first_entry(&cfg->evt_q_list,
struct brcmf_cfg80211_event_q, evt_q_list); struct brcmf_cfg80211_event_q, evt_q_list);
list_del(&e->evt_q_list); list_del(&e->evt_q_list);
kfree(e); kfree(e);
} }
spin_unlock_irq(&cfg_priv->evt_q_lock); spin_unlock_irq(&cfg->evt_q_lock);
} }
static s32 wl_init_priv(struct brcmf_cfg80211_priv *cfg_priv) static s32 wl_init_priv(struct brcmf_cfg80211_info *cfg)
{ {
s32 err = 0; s32 err = 0;
cfg_priv->scan_request = NULL; cfg->scan_request = NULL;
cfg_priv->pwr_save = true; cfg->pwr_save = true;
#ifdef CONFIG_BRCMISCAN #ifdef CONFIG_BRCMISCAN
cfg_priv->iscan_on = true; /* iscan on & off switch. cfg->iscan_on = true; /* iscan on & off switch.
we enable iscan per default */ we enable iscan per default */
cfg_priv->escan_on = false; /* escan on & off switch. cfg->escan_on = false; /* escan on & off switch.
we disable escan per default */ we disable escan per default */
#else #else
cfg_priv->iscan_on = false; /* iscan on & off switch. cfg->iscan_on = false; /* iscan on & off switch.
we disable iscan per default */ we disable iscan per default */
cfg_priv->escan_on = true; /* escan on & off switch. cfg->escan_on = true; /* escan on & off switch.
we enable escan per default */ we enable escan per default */
#endif #endif
cfg_priv->roam_on = true; /* roam on & off switch. cfg->roam_on = true; /* roam on & off switch.
we enable roam per default */ we enable roam per default */
cfg_priv->iscan_kickstart = false; cfg->iscan_kickstart = false;
cfg_priv->active_scan = true; /* we do active scan for cfg->active_scan = true; /* we do active scan for
specific scan per default */ specific scan per default */
cfg_priv->dongle_up = false; /* dongle is not up yet */ cfg->dongle_up = false; /* dongle is not up yet */
brcmf_init_eq(cfg_priv); brcmf_init_eq(cfg);
err = brcmf_init_priv_mem(cfg_priv); err = brcmf_init_priv_mem(cfg);
if (err) if (err)
return err; return err;
INIT_WORK(&cfg_priv->event_work, brcmf_cfg80211_event_handler); INIT_WORK(&cfg->event_work, brcmf_cfg80211_event_handler);
brcmf_init_eloop_handler(&cfg_priv->el); brcmf_init_eloop_handler(&cfg->el);
mutex_init(&cfg_priv->usr_sync); mutex_init(&cfg->usr_sync);
err = brcmf_init_iscan(cfg_priv); err = brcmf_init_iscan(cfg);
if (err) if (err)
return err; return err;
brcmf_init_escan(cfg_priv); brcmf_init_escan(cfg);
brcmf_init_conf(cfg_priv->conf); brcmf_init_conf(cfg->conf);
brcmf_init_prof(cfg_priv->profile); brcmf_init_prof(cfg->profile);
brcmf_link_down(cfg_priv); brcmf_link_down(cfg);
return err; return err;
} }
static void wl_deinit_priv(struct brcmf_cfg80211_priv *cfg_priv) static void wl_deinit_priv(struct brcmf_cfg80211_info *cfg)
{ {
cancel_work_sync(&cfg_priv->event_work); cancel_work_sync(&cfg->event_work);
cfg_priv->dongle_up = false; /* dongle down */ cfg->dongle_up = false; /* dongle down */
brcmf_flush_eq(cfg_priv); brcmf_flush_eq(cfg);
brcmf_link_down(cfg_priv); brcmf_link_down(cfg);
brcmf_abort_scanning(cfg_priv); brcmf_abort_scanning(cfg);
brcmf_deinit_priv_mem(cfg_priv); brcmf_deinit_priv_mem(cfg);
} }
struct brcmf_cfg80211_priv *brcmf_cfg80211_attach(struct net_device *ndev, struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct net_device *ndev,
struct device *busdev, struct device *busdev,
struct brcmf_pub *drvr) struct brcmf_pub *drvr)
{ {
struct wireless_dev *wdev; struct wireless_dev *wdev;
struct brcmf_cfg80211_priv *cfg_priv; struct brcmf_cfg80211_info *cfg;
s32 err = 0; s32 err = 0;
if (!ndev) { if (!ndev) {
...@@ -5197,29 +5196,29 @@ struct brcmf_cfg80211_priv *brcmf_cfg80211_attach(struct net_device *ndev, ...@@ -5197,29 +5196,29 @@ struct brcmf_cfg80211_priv *brcmf_cfg80211_attach(struct net_device *ndev,
} }
wdev->iftype = brcmf_mode_to_nl80211_iftype(WL_MODE_BSS); wdev->iftype = brcmf_mode_to_nl80211_iftype(WL_MODE_BSS);
cfg_priv = wdev_to_cfg(wdev); cfg = wdev_to_cfg(wdev);
cfg_priv->wdev = wdev; cfg->wdev = wdev;
cfg_priv->pub = drvr; cfg->pub = drvr;
ndev->ieee80211_ptr = wdev; ndev->ieee80211_ptr = wdev;
SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy));
wdev->netdev = ndev; wdev->netdev = ndev;
err = wl_init_priv(cfg_priv); err = wl_init_priv(cfg);
if (err) { if (err) {
WL_ERR("Failed to init iwm_priv (%d)\n", err); WL_ERR("Failed to init iwm_priv (%d)\n", err);
goto cfg80211_attach_out; goto cfg80211_attach_out;
} }
return cfg_priv; return cfg;
cfg80211_attach_out: cfg80211_attach_out:
brcmf_free_wdev(cfg_priv); brcmf_free_wdev(cfg);
return NULL; return NULL;
} }
void brcmf_cfg80211_detach(struct brcmf_cfg80211_priv *cfg_priv) void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg)
{ {
wl_deinit_priv(cfg_priv); wl_deinit_priv(cfg);
brcmf_free_wdev(cfg_priv); brcmf_free_wdev(cfg);
} }
void void
...@@ -5227,10 +5226,10 @@ brcmf_cfg80211_event(struct net_device *ndev, ...@@ -5227,10 +5226,10 @@ brcmf_cfg80211_event(struct net_device *ndev,
const struct brcmf_event_msg *e, void *data) const struct brcmf_event_msg *e, void *data)
{ {
u32 event_type = be32_to_cpu(e->event_type); u32 event_type = be32_to_cpu(e->event_type);
struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); struct brcmf_cfg80211_info *cfg = ndev_to_cfg(ndev);
if (!brcmf_enq_event(cfg_priv, event_type, e, data)) if (!brcmf_enq_event(cfg, event_type, e, data))
schedule_work(&cfg_priv->event_work); schedule_work(&cfg->event_work);
} }
static s32 brcmf_dongle_mode(struct net_device *ndev, s32 iftype) static s32 brcmf_dongle_mode(struct net_device *ndev, s32 iftype)
...@@ -5426,14 +5425,14 @@ brcmf_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time, ...@@ -5426,14 +5425,14 @@ brcmf_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time,
return err; return err;
} }
static s32 wl_update_wiphybands(struct brcmf_cfg80211_priv *cfg_priv) static s32 wl_update_wiphybands(struct brcmf_cfg80211_info *cfg)
{ {
struct wiphy *wiphy; struct wiphy *wiphy;
s32 phy_list; s32 phy_list;
s8 phy; s8 phy;
s32 err = 0; s32 err = 0;
err = brcmf_exec_dcmd(cfg_to_ndev(cfg_priv), BRCM_GET_PHYLIST, err = brcmf_exec_dcmd(cfg_to_ndev(cfg), BRCM_GET_PHYLIST,
&phy_list, sizeof(phy_list)); &phy_list, sizeof(phy_list));
if (err) { if (err) {
WL_ERR("error (%d)\n", err); WL_ERR("error (%d)\n", err);
...@@ -5443,29 +5442,29 @@ static s32 wl_update_wiphybands(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -5443,29 +5442,29 @@ static s32 wl_update_wiphybands(struct brcmf_cfg80211_priv *cfg_priv)
phy = ((char *)&phy_list)[0]; phy = ((char *)&phy_list)[0];
WL_INFO("%c phy\n", phy); WL_INFO("%c phy\n", phy);
if (phy == 'n' || phy == 'a') { if (phy == 'n' || phy == 'a') {
wiphy = cfg_to_wiphy(cfg_priv); wiphy = cfg_to_wiphy(cfg);
wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n; wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
} }
return err; return err;
} }
static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_info *cfg)
{ {
return wl_update_wiphybands(cfg_priv); return wl_update_wiphybands(cfg);
} }
static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv) static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
{ {
struct net_device *ndev; struct net_device *ndev;
struct wireless_dev *wdev; struct wireless_dev *wdev;
s32 power_mode; s32 power_mode;
s32 err = 0; s32 err = 0;
if (cfg_priv->dongle_up) if (cfg->dongle_up)
return err; return err;
ndev = cfg_to_ndev(cfg_priv); ndev = cfg_to_ndev(cfg);
wdev = ndev->ieee80211_ptr; wdev = ndev->ieee80211_ptr;
brcmf_dongle_scantime(ndev, WL_SCAN_CHANNEL_TIME, brcmf_dongle_scantime(ndev, WL_SCAN_CHANNEL_TIME,
...@@ -5475,21 +5474,21 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -5475,21 +5474,21 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv)
if (err) if (err)
goto default_conf_out; goto default_conf_out;
power_mode = cfg_priv->pwr_save ? PM_FAST : PM_OFF; power_mode = cfg->pwr_save ? PM_FAST : PM_OFF;
err = brcmf_exec_dcmd_u32(ndev, BRCMF_C_SET_PM, &power_mode); err = brcmf_exec_dcmd_u32(ndev, BRCMF_C_SET_PM, &power_mode);
if (err) if (err)
goto default_conf_out; goto default_conf_out;
WL_INFO("power save set to %s\n", WL_INFO("power save set to %s\n",
(power_mode ? "enabled" : "disabled")); (power_mode ? "enabled" : "disabled"));
err = brcmf_dongle_roam(ndev, (cfg_priv->roam_on ? 0 : 1), err = brcmf_dongle_roam(ndev, (cfg->roam_on ? 0 : 1),
WL_BEACON_TIMEOUT); WL_BEACON_TIMEOUT);
if (err) if (err)
goto default_conf_out; goto default_conf_out;
err = brcmf_dongle_mode(ndev, wdev->iftype); err = brcmf_dongle_mode(ndev, wdev->iftype);
if (err && err != -EINPROGRESS) if (err && err != -EINPROGRESS)
goto default_conf_out; goto default_conf_out;
err = brcmf_dongle_probecap(cfg_priv); err = brcmf_dongle_probecap(cfg);
if (err) if (err)
goto default_conf_out; goto default_conf_out;
...@@ -5497,31 +5496,31 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -5497,31 +5496,31 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv)
default_conf_out: default_conf_out:
cfg_priv->dongle_up = true; cfg->dongle_up = true;
return err; return err;
} }
static int brcmf_debugfs_add_netdev_params(struct brcmf_cfg80211_priv *cfg_priv) static int brcmf_debugfs_add_netdev_params(struct brcmf_cfg80211_info *cfg)
{ {
char buf[10+IFNAMSIZ]; char buf[10+IFNAMSIZ];
struct dentry *fd; struct dentry *fd;
s32 err = 0; s32 err = 0;
sprintf(buf, "netdev:%s", cfg_to_ndev(cfg_priv)->name); sprintf(buf, "netdev:%s", cfg_to_ndev(cfg)->name);
cfg_priv->debugfsdir = debugfs_create_dir(buf, cfg->debugfsdir = debugfs_create_dir(buf,
cfg_to_wiphy(cfg_priv)->debugfsdir); cfg_to_wiphy(cfg)->debugfsdir);
fd = debugfs_create_u16("beacon_int", S_IRUGO, cfg_priv->debugfsdir, fd = debugfs_create_u16("beacon_int", S_IRUGO, cfg->debugfsdir,
(u16 *)&cfg_priv->profile->beacon_interval); (u16 *)&cfg->profile->beacon_interval);
if (!fd) { if (!fd) {
err = -ENOMEM; err = -ENOMEM;
goto err_out; goto err_out;
} }
fd = debugfs_create_u8("dtim_period", S_IRUGO, cfg_priv->debugfsdir, fd = debugfs_create_u8("dtim_period", S_IRUGO, cfg->debugfsdir,
(u8 *)&cfg_priv->profile->dtim_period); (u8 *)&cfg->profile->dtim_period);
if (!fd) { if (!fd) {
err = -ENOMEM; err = -ENOMEM;
goto err_out; goto err_out;
...@@ -5531,40 +5530,40 @@ static int brcmf_debugfs_add_netdev_params(struct brcmf_cfg80211_priv *cfg_priv) ...@@ -5531,40 +5530,40 @@ static int brcmf_debugfs_add_netdev_params(struct brcmf_cfg80211_priv *cfg_priv)
return err; return err;
} }
static void brcmf_debugfs_remove_netdev(struct brcmf_cfg80211_priv *cfg_priv) static void brcmf_debugfs_remove_netdev(struct brcmf_cfg80211_info *cfg)
{ {
debugfs_remove_recursive(cfg_priv->debugfsdir); debugfs_remove_recursive(cfg->debugfsdir);
cfg_priv->debugfsdir = NULL; cfg->debugfsdir = NULL;
} }
static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv) static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_info *cfg)
{ {
s32 err = 0; s32 err = 0;
set_bit(WL_STATUS_READY, &cfg_priv->status); set_bit(WL_STATUS_READY, &cfg->status);
brcmf_debugfs_add_netdev_params(cfg_priv); brcmf_debugfs_add_netdev_params(cfg);
err = brcmf_config_dongle(cfg_priv); err = brcmf_config_dongle(cfg);
if (err) if (err)
return err; return err;
brcmf_invoke_iscan(cfg_priv); brcmf_invoke_iscan(cfg);
return err; return err;
} }
static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv) static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_info *cfg)
{ {
/* /*
* While going down, if associated with AP disassociate * While going down, if associated with AP disassociate
* from AP to save power * from AP to save power
*/ */
if ((test_bit(WL_STATUS_CONNECTED, &cfg_priv->status) || if ((test_bit(WL_STATUS_CONNECTED, &cfg->status) ||
test_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) && test_bit(WL_STATUS_CONNECTING, &cfg->status)) &&
test_bit(WL_STATUS_READY, &cfg_priv->status)) { test_bit(WL_STATUS_READY, &cfg->status)) {
WL_INFO("Disassociating from AP"); WL_INFO("Disassociating from AP");
brcmf_link_down(cfg_priv); brcmf_link_down(cfg);
/* Make sure WPA_Supplicant receives all the event /* Make sure WPA_Supplicant receives all the event
generated due to DISASSOC call to the fw to keep 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,32 +5572,32 @@ static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv)
brcmf_delay(500); brcmf_delay(500);
} }
brcmf_abort_scanning(cfg_priv); brcmf_abort_scanning(cfg);
clear_bit(WL_STATUS_READY, &cfg_priv->status); clear_bit(WL_STATUS_READY, &cfg->status);
brcmf_debugfs_remove_netdev(cfg_priv); brcmf_debugfs_remove_netdev(cfg);
return 0; return 0;
} }
s32 brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv) s32 brcmf_cfg80211_up(struct brcmf_cfg80211_info *cfg)
{ {
s32 err = 0; s32 err = 0;
mutex_lock(&cfg_priv->usr_sync); mutex_lock(&cfg->usr_sync);
err = __brcmf_cfg80211_up(cfg_priv); err = __brcmf_cfg80211_up(cfg);
mutex_unlock(&cfg_priv->usr_sync); mutex_unlock(&cfg->usr_sync);
return err; return err;
} }
s32 brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv) s32 brcmf_cfg80211_down(struct brcmf_cfg80211_info *cfg)
{ {
s32 err = 0; s32 err = 0;
mutex_lock(&cfg_priv->usr_sync); mutex_lock(&cfg->usr_sync);
err = __brcmf_cfg80211_down(cfg_priv); err = __brcmf_cfg80211_down(cfg);
mutex_unlock(&cfg_priv->usr_sync); mutex_unlock(&cfg->usr_sync);
return err; return err;
} }
......
...@@ -176,11 +176,11 @@ struct brcmf_cfg80211_conf { ...@@ -176,11 +176,11 @@ struct brcmf_cfg80211_conf {
}; };
/* forward declaration */ /* forward declaration */
struct brcmf_cfg80211_priv; struct brcmf_cfg80211_info;
/* cfg80211 main event loop */ /* cfg80211 main event loop */
struct brcmf_cfg80211_event_loop { struct brcmf_cfg80211_event_loop {
s32(*handler[BRCMF_E_LAST]) (struct brcmf_cfg80211_priv *cfg_priv, s32(*handler[BRCMF_E_LAST]) (struct brcmf_cfg80211_info *cfg,
struct net_device *ndev, struct net_device *ndev,
const struct brcmf_event_msg *e, const struct brcmf_event_msg *e,
void *data); void *data);
...@@ -238,7 +238,7 @@ struct brcmf_cfg80211_profile { ...@@ -238,7 +238,7 @@ struct brcmf_cfg80211_profile {
/* dongle iscan event loop */ /* dongle iscan event loop */
struct brcmf_cfg80211_iscan_eloop { struct brcmf_cfg80211_iscan_eloop {
s32 (*handler[WL_SCAN_ERSULTS_LAST]) s32 (*handler[WL_SCAN_ERSULTS_LAST])
(struct brcmf_cfg80211_priv *cfg_priv); (struct brcmf_cfg80211_info *cfg);
}; };
/* dongle iscan controller */ /* dongle iscan controller */
...@@ -381,7 +381,7 @@ struct brcmf_pno_scanresults_le { ...@@ -381,7 +381,7 @@ struct brcmf_pno_scanresults_le {
}; };
/** /**
* struct brcmf_cfg80211_priv - dongle private data of cfg80211 interface * struct brcmf_cfg80211_info - dongle private data of cfg80211 interface
* *
* @wdev: representing wl cfg80211 device. * @wdev: representing wl cfg80211 device.
* @conf: dongle configuration. * @conf: dongle configuration.
...@@ -424,7 +424,7 @@ struct brcmf_pno_scanresults_le { ...@@ -424,7 +424,7 @@ struct brcmf_pno_scanresults_le {
* @ap_info: host ap information. * @ap_info: host ap information.
* @ci: used to link this structure to netdev private data. * @ci: used to link this structure to netdev private data.
*/ */
struct brcmf_cfg80211_priv { struct brcmf_cfg80211_info {
struct wireless_dev *wdev; struct wireless_dev *wdev;
struct brcmf_cfg80211_conf *conf; struct brcmf_cfg80211_conf *conf;
struct cfg80211_scan_request *scan_request; struct cfg80211_scan_request *scan_request;
...@@ -466,49 +466,49 @@ struct brcmf_cfg80211_priv { ...@@ -466,49 +466,49 @@ struct brcmf_cfg80211_priv {
struct ap_info *ap_info; struct ap_info *ap_info;
}; };
static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_priv *w) static inline struct wiphy *cfg_to_wiphy(struct brcmf_cfg80211_info *w)
{ {
return w->wdev->wiphy; return w->wdev->wiphy;
} }
static inline struct brcmf_cfg80211_priv *wiphy_to_cfg(struct wiphy *w) static inline struct brcmf_cfg80211_info *wiphy_to_cfg(struct wiphy *w)
{ {
return (struct brcmf_cfg80211_priv *)(wiphy_priv(w)); return (struct brcmf_cfg80211_info *)(wiphy_priv(w));
} }
static inline struct brcmf_cfg80211_priv *wdev_to_cfg(struct wireless_dev *wd) static inline struct brcmf_cfg80211_info *wdev_to_cfg(struct wireless_dev *wd)
{ {
return (struct brcmf_cfg80211_priv *)(wdev_priv(wd)); return (struct brcmf_cfg80211_info *)(wdev_priv(wd));
} }
static inline struct net_device *cfg_to_ndev(struct brcmf_cfg80211_priv *cfg) static inline struct net_device *cfg_to_ndev(struct brcmf_cfg80211_info *cfg)
{ {
return cfg->wdev->netdev; return cfg->wdev->netdev;
} }
static inline struct brcmf_cfg80211_priv *ndev_to_cfg(struct net_device *ndev) static inline struct brcmf_cfg80211_info *ndev_to_cfg(struct net_device *ndev)
{ {
return wdev_to_cfg(ndev->ieee80211_ptr); return wdev_to_cfg(ndev->ieee80211_ptr);
} }
#define iscan_to_cfg(i) ((struct brcmf_cfg80211_priv *)(i->data)) #define iscan_to_cfg(i) ((struct brcmf_cfg80211_info *)(i->data))
#define cfg_to_iscan(w) (w->iscan) #define cfg_to_iscan(w) (w->iscan)
static inline struct static inline struct
brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_priv *cfg) brcmf_cfg80211_connect_info *cfg_to_conn(struct brcmf_cfg80211_info *cfg)
{ {
return &cfg->conn_info; return &cfg->conn_info;
} }
struct brcmf_cfg80211_priv *brcmf_cfg80211_attach(struct net_device *ndev, struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct net_device *ndev,
struct device *busdev, struct device *busdev,
struct brcmf_pub *drvr); struct brcmf_pub *drvr);
void brcmf_cfg80211_detach(struct brcmf_cfg80211_priv *cfg_priv); void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg);
/* event handler from dongle */ /* event handler from dongle */
void brcmf_cfg80211_event(struct net_device *ndev, void brcmf_cfg80211_event(struct net_device *ndev,
const struct brcmf_event_msg *e, void *data); const struct brcmf_event_msg *e, void *data);
s32 brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv); s32 brcmf_cfg80211_up(struct brcmf_cfg80211_info *cfg);
s32 brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv); s32 brcmf_cfg80211_down(struct brcmf_cfg80211_info *cfg);
#endif /* _wl_cfg80211_h_ */ #endif /* _wl_cfg80211_h_ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册