From: sukeshs@broadcom.com
To: gregkh@suse.de
Cc: devel@linuxdriverproject.org, linux-wireless@vger.kernel.org
Subject: [PATCH 2/2] brcm80211: Fix for suspend/resume bug
Date: Tue, 3 May 2011 00:00:57 -0700 [thread overview]
Message-ID: <1304406057-8722-3-git-send-email-sukeshs@broadcom.com> (raw)
In-Reply-To: <1304406057-8722-1-git-send-email-sukeshs@broadcom.com>
From: Sukesh Srikakula <sukeshs@xl-sj1-20.sj.broadcom.com>
Currently, there are 2 callbacks registered with OS for getting notifications when system goes to suspend/resume.
Racing between these 2 callbacks leads to failure in the suspend/resume path.
With this fix, we avoid registering dhd callback for suspend/resume notification when cfg80211 is used. Relevant functionality in dhd suspend/resume callback function is moved to cfg80211 suspend/resume functions.
Signed-off-by: Sukesh Srikakula <sukeshs@broadcom.com>
Signed-off-by: Sukesh Srikakula <sukeshs@xl-sj1-20.sj.broadcom.com>
---
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c | 4 ----
drivers/staging/brcm80211/brcmfmac/dhd.h | 3 +++
drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 6 ++++--
drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c | 8 ++++++++
4 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 05f50d3..54ba30d 100644
--- a/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -30,10 +30,6 @@
#include <dngl_stats.h>
#include <dhd.h>
-#if defined(CONFIG_PM_SLEEP)
-#include <linux/suspend.h>
-extern volatile bool dhd_mmc_suspend;
-#endif
#include "bcmsdh_sdmmc.h"
extern int sdio_function_init(void);
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd.h b/drivers/staging/brcm80211/brcmfmac/dhd.h
index 99c38dd..41c55a6 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd.h
+++ b/drivers/staging/brcm80211/brcmfmac/dhd.h
@@ -31,6 +31,7 @@
#include <linux/random.h>
#include <linux/spinlock.h>
#include <linux/ethtool.h>
+#include <linux/suspend.h>
#include <asm/uaccess.h>
#include <asm/unaligned.h>
/* The kernel threading is sdio-specific */
@@ -123,6 +124,8 @@ typedef struct dhd_pub {
#if defined(CONFIG_PM_SLEEP)
+extern volatile bool dhd_mmc_suspend;
+
#define DHD_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a);
#define _DHD_PM_RESUME_WAIT(a, b) do {\
int retry = 0; \
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index b34c4ea..37b2c0c 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -2015,7 +2015,8 @@ dhd_pub_t *dhd_attach(struct dhd_bus *bus, uint bus_hdrlen)
g_bus = bus;
#endif
#if defined(CONFIG_PM_SLEEP)
- register_pm_notifier(&dhd_sleep_pm_notifier);
+ if (!IS_CFG80211_FAVORITE())
+ register_pm_notifier(&dhd_sleep_pm_notifier);
#endif /* defined(CONFIG_PM_SLEEP) */
/* && defined(DHD_GPL) */
/* Init lock suspend to prevent kernel going to suspend */
@@ -2325,7 +2326,8 @@ void dhd_detach(dhd_pub_t *dhdp)
wl_cfg80211_detach();
#if defined(CONFIG_PM_SLEEP)
- unregister_pm_notifier(&dhd_sleep_pm_notifier);
+ if (!IS_CFG80211_FAVORITE())
+ unregister_pm_notifier(&dhd_sleep_pm_notifier);
#endif /* defined(CONFIG_PM_SLEEP) */
/* && defined(DHD_GPL) */
free_netdev(ifp->net);
diff --git a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
index c60fc7c..db77e60 100644
--- a/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/staging/brcm80211/brcmfmac/wl_cfg80211.c
@@ -1971,6 +1971,10 @@ static s32 wl_cfg80211_resume(struct wiphy *wiphy)
{
s32 err = 0;
+#if defined(CONFIG_PM_SLEEP)
+ dhd_mmc_suspend = false;
+#endif /* defined(CONFIG_PM_SLEEP) */
+
CHECK_SYS_UP();
wl_invoke_iscan(wiphy_to_wl(wiphy));
@@ -1996,6 +2000,10 @@ static s32 wl_cfg80211_suspend(struct wiphy *wiphy)
sdioh_sdio_set_host_pm_flags(MMC_PM_KEEP_POWER);
+#if defined(CONFIG_PM_SLEEP)
+ dhd_mmc_suspend = true;
+#endif /* defined(CONFIG_PM_SLEEP) */
+
return err;
}
--
1.7.3.2
next prev parent reply other threads:[~2011-05-03 7:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-03 7:00 [PATCH 0/2] *** SUBJECT HERE *** sukeshs
2011-05-03 7:00 ` [PATCH 1/2] brcm80211: FIX for TKIP GTK bug sukeshs
2011-05-03 7:00 ` sukeshs [this message]
2011-05-03 9:10 ` [PATCH 2/2] brcm80211: Fix for suspend/resume bug Arend van Spriel
2011-05-03 12:15 ` Greg KH
2011-05-03 12:33 ` Arend van Spriel
2011-05-03 13:00 ` Greg KH
2011-05-03 13:09 ` Arend van Spriel
2011-05-03 13:11 ` Greg KH
2011-05-03 13:17 ` Arend van Spriel
2011-05-03 13:41 ` Arend van Spriel
2011-05-03 19:46 ` Greg KH
2011-05-03 12:14 ` [PATCH 0/2] *** SUBJECT HERE *** Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1304406057-8722-3-git-send-email-sukeshs@broadcom.com \
--to=sukeshs@broadcom.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@suse.de \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).