brcmfmac: use struct brcmf_if instance as parameter in brcmf_set_mpc()
authorArend van Spriel <arend@broadcom.com>
Fri, 5 Apr 2013 08:57:48 +0000 (10:57 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 8 Apr 2013 19:28:45 +0000 (15:28 -0400)
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>
drivers/net/wireless/brcm80211/brcmfmac/p2p.c
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h

index 4166e642068bf1e156531ba8fdfaee22868e3061..454a8deb0f102776f0f9f213622454bae6a14628 100644 (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 */
                if ((action == P2P_PAF_GON_CONF) ||
                    (action == P2P_PAF_PROVDIS_RSP))
-                       brcmf_set_mpc(ifp->ndev, 1);
+                       brcmf_set_mpc(ifp, 1);
                if (action == P2P_PAF_GON_CONF) {
                        brcmf_dbg(TRACE, "P2P: GO_NEG_PHASE status cleared\n");
                        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 */
        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 */
        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);
        /* if all done, turn mpc on again */
        if (config_af_params.mpc_onoff == 1)
-               brcmf_set_mpc(ndev, 1);
+               brcmf_set_mpc(netdev_priv(ndev), 1);
 
        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");
                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 */
        /* channel. so retrieve the current channel of primary interface and  */
index 56359e3e7eb697715e7b4e0653c0b588b8213a89..3b79f0c89c47d37f71214472cfce62918020f842 100644 (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;
 
        if (check_vif_up(ifp->vif)) {
@@ -510,6 +509,7 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
                            struct net_device *ndev,
                            bool aborted, bool fw_abort)
 {
+       struct brcmf_if *ifp = netdev_priv(ndev);
        struct brcmf_scan_params_le params_le;
        struct cfg80211_scan_request *scan_request;
        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 */
                params_le.channel_list[0] = cpu_to_le16(-1);
                /* 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));
                if (err)
                        brcmf_err("Scan abort  failed\n");
@@ -553,12 +553,12 @@ brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
                cfg->sched_escan = false;
                if (!aborted)
                        cfg80211_sched_scan_results(cfg_to_wiphy(cfg));
-               brcmf_set_mpc(ndev, 1);
+               brcmf_set_mpc(ifp, 1);
        } else if (scan_request) {
                brcmf_dbg(SCAN, "ESCAN Completed scan: %s\n",
                          aborted ? "Aborted" : "Done");
                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))
                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;
        struct brcmf_scan_results *results;
        struct escan_info *escan = &cfg->escan_info;
+       struct brcmf_if *ifp = netdev_priv(ndev);
 
        brcmf_dbg(SCAN, "Enter\n");
        escan->ndev = ndev;
        escan->wiphy = wiphy;
        escan->escan_state = WL_ESCAN_STATE_SCANNING;
        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);
        if (err) {
                brcmf_err("error (%d)\n", err);
                return err;
        }
-       brcmf_set_mpc(ndev, 0);
+       brcmf_set_mpc(ifp, 0);
        results = (struct brcmf_scan_results *)cfg->escan_info.escan_buf;
        results->version = 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);
        if (err)
-               brcmf_set_mpc(ndev, 1);
+               brcmf_set_mpc(ifp, 1);
        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);
                        goto scan_out;
                }
-               brcmf_set_mpc(ndev, 0);
+               brcmf_set_mpc(ifp, 0);
                err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN,
                                             &sr->ssid_le, sizeof(sr->ssid_le));
                if (err) {
@@ -931,7 +932,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct net_device *ndev,
                        else
                                brcmf_err("WLC_SCAN error (%d)\n", err);
 
-                       brcmf_set_mpc(ndev, 1);
+                       brcmf_set_mpc(ifp, 1);
                        goto scan_out;
                }
        }
@@ -2697,7 +2698,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
                brcmf_abort_scanning(cfg);
 
        /* Turn off watchdog timer */
-       brcmf_set_mpc(ndev, 1);
+       brcmf_set_mpc(netdev_priv(ndev), 1);
 
 exit:
        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);
        }
 
-       brcmf_set_mpc(ndev, 0);
+       brcmf_set_mpc(ifp, 0);
 
        /* find the RSN_IE */
        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:
        if (err)
-               brcmf_set_mpc(ndev, 1);
+               brcmf_set_mpc(ifp, 1);
        return err;
 }
 
@@ -3810,7 +3811,7 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
                if (err < 0)
                        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);
        clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state);
 
index 8b5d4989906c54e9f95df3096e9567f1738fd2c3..cd4af981e224031ba37e51ff0a5e0ef5700a75c1 100644 (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,
                                struct net_device *ndev,
                                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);
 
 #endif                         /* _wl_cfg80211_h_ */