All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mwifiex: fix power state out of sync problem
@ 2016-01-12 13:43 Amitkumar Karwar
  2016-01-29  9:18 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Amitkumar Karwar @ 2016-01-12 13:43 UTC (permalink / raw)
  To: linux-wireless
  Cc: Cathy Luo, Nishant Sarmukadam, Shengzhen Li, Amitkumar Karwar

From: Shengzhen Li <szli@marvell.com>

It's been observed that driver's power state goes out
of sync with firmware in some corner cases. When this
happens, driver tries to download the data to firmware
assuming it's awake which causes Tx data timeout.

Main thread will process interrupt as soon as interrupt
handler fills 'int_status' variable.

This patch fixes the race issue by updating 'int_status'
at the end of mwifiex_interrupt_status().

Signed-off-by: Shengzhen Li <szli@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
---
 drivers/net/wireless/marvell/mwifiex/pcie.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index 5e15464..918e049 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -2116,11 +2116,6 @@ static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter,
 		}
 	}
 
-	spin_lock_irqsave(&adapter->int_lock, flags);
-	adapter->int_status |= pcie_ireg;
-	spin_unlock_irqrestore(&adapter->int_lock, flags);
-	mwifiex_dbg(adapter, INTR, "ireg: 0x%08x\n", pcie_ireg);
-
 	if (!adapter->pps_uapsd_mode &&
 	    adapter->ps_state == PS_STATE_SLEEP &&
 	    mwifiex_pcie_ok_to_access_hw(adapter)) {
@@ -2132,6 +2127,11 @@ static void mwifiex_interrupt_status(struct mwifiex_adapter *adapter,
 		adapter->pm_wakeup_fw_try = false;
 		del_timer(&adapter->wakeup_timer);
 	}
+
+	spin_lock_irqsave(&adapter->int_lock, flags);
+	adapter->int_status |= pcie_ireg;
+	spin_unlock_irqrestore(&adapter->int_lock, flags);
+	mwifiex_dbg(adapter, INTR, "ireg: 0x%08x\n", pcie_ireg);
 }
 
 /*
-- 
1.8.1.4


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

end of thread, other threads:[~2016-01-29  9:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-12 13:43 [PATCH] mwifiex: fix power state out of sync problem Amitkumar Karwar
2016-01-29  9:18 ` 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.