From: Franky Lin Date: Tue, 4 Oct 2011 21:18:53 +0000 (+0200) Subject: staging: brcm80211: clean up rtnl_lock in fullmac X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=019f45f27464e91cd1936a22600a05779bbe5573;p=openwrt%2Fstaging%2Fblogic.git staging: brcm80211: clean up rtnl_lock in fullmac rtnl lock is used improperly in fullmac. This patch intends to clean them up. Reported-by: Johannes Berg Reviewed-by: Arend van Spriel Reviewed-by: Roland Vossen Reviewed-by: Sukesh Srikakula Reviewed-by: Pieter-Paul Giesberts Signed-off-by: Arend van Spriel Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c index 641cd9c7f042..804b2bc64b15 100644 --- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -1240,7 +1241,9 @@ void brcmf_detach(struct brcmf_pub *drvr) ifp = drvr_priv->iflist[0]; if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) { + rtnl_lock(); brcmf_netdev_stop(ifp->ndev); + rtnl_unlock(); unregister_netdev(ifp->ndev); } diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c index f7b3077aec95..fc643c1eb59a 100644 --- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -2223,10 +2222,8 @@ static s32 brcmf_iscan_done(struct brcmf_cfg80211_priv *cfg_priv) s32 err = 0; iscan->state = WL_ISCAN_STATE_IDLE; - rtnl_lock(); brcmf_inform_bss(cfg_priv); brcmf_notify_iscan_complete(iscan, false); - rtnl_unlock(); return err; } @@ -2248,10 +2245,8 @@ static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv) struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_priv->iscan; s32 err = 0; - rtnl_lock(); brcmf_inform_bss(cfg_priv); brcmf_run_iscan(iscan, NULL, BRCMF_SCAN_ACTION_CONTINUE); - rtnl_unlock(); /* Reschedule the timer */ mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000); iscan->timer_on = 1; @@ -2265,9 +2260,7 @@ static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_priv *cfg_priv) s32 err = 0; iscan->state = WL_ISCAN_STATE_IDLE; - rtnl_lock(); brcmf_notify_iscan_complete(iscan, true); - rtnl_unlock(); return err; } @@ -2286,12 +2279,10 @@ static void brcmf_cfg80211_iscan_handler(struct work_struct *work) iscan->timer_on = 0; } - rtnl_lock(); if (brcmf_get_iscan_results(iscan, &status, &cfg_priv->bss_list)) { status = BRCMF_SCAN_RESULTS_ABORTED; WL_ERR("Abort iscan\n"); } - rtnl_unlock(); el->handler[status](cfg_priv); } @@ -2408,9 +2399,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, * generated due to DISASSOC call to the fw to keep * the state fw and WPA_Supplicant state consistent */ - rtnl_unlock(); brcmf_delay(500); - rtnl_lock(); } set_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status); @@ -2978,7 +2967,6 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv, u16 flags = be16_to_cpu(e->flags); enum nl80211_key_type key_type; - rtnl_lock(); if (flags & BRCMF_EVENT_MSG_GROUP) key_type = NL80211_KEYTYPE_GROUP; else @@ -2986,7 +2974,6 @@ brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv, cfg80211_michael_mic_failure(ndev, (u8 *)&e->addr, key_type, -1, NULL, GFP_KERNEL); - rtnl_unlock(); return 0; } @@ -3563,8 +3550,7 @@ static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_priv *cfg_priv) return wl_update_wiphybands(cfg_priv); } -static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv, - bool need_lock) +static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv) { struct net_device *ndev; struct wireless_dev *wdev; @@ -3576,8 +3562,6 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv, ndev = cfg_to_ndev(cfg_priv); wdev = ndev->ieee80211_ptr; - if (need_lock) - rtnl_lock(); brcmf_dongle_scantime(ndev, WL_SCAN_CHANNEL_TIME, WL_SCAN_UNASSOC_TIME, WL_SCAN_PASSIVE_TIME); @@ -3607,8 +3591,6 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv, /* -EINPROGRESS: Call commit handler */ default_conf_out: - if (need_lock) - rtnl_unlock(); cfg_priv->dongle_up = true; @@ -3658,7 +3640,7 @@ static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv) brcmf_debugfs_add_netdev_params(cfg_priv); - err = brcmf_config_dongle(cfg_priv, false); + err = brcmf_config_dongle(cfg_priv); if (err) return err; @@ -3683,9 +3665,7 @@ static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv) generated due to DISASSOC call to the fw to keep the state fw and WPA_Supplicant state consistent */ - rtnl_unlock(); brcmf_delay(500); - rtnl_lock(); } set_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status);