All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mwifiex: cleanup wake-IRQ handling if suspend fails
@ 2016-11-18 17:13 Amitkumar Karwar
  2016-11-18 17:13 ` [PATCH 2/2] mwifiex: avoid double-disable_irq() race Amitkumar Karwar
  2016-11-25  9:50 ` [1/2] mwifiex: cleanup wake-IRQ handling if suspend fails Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Amitkumar Karwar @ 2016-11-18 17:13 UTC (permalink / raw)
  To: linux-wireless
  Cc: rajatja, briannorris, dmitry.torokhov, Brian Norris, Amitkumar Karwar

From: Brian Norris <briannorris@chromium.org>

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

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] mwifiex: avoid double-disable_irq() race
  2016-11-18 17:13 [PATCH 1/2] mwifiex: cleanup wake-IRQ handling if suspend fails Amitkumar Karwar
@ 2016-11-18 17:13 ` Amitkumar Karwar
  2016-11-25  9:50 ` [1/2] mwifiex: cleanup wake-IRQ handling if suspend fails Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Amitkumar Karwar @ 2016-11-18 17:13 UTC (permalink / raw)
  To: linux-wireless
  Cc: rajatja, briannorris, dmitry.torokhov, Brian Norris, Amitkumar Karwar

From: Brian Norris <briannorris@chromium.org>

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 <briannorris@chromium.org>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [1/2] mwifiex: cleanup wake-IRQ handling if suspend fails
  2016-11-18 17:13 [PATCH 1/2] mwifiex: cleanup wake-IRQ handling if suspend fails Amitkumar Karwar
  2016-11-18 17:13 ` [PATCH 2/2] mwifiex: avoid double-disable_irq() race Amitkumar Karwar
@ 2016-11-25  9:50 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2016-11-25  9:50 UTC (permalink / raw)
  To: Amitkumar Karwar
  Cc: linux-wireless, rajatja, briannorris, dmitry.torokhov,
	Brian Norris, Amitkumar Karwar

Amitkumar Karwar <akarwar@marvell.com> wrote:
> From: Brian Norris <briannorris@chromium.org>
> 
> We don't want to leave the wake IRQ enabled.
> 
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-25  9:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-18 17:13 [PATCH 1/2] mwifiex: cleanup wake-IRQ handling if suspend fails Amitkumar Karwar
2016-11-18 17:13 ` [PATCH 2/2] mwifiex: avoid double-disable_irq() race Amitkumar Karwar
2016-11-25  9:50 ` [1/2] mwifiex: cleanup wake-IRQ handling if suspend fails Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.