diff mbox

[1/4] mwifiex: remove explicit mwifiex_complete_cmd calls

Message ID 1437117186-25243-2-git-send-email-afenkart@gmail.com (mailing list archive)
State Accepted
Delegated to: Kalle Valo
Headers show

Commit Message

Andreas Fenkart July 17, 2015, 7:13 a.m. UTC
standard call chain when releasing a cmd node:
mwifiex_recycle_cmd_node
-> mwifiex_insert_cmd_to_free_q
-> mwifiex_complete_cmd, if wait_q_enabled

calling mwifiex_complete_cmd explicitly and setting
wait_q_enabled = false is redundant

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
---
 drivers/net/wireless/mwifiex/cmdevt.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Amitkumar Karwar July 24, 2015, 11:12 a.m. UTC | #1
Hi Andreas,

> From: Andreas Fenkart [mailto:afenkart@gmail.com]
> Sent: Friday, July 17, 2015 12:43 PM
> To: linux-wireless@vger.kernel.org
> Cc: Amitkumar Karwar; Kalle Valo; Andreas Fenkart
> Subject: [PATCH 1/4] mwifiex: remove explicit mwifiex_complete_cmd calls
> 
> standard call chain when releasing a cmd node:
> mwifiex_recycle_cmd_node
> -> mwifiex_insert_cmd_to_free_q
> -> mwifiex_complete_cmd, if wait_q_enabled
> 
> calling mwifiex_complete_cmd explicitly and setting wait_q_enabled =
> false is redundant
> 
> Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
> ---
>  drivers/net/wireless/mwifiex/cmdevt.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/wireless/mwifiex/cmdevt.c
> b/drivers/net/wireless/mwifiex/cmdevt.c
> index 207da40..2f4715e 100644
> --- a/drivers/net/wireless/mwifiex/cmdevt.c
> +++ b/drivers/net/wireless/mwifiex/cmdevt.c
> @@ -167,8 +167,6 @@ static int mwifiex_dnld_cmd_to_fw(struct
> mwifiex_private *priv,
>  		mwifiex_dbg(adapter, ERROR,
>  			    "DNLD_CMD: FW in reset state, ignore cmd %#x\n",
>  			cmd_code);
> -		if (cmd_node->wait_q_enabled)
> -			mwifiex_complete_cmd(adapter, cmd_node);
>  		mwifiex_recycle_cmd_node(adapter, cmd_node);
>  		queue_work(adapter->workqueue, &adapter->main_work);
>  		return -1;
> @@ -1024,6 +1022,7 @@ mwifiex_cancel_all_pending_cmd(struct
> mwifiex_adapter *adapter)
>  		adapter->curr_cmd->wait_q_enabled = false;
>  		adapter->cmd_wait_q.status = -1;
>  		mwifiex_complete_cmd(adapter, adapter->curr_cmd);
> +		/* no recycle probably wait for response */
>  	}
>  	/* Cancel all pending command */
>  	spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags); @@ -
> 1032,11 +1031,8 @@ mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter
> *adapter)
>  		list_del(&cmd_node->list);
>  		spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags);
> 
> -		if (cmd_node->wait_q_enabled) {
> +		if (cmd_node->wait_q_enabled)
>  			adapter->cmd_wait_q.status = -1;
> -			mwifiex_complete_cmd(adapter, cmd_node);
> -			cmd_node->wait_q_enabled = false;
> -		}
>  		mwifiex_recycle_cmd_node(adapter, cmd_node);
>  		spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags);
>  	}
> @@ -1094,10 +1090,8 @@ mwifiex_cancel_pending_ioctl(struct
> mwifiex_adapter *adapter)
>  	    (adapter->curr_cmd->wait_q_enabled)) {
>  		spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags);
>  		cmd_node = adapter->curr_cmd;
> -		cmd_node->wait_q_enabled = false;
>  		cmd_node->cmd_flag |= CMD_F_CANCELED;
>  		mwifiex_recycle_cmd_node(adapter, cmd_node);
> -		mwifiex_complete_cmd(adapter, adapter->curr_cmd);
>  		adapter->curr_cmd = NULL;
>  		spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock,
> cmd_flags);
>  	}
> --
> 2.1.4

Acked-by: Amitkumar Karwar <akarwar@marvell.com>

Regards,
Amitkumar
--
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
Kalle Valo Aug. 6, 2015, 7:10 a.m. UTC | #2
> standard call chain when releasing a cmd node:
> mwifiex_recycle_cmd_node
> -> mwifiex_insert_cmd_to_free_q
> -> mwifiex_complete_cmd, if wait_q_enabled
> 
> calling mwifiex_complete_cmd explicitly and setting
> wait_q_enabled = false is redundant
> 
> Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
> Acked-by: Amitkumar Karwar <akarwar@marvell.com>

Thanks, 4 patches applied to wireless-drivers-next.git:

e3a3ef25b8cb mwifiex: remove explicit mwifiex_complete_cmd calls
aeb03000837e mwifiex: remove redundant reset of cmd_wait_q status
e9f21d403699 mwifiex: remove CMD_F_CANCELED flag
c5bc15fce6aa mwifiex: simplify mwifiex_complete_cmd

Kalle Valo
--
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/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index 207da40..2f4715e 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -167,8 +167,6 @@  static int mwifiex_dnld_cmd_to_fw(struct mwifiex_private *priv,
 		mwifiex_dbg(adapter, ERROR,
 			    "DNLD_CMD: FW in reset state, ignore cmd %#x\n",
 			cmd_code);
-		if (cmd_node->wait_q_enabled)
-			mwifiex_complete_cmd(adapter, cmd_node);
 		mwifiex_recycle_cmd_node(adapter, cmd_node);
 		queue_work(adapter->workqueue, &adapter->main_work);
 		return -1;
@@ -1024,6 +1022,7 @@  mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter)
 		adapter->curr_cmd->wait_q_enabled = false;
 		adapter->cmd_wait_q.status = -1;
 		mwifiex_complete_cmd(adapter, adapter->curr_cmd);
+		/* no recycle probably wait for response */
 	}
 	/* Cancel all pending command */
 	spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags);
@@ -1032,11 +1031,8 @@  mwifiex_cancel_all_pending_cmd(struct mwifiex_adapter *adapter)
 		list_del(&cmd_node->list);
 		spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags);
 
-		if (cmd_node->wait_q_enabled) {
+		if (cmd_node->wait_q_enabled)
 			adapter->cmd_wait_q.status = -1;
-			mwifiex_complete_cmd(adapter, cmd_node);
-			cmd_node->wait_q_enabled = false;
-		}
 		mwifiex_recycle_cmd_node(adapter, cmd_node);
 		spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags);
 	}
@@ -1094,10 +1090,8 @@  mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter)
 	    (adapter->curr_cmd->wait_q_enabled)) {
 		spin_lock_irqsave(&adapter->mwifiex_cmd_lock, cmd_flags);
 		cmd_node = adapter->curr_cmd;
-		cmd_node->wait_q_enabled = false;
 		cmd_node->cmd_flag |= CMD_F_CANCELED;
 		mwifiex_recycle_cmd_node(adapter, cmd_node);
-		mwifiex_complete_cmd(adapter, adapter->curr_cmd);
 		adapter->curr_cmd = NULL;
 		spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, cmd_flags);
 	}