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

brcmfmac: remove use of unconditional access of struct wireless_dev::netdev

With the introduction of the P2P_DEVICE interface type an instance of
struct wireless_dev does not always have a netdev assigned to it. Better
use container_of() construct to obtain internal structure and go from
there.
Reviewed-by: NPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: NPiotr Haber <phaber@broadcom.com>
Reviewed-by: NHante Meuleman <meuleman@broadcom.com>
Signed-off-by: NArend van Spriel <arend@broadcom.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 5857f9c6
...@@ -3868,13 +3868,13 @@ brcmf_cfg80211_mgmt_frame_register(struct wiphy *wiphy, ...@@ -3868,13 +3868,13 @@ brcmf_cfg80211_mgmt_frame_register(struct wiphy *wiphy,
struct wireless_dev *wdev, struct wireless_dev *wdev,
u16 frame_type, bool reg) u16 frame_type, bool reg)
{ {
struct brcmf_if *ifp = netdev_priv(wdev->netdev); struct brcmf_cfg80211_vif *vif;
struct brcmf_cfg80211_vif *vif = ifp->vif;
u16 mgmt_type; u16 mgmt_type;
brcmf_dbg(TRACE, "Enter, frame_type %04x, reg=%d\n", frame_type, reg); brcmf_dbg(TRACE, "Enter, frame_type %04x, reg=%d\n", frame_type, reg);
mgmt_type = (frame_type & IEEE80211_FCTL_STYPE) >> 4; mgmt_type = (frame_type & IEEE80211_FCTL_STYPE) >> 4;
vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev);
if (reg) if (reg)
vif->mgmt_rx_reg |= BIT(mgmt_type); vif->mgmt_rx_reg |= BIT(mgmt_type);
else else
...@@ -3890,7 +3890,6 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, ...@@ -3890,7 +3890,6 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
{ {
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
const struct ieee80211_mgmt *mgmt; const struct ieee80211_mgmt *mgmt;
struct brcmf_if *ifp;
struct brcmf_cfg80211_vif *vif; struct brcmf_cfg80211_vif *vif;
s32 err = 0; s32 err = 0;
s32 ie_offset; s32 ie_offset;
...@@ -3926,8 +3925,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, ...@@ -3926,8 +3925,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
ie_offset = DOT11_MGMT_HDR_LEN + ie_offset = DOT11_MGMT_HDR_LEN +
DOT11_BCN_PRB_FIXED_LEN; DOT11_BCN_PRB_FIXED_LEN;
ie_len = len - ie_offset; ie_len = len - ie_offset;
ifp = netdev_priv(wdev->netdev); vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev);
vif = ifp->vif;
if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif) if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif)
vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif; vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif;
err = brcmf_vif_set_mgmt_ie(vif, err = brcmf_vif_set_mgmt_ie(vif,
...@@ -3962,7 +3960,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, ...@@ -3962,7 +3960,7 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
*cookie, le16_to_cpu(action_frame->len), *cookie, le16_to_cpu(action_frame->len),
chan->center_freq); chan->center_freq);
ack = brcmf_p2p_send_action_frame(cfg, wdev->netdev, ack = brcmf_p2p_send_action_frame(cfg, cfg_to_ndev(cfg),
af_params); af_params);
cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, ack, cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, ack,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册