brcmfmac: use struct brcmf_if instance as parameter in brcmf_set_mpc()

Remove use of struct netdevice as parameter to brcmf_set_mpc() as it
will not always be available, ie. there will be non-netdevice interfaces.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Piotr Haber <phaber@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Arend van Spriel 2013-04-05 10:57:48 +02:00 committed by John W. Linville
parent 7fa2e3529c
commit f96aa07ecc
3 changed files with 20 additions and 19 deletions

View File

@ -1384,7 +1384,7 @@ int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,
/* After complete GO Negotiation, roll back to mpc mode */ /* After complete GO Negotiation, roll back to mpc mode */
if ((action == P2P_PAF_GON_CONF) || if ((action == P2P_PAF_GON_CONF) ||
(action == P2P_PAF_PROVDIS_RSP)) (action == P2P_PAF_PROVDIS_RSP))
brcmf_set_mpc(ifp->ndev, 1); brcmf_set_mpc(ifp, 1);
if (action == P2P_PAF_GON_CONF) { if (action == P2P_PAF_GON_CONF) {
brcmf_dbg(TRACE, "P2P: GO_NEG_PHASE status cleared\n"); brcmf_dbg(TRACE, "P2P: GO_NEG_PHASE status cleared\n");
clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status); clear_bit(BRCMF_P2P_STATUS_GO_NEG_PHASE, &p2p->status);
@ -1725,7 +1725,7 @@ bool brcmf_p2p_send_action_frame(struct brcmf_cfg80211_info *cfg,
/* To make sure to send successfully action frame, turn off mpc */ /* To make sure to send successfully action frame, turn off mpc */
if (config_af_params.mpc_onoff == 0) if (config_af_params.mpc_onoff == 0)
brcmf_set_mpc(ndev, 0); brcmf_set_mpc(netdev_priv(ndev), 0);
/* set status and destination address before sending af */ /* set status and destination address before sending af */
if (p2p->next_af_subtype != P2P_PAF_SUBTYPE_INVALID) { if (p2p->next_af_subtype != P2P_PAF_SUBTYPE_INVALID) {
@ -1820,7 +1820,7 @@ exit:
clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status); clear_bit(BRCMF_P2P_STATUS_WAITING_NEXT_ACT_FRAME, &p2p->status);
/* if all done, turn mpc on again */ /* if all done, turn mpc on again */
if (config_af_params.mpc_onoff == 1) if (config_af_params.mpc_onoff == 1)
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(netdev_priv(ndev), 1);
return ack; return ack;
} }
@ -2046,7 +2046,7 @@ int brcmf_p2p_ifchange(struct brcmf_cfg80211_info *cfg,
brcmf_err("vif for P2PAPI_BSSCFG_CONNECTION does not exist\n"); brcmf_err("vif for P2PAPI_BSSCFG_CONNECTION does not exist\n");
return -EPERM; return -EPERM;
} }
brcmf_set_mpc(vif->ifp->ndev, 0); brcmf_set_mpc(vif->ifp, 0);
/* In concurrency case, STA may be already associated in a particular */ /* In concurrency case, STA may be already associated in a particular */
/* channel. so retrieve the current channel of primary interface and */ /* channel. so retrieve the current channel of primary interface and */

View File

@ -490,9 +490,8 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy,
} }
} }
void brcmf_set_mpc(struct net_device *ndev, int mpc) void brcmf_set_mpc(struct brcmf_if *ifp, int mpc)
{ {
struct brcmf_if *ifp = netdev_priv(ndev);
s32 err = 0; s32 err = 0;
if (check_vif_up(ifp->vif)) { if (check_vif_up(ifp->vif)) {
@ -510,6 +509,7 @@ 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)
{ {
struct brcmf_if *ifp = netdev_priv(ndev);
struct brcmf_scan_params_le params_le; struct brcmf_scan_params_le params_le;
struct cfg80211_scan_request *scan_request; struct cfg80211_scan_request *scan_request;
s32 err = 0; s32 err = 0;
@ -539,7 +539,7 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
/* Scan is aborted by setting channel_list[0] to -1 */ /* Scan is aborted by setting channel_list[0] to -1 */
params_le.channel_list[0] = cpu_to_le16(-1); params_le.channel_list[0] = cpu_to_le16(-1);
/* E-Scan (or anyother type) can be aborted by SCAN */ /* E-Scan (or anyother type) can be aborted by SCAN */
err = brcmf_fil_cmd_data_set(netdev_priv(ndev), BRCMF_C_SCAN, err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
&params_le, sizeof(params_le)); &params_le, sizeof(params_le));
if (err) if (err)
brcmf_err("Scan abort failed\n"); brcmf_err("Scan abort failed\n");
@ -553,12 +553,12 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
cfg->sched_escan = false; cfg->sched_escan = false;
if (!aborted) if (!aborted)
cfg80211_sched_scan_results(cfg_to_wiphy(cfg)); cfg80211_sched_scan_results(cfg_to_wiphy(cfg));
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ifp, 1);
} else if (scan_request) { } else if (scan_request) {
brcmf_dbg(SCAN, "ESCAN Completed scan: %s\n", brcmf_dbg(SCAN, "ESCAN Completed scan: %s\n",
aborted ? "Aborted" : "Done"); aborted ? "Aborted" : "Done");
cfg80211_scan_done(scan_request, aborted); cfg80211_scan_done(scan_request, aborted);
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ifp, 1);
} }
if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status))
brcmf_dbg(SCAN, "Scan complete, probably P2P scan\n"); brcmf_dbg(SCAN, "Scan complete, probably P2P scan\n");
@ -813,19 +813,20 @@ brcmf_do_escan(struct brcmf_cfg80211_info *cfg, struct wiphy *wiphy,
u32 passive_scan; u32 passive_scan;
struct brcmf_scan_results *results; struct brcmf_scan_results *results;
struct escan_info *escan = &cfg->escan_info; struct escan_info *escan = &cfg->escan_info;
struct brcmf_if *ifp = netdev_priv(ndev);
brcmf_dbg(SCAN, "Enter\n"); brcmf_dbg(SCAN, "Enter\n");
escan->ndev = ndev; escan->ndev = ndev;
escan->wiphy = wiphy; escan->wiphy = wiphy;
escan->escan_state = WL_ESCAN_STATE_SCANNING; escan->escan_state = WL_ESCAN_STATE_SCANNING;
passive_scan = cfg->active_scan ? 0 : 1; passive_scan = cfg->active_scan ? 0 : 1;
err = brcmf_fil_cmd_int_set(netdev_priv(ndev), BRCMF_C_SET_PASSIVE_SCAN, err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_PASSIVE_SCAN,
passive_scan); passive_scan);
if (err) { if (err) {
brcmf_err("error (%d)\n", err); brcmf_err("error (%d)\n", err);
return err; return err;
} }
brcmf_set_mpc(ndev, 0); brcmf_set_mpc(ifp, 0);
results = (struct brcmf_scan_results *)cfg->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;
@ -833,7 +834,7 @@ brcmf_do_escan(struct brcmf_cfg80211_info *cfg, struct wiphy *wiphy,
err = escan->run(cfg, ndev, request, WL_ESCAN_ACTION_START); err = escan->run(cfg, ndev, request, WL_ESCAN_ACTION_START);
if (err) if (err)
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ifp, 1);
return err; return err;
} }
@ -921,7 +922,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
brcmf_err("WLC_SET_PASSIVE_SCAN error (%d)\n", err); brcmf_err("WLC_SET_PASSIVE_SCAN error (%d)\n", err);
goto scan_out; goto scan_out;
} }
brcmf_set_mpc(ndev, 0); brcmf_set_mpc(ifp, 0);
err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN, err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
&sr->ssid_le, sizeof(sr->ssid_le)); &sr->ssid_le, sizeof(sr->ssid_le));
if (err) { if (err) {
@ -931,7 +932,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
else else
brcmf_err("WLC_SCAN error (%d)\n", err); brcmf_err("WLC_SCAN error (%d)\n", err);
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ifp, 1);
goto scan_out; goto scan_out;
} }
} }
@ -2697,7 +2698,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
brcmf_abort_scanning(cfg); brcmf_abort_scanning(cfg);
/* Turn off watchdog timer */ /* Turn off watchdog timer */
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(netdev_priv(ndev), 1);
exit: exit:
brcmf_dbg(TRACE, "Exit\n"); brcmf_dbg(TRACE, "Exit\n");
@ -3668,7 +3669,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
ssid_le.SSID_len = cpu_to_le32((u32)settings->ssid_len); ssid_le.SSID_len = cpu_to_le32((u32)settings->ssid_len);
} }
brcmf_set_mpc(ndev, 0); brcmf_set_mpc(ifp, 0);
/* find the RSN_IE */ /* find the RSN_IE */
rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail,
@ -3776,7 +3777,7 @@ brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
exit: exit:
if (err) if (err)
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ifp, 1);
return err; return err;
} }
@ -3810,7 +3811,7 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
if (err < 0) if (err < 0)
brcmf_err("bss_enable config failed %d\n", err); brcmf_err("bss_enable config failed %d\n", err);
} }
brcmf_set_mpc(ndev, 1); brcmf_set_mpc(ifp, 1);
set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state); set_bit(BRCMF_VIF_STATUS_AP_CREATING, &ifp->vif->sme_state);
clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);

View File

@ -495,7 +495,7 @@ int brcmf_cfg80211_wait_vif_event_timeout(struct brcmf_cfg80211_info *cfg,
s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, s32 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);
void brcmf_set_mpc(struct net_device *ndev, int mpc); void brcmf_set_mpc(struct brcmf_if *ndev, int mpc);
void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg); void brcmf_abort_scanning(struct brcmf_cfg80211_info *cfg);
#endif /* _wl_cfg80211_h_ */ #endif /* _wl_cfg80211_h_ */