2016-11-18 17:13:59

by Amitkumar Karwar

[permalink] [raw]
Subject: [PATCH 1/2] mwifiex: cleanup wake-IRQ handling if suspend fails

From: Brian Norris <[email protected]>

We don't want to leave the wake IRQ enabled.

Signed-off-by: Brian Norris <[email protected]>
Signed-off-by: Amitkumar Karwar <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/pcie.c | 1 +
drivers/net/wireless/marvell/mwifiex/sdio.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 62ec141..32fa4ed 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -137,6 +137,7 @@ static int mwifiex_pcie_suspend(struct device *dev)
mwifiex_dbg(adapter, ERROR,
"cmd: failed to suspend\n");
adapter->hs_enabling = false;
+ mwifiex_disable_wake(adapter);
return -EFAULT;
}

diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c
index c219671..78f2cc9 100644
--- a/drivers/net/wireless/marvell/mwifiex/sdio.c
+++ b/drivers/net/wireless/marvell/mwifiex/sdio.c
@@ -308,6 +308,7 @@ static int mwifiex_sdio_suspend(struct device *dev)
mwifiex_dbg(adapter, ERROR,
"cmd: failed to suspend\n");
adapter->hs_enabling = false;
+ mwifiex_disable_wake(adapter);
return -EFAULT;
}

--
1.9.1


2016-11-18 17:14:07

by Amitkumar Karwar

[permalink] [raw]
Subject: [PATCH 2/2] mwifiex: avoid double-disable_irq() race

From: Brian Norris <[email protected]>

We have a race where the wakeup IRQ might be in flight while we're
calling mwifiex_disable_wake() from resume(). This can leave us
disabling the IRQ twice.

Let's disable the IRQ and enable it in case if we have double-disabled
it.

Signed-off-by: Brian Norris <[email protected]>
Signed-off-by: Amitkumar Karwar <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/main.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h
index b8ef1c0..d501d03 100644
--- a/drivers/net/wireless/marvell/mwifiex/main.h
+++ b/drivers/net/wireless/marvell/mwifiex/main.h
@@ -1419,8 +1419,13 @@ static inline void mwifiex_disable_wake(struct mwifiex_adapter *adapter)
{
if (adapter->irq_wakeup >= 0) {
disable_irq_wake(adapter->irq_wakeup);
- if (!adapter->wake_by_wifi)
- disable_irq(adapter->irq_wakeup);
+ disable_irq(adapter->irq_wakeup);
+ if (adapter->wake_by_wifi)
+ /* Undo our disable, since interrupt handler already
+ * did this.
+ */
+ enable_irq(adapter->irq_wakeup);
+
}
}

--
1.9.1

2016-11-25 09:50:25

by Kalle Valo

[permalink] [raw]
Subject: Re: [1/2] mwifiex: cleanup wake-IRQ handling if suspend fails

Amitkumar Karwar <[email protected]> wrote:
> From: Brian Norris <[email protected]>
>
> We don't want to leave the wake IRQ enabled.
>
> Signed-off-by: Brian Norris <[email protected]>
> Signed-off-by: Amitkumar Karwar <[email protected]>

2 patches applied to wireless-drivers-next.git, thanks.

d96e39270ba5 mwifiex: cleanup wake-IRQ handling if suspend fails
b9da4d223bda mwifiex: avoid double-disable_irq() race

--
https://patchwork.kernel.org/patch/9437097/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches