diff mbox

[2/2] brcm80211: Fix for suspend/resume bug

Message ID 1304406057-8722-3-git-send-email-sukeshs@broadcom.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

sukeshs@broadcom.com May 3, 2011, 7 a.m. UTC
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(-)

Comments

Arend van Spriel May 3, 2011, 9:10 a.m. UTC | #1
On 05/03/2011 09:00 AM, sukeshs@broadcom.com wrote:
> 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>
> ---
> 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
> @@ -123,6 +124,8 @@ typedef struct dhd_pub {
>
>   #if defined(CONFIG_PM_SLEEP)
>
> +extern volatile bool dhd_mmc_suspend;
> +

You probably should run checkpatch.pl on this patch. The volatile 
keyword triggers a warning here. I grepped the fullmac code and this 
variable is only set so what is its purpose (debugging?)? See 
Documentation/volatile-considered-harmful.txt on this topic.

Gr. AvS


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg Kroah-Hartman May 3, 2011, 12:15 p.m. UTC | #2
On Tue, May 03, 2011 at 12:00:57AM -0700, sukeshs@broadcom.com wrote:
>  #if defined(CONFIG_PM_SLEEP)
>  
> +extern volatile bool dhd_mmc_suspend;

This does not do what you think it does.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arend van Spriel May 3, 2011, 12:33 p.m. UTC | #3
On 05/03/2011 02:15 PM, Greg KH wrote:
> On Tue, May 03, 2011 at 12:00:57AM -0700, sukeshs@broadcom.com wrote:
>>   #if defined(CONFIG_PM_SLEEP)
>>
>> +extern volatile bool dhd_mmc_suspend;
> This does not do what you think it does.

Hi Greg,

I posted the 'catchup' patch set and I rebased it on '[PATCH 1/2] 
brcm80211: FIX for TKIP GTK bug' from Sukesh. The only other two patches 
I saw on the linuxdriver list are:

staging: brcm80211: brcmfmac: Add and use dhd_dbg [joe@perches.com] => 
he rejected it himself.
STAGING: brcm80211 SDIO/MMC cleanups [grundler@chromium.org] => does not 
apply.

So I discarded those two as well.

Gr. AvS

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg Kroah-Hartman May 3, 2011, 1 p.m. UTC | #4
On Tue, May 03, 2011 at 02:33:44PM +0200, Arend van Spriel wrote:
> On 05/03/2011 02:15 PM, Greg KH wrote:
> >On Tue, May 03, 2011 at 12:00:57AM -0700, sukeshs@broadcom.com wrote:
> >>  #if defined(CONFIG_PM_SLEEP)
> >>
> >>+extern volatile bool dhd_mmc_suspend;
> >This does not do what you think it does.
> 
> Hi Greg,
> 
> I posted the 'catchup' patch set and I rebased it on '[PATCH 1/2]
> brcm80211: FIX for TKIP GTK bug' from Sukesh. The only other two
> patches I saw on the linuxdriver list are:

You rebased on a 1/2 patch in a series with an invalid 0/2 email?

{sigh}

I dropped that patch as the whole series needed to be resent, do you
want me to apply that one patch before yours?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arend van Spriel May 3, 2011, 1:09 p.m. UTC | #5
On 05/03/2011 03:00 PM, Greg KH wrote:
> On Tue, May 03, 2011 at 02:33:44PM +0200, Arend van Spriel wrote:
>> On 05/03/2011 02:15 PM, Greg KH wrote:
>>> On Tue, May 03, 2011 at 12:00:57AM -0700, sukeshs@broadcom.com wrote:
>>>>   #if defined(CONFIG_PM_SLEEP)
>>>>
>>>> +extern volatile bool dhd_mmc_suspend;
>>> This does not do what you think it does.
>> Hi Greg,
>>
>> I posted the 'catchup' patch set and I rebased it on '[PATCH 1/2]
>> brcm80211: FIX for TKIP GTK bug' from Sukesh. The only other two
>> patches I saw on the linuxdriver list are:
> You rebased on a 1/2 patch in a series with an invalid 0/2 email?
>
> {sigh}
Sorry.
> I dropped that patch as the whole series needed to be resent, do you
> want me to apply that one patch before yours?
I can resend my series if that is more convenient for you.

Gr. AvS

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg Kroah-Hartman May 3, 2011, 1:11 p.m. UTC | #6
On Tue, May 03, 2011 at 03:09:20PM +0200, Arend van Spriel wrote:
> On 05/03/2011 03:00 PM, Greg KH wrote:
> >On Tue, May 03, 2011 at 02:33:44PM +0200, Arend van Spriel wrote:
> >>On 05/03/2011 02:15 PM, Greg KH wrote:
> >>>On Tue, May 03, 2011 at 12:00:57AM -0700, sukeshs@broadcom.com wrote:
> >>>>  #if defined(CONFIG_PM_SLEEP)
> >>>>
> >>>>+extern volatile bool dhd_mmc_suspend;
> >>>This does not do what you think it does.
> >>Hi Greg,
> >>
> >>I posted the 'catchup' patch set and I rebased it on '[PATCH 1/2]
> >>brcm80211: FIX for TKIP GTK bug' from Sukesh. The only other two
> >>patches I saw on the linuxdriver list are:
> >You rebased on a 1/2 patch in a series with an invalid 0/2 email?
> >
> >{sigh}
> Sorry.
> >I dropped that patch as the whole series needed to be resent, do you
> >want me to apply that one patch before yours?
> I can resend my series if that is more convenient for you.

Please, but just send it to me, I doubt everyone wants to see 60+
patches again on the list.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arend van Spriel May 3, 2011, 1:17 p.m. UTC | #7
On 05/03/2011 03:11 PM, Greg KH wrote:
> On Tue, May 03, 2011 at 03:09:20PM +0200, Arend van Spriel wrote:
>> On 05/03/2011 03:00 PM, Greg KH wrote:
>>> On Tue, May 03, 2011 at 02:33:44PM +0200, Arend van Spriel wrote:
>>>> On 05/03/2011 02:15 PM, Greg KH wrote:
>>>>> On Tue, May 03, 2011 at 12:00:57AM -0700, sukeshs@broadcom.com wrote:
>>>>>>   #if defined(CONFIG_PM_SLEEP)
>>>>>>
>>>>>> +extern volatile bool dhd_mmc_suspend;
>>>>> This does not do what you think it does.
>>>> Hi Greg,
>>>>
>>>> I posted the 'catchup' patch set and I rebased it on '[PATCH 1/2]
>>>> brcm80211: FIX for TKIP GTK bug' from Sukesh. The only other two
>>>> patches I saw on the linuxdriver list are:
>>> You rebased on a 1/2 patch in a series with an invalid 0/2 email?
>>>
>>> {sigh}
>> Sorry.
>>> I dropped that patch as the whole series needed to be resent, do you
>>> want me to apply that one patch before yours?
>> I can resend my series if that is more convenient for you.
> Please, but just send it to me, I doubt everyone wants to see 60+
> patches again on the list.
Ok. Just for this time I will agree to break the rules ;-)

Gr. AvS

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arend van Spriel May 3, 2011, 1:41 p.m. UTC | #8
On 05/03/2011 03:17 PM, Arend van Spriel wrote:
> On 05/03/2011 03:11 PM, Greg KH wrote:
>> On Tue, May 03, 2011 at 03:09:20PM +0200, Arend van Spriel wrote:
>>> On 05/03/2011 03:00 PM, Greg KH wrote:
>>>> On Tue, May 03, 2011 at 02:33:44PM +0200, Arend van Spriel wrote:
>>>>> On 05/03/2011 02:15 PM, Greg KH wrote:
>>>>>> On Tue, May 03, 2011 at 12:00:57AM -0700, sukeshs@broadcom.com wrote:
>>>>>>>    #if defined(CONFIG_PM_SLEEP)
>>>>>>>
>>>>>>> +extern volatile bool dhd_mmc_suspend;
>>>>>> This does not do what you think it does.
>>>>> Hi Greg,
>>>>>
>>>>> I posted the 'catchup' patch set and I rebased it on '[PATCH 1/2]
>>>>> brcm80211: FIX for TKIP GTK bug' from Sukesh. The only other two
>>>>> patches I saw on the linuxdriver list are:
>>>> You rebased on a 1/2 patch in a series with an invalid 0/2 email?
>>>>
>>>> {sigh}
>>> Sorry.
>>>> I dropped that patch as the whole series needed to be resent, do you
>>>> want me to apply that one patch before yours?
>>> I can resend my series if that is more convenient for you.
>> Please, but just send it to me, I doubt everyone wants to see 60+
>> patches again on the list.
> Ok. Just for this time I will agree to break the rules ;-)

Hi Greg,

I rebase and regenerated the patch files. Did a diff before resending 
them with the previous set and there are no relevant differences so the 
patches I sent this morning are ok.

Gr. AvS


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg KH May 3, 2011, 7:46 p.m. UTC | #9
On Tue, May 03, 2011 at 03:41:50PM +0200, Arend van Spriel wrote:
> On 05/03/2011 03:17 PM, Arend van Spriel wrote:
> >On 05/03/2011 03:11 PM, Greg KH wrote:
> >>On Tue, May 03, 2011 at 03:09:20PM +0200, Arend van Spriel wrote:
> >>>On 05/03/2011 03:00 PM, Greg KH wrote:
> >>>>On Tue, May 03, 2011 at 02:33:44PM +0200, Arend van Spriel wrote:
> >>>>>On 05/03/2011 02:15 PM, Greg KH wrote:
> >>>>>>On Tue, May 03, 2011 at 12:00:57AM -0700, sukeshs@broadcom.com wrote:
> >>>>>>>   #if defined(CONFIG_PM_SLEEP)
> >>>>>>>
> >>>>>>>+extern volatile bool dhd_mmc_suspend;
> >>>>>>This does not do what you think it does.
> >>>>>Hi Greg,
> >>>>>
> >>>>>I posted the 'catchup' patch set and I rebased it on '[PATCH 1/2]
> >>>>>brcm80211: FIX for TKIP GTK bug' from Sukesh. The only other two
> >>>>>patches I saw on the linuxdriver list are:
> >>>>You rebased on a 1/2 patch in a series with an invalid 0/2 email?
> >>>>
> >>>>{sigh}
> >>>Sorry.
> >>>>I dropped that patch as the whole series needed to be resent, do you
> >>>>want me to apply that one patch before yours?
> >>>I can resend my series if that is more convenient for you.
> >>Please, but just send it to me, I doubt everyone wants to see 60+
> >>patches again on the list.
> >Ok. Just for this time I will agree to break the rules ;-)
> 
> Hi Greg,
> 
> I rebase and regenerated the patch files. Did a diff before
> resending them with the previous set and there are no relevant
> differences so the patches I sent this morning are ok.

Great, I've applied them all now.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
 }