From ddf179a33044c1b6b9dabce1fc166335f7a53a75 Mon Sep 17 00:00:00 2001 From: Dmitry Tarnyagin Date: Wed, 29 Feb 2012 15:15:42 +0100 Subject: cw1200: Fix for false negatives in suspend decision. There was a race between PM and BH code which sometimes leaded to false negatives in system suspend decision. This race is fixed by this patch. ST-Ericsoon ID: 419543 Change-ID: I607a37c1046ea9737b625da65e04be0f42901aaa Signed-off-by: Dmitry Tarnyagin Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/50440 Reviewed-by: Bartosz MARKOWSKI Tested-by: Bartosz MARKOWSKI --- drivers/staging/cw1200/pm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/cw1200/pm.c b/drivers/staging/cw1200/pm.c index f542e7d51f6..d95e5d3dc9e 100644 --- a/drivers/staging/cw1200/pm.c +++ b/drivers/staging/cw1200/pm.c @@ -297,7 +297,11 @@ int cw1200_wow_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) /* Lock TX. */ wsm_lock_tx_async(priv); - if (priv->hw_bufs_used) + + /* Wait to avoid possible race with bh code. + * But do not wait too long... */ + if (wait_event_timeout(priv->bh_evt_wq, + !priv->hw_bufs_used, HZ / 10) <= 0) goto revert2; /* Set UDP filter */ -- cgit v1.2.3