[054/102] mwifiex: cancel cmd timer and free curr_cmd in shutdown process

Submitted by Luis Henriques on April 8, 2013, 9:50 a.m.

Details

Message ID 1365414657-29191-55-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques April 8, 2013, 9:50 a.m.
3.5.7.10 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Bing Zhao <bzhao@marvell.com>

commit 084c7189acb3f969c855536166042e27f5dd703f upstream.

curr_cmd points to the command that is in processing or waiting
for its command response from firmware. If the function shutdown
happens to occur at this time we should cancel the cmd timer and
put the command back to free queue.

Tested-by: Marco Cesarano <marco@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/net/wireless/mwifiex/init.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Bing Zhao April 8, 2013, 6:03 p.m.
Hi Luis,

> 3.5.7.10 -stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Bing Zhao <bzhao@marvell.com>
> 
> commit 084c7189acb3f969c855536166042e27f5dd703f upstream.
> 
> curr_cmd points to the command that is in processing or waiting
> for its command response from firmware. If the function shutdown
> happens to occur at this time we should cancel the cmd timer and
> put the command back to free queue.
> 
> Tested-by: Marco Cesarano <marco@marvell.com>
> Signed-off-by: Bing Zhao <bzhao@marvell.com>
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>

This patch is intended for kernel 3.8+.
Please drop it from linux-3.5.7.10 stable.

Thanks,
Bing
Luis Henriques April 9, 2013, 8:51 a.m.
Hi Bing,

On Mon, Apr 08, 2013 at 11:03:32AM -0700, Bing Zhao wrote:
> Hi Luis,
> 
> > 3.5.7.10 -stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Bing Zhao <bzhao@marvell.com>
> > 
> > commit 084c7189acb3f969c855536166042e27f5dd703f upstream.
> > 
> > curr_cmd points to the command that is in processing or waiting
> > for its command response from firmware. If the function shutdown
> > happens to occur at this time we should cancel the cmd timer and
> > put the command back to free queue.
> > 
> > Tested-by: Marco Cesarano <marco@marvell.com>
> > Signed-off-by: Bing Zhao <bzhao@marvell.com>
> > Signed-off-by: John W. Linville <linville@tuxdriver.com>
> > Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> 
> This patch is intended for kernel 3.8+.
> Please drop it from linux-3.5.7.10 stable.

Sorry, I didn't noticed that.  I'll drop it from 3.5.  Thanks.

Cheers,
--
Luis

Patch hide | download patch | download mbox

diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
index c1cb004..0346cc2 100644
--- a/drivers/net/wireless/mwifiex/init.c
+++ b/drivers/net/wireless/mwifiex/init.c
@@ -591,6 +591,14 @@  mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
 		return ret;
 	}
 
+	/* cancel current command */
+	if (adapter->curr_cmd) {
+		dev_warn(adapter->dev, "curr_cmd is still in processing\n");
+		del_timer(&adapter->cmd_timer);
+		mwifiex_insert_cmd_to_free_q(adapter, adapter->curr_cmd);
+		adapter->curr_cmd = NULL;
+	}
+
 	/* shut down mwifiex */
 	dev_dbg(adapter->dev, "info: shutdown mwifiex...\n");