From: wwguy <wey-yi.w.guy@intel.com>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Intel Linux Wireless <ilw@linux.intel.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 3/3] iwlwifi: remove sync_cmd_mutex
Date: Thu, 31 Mar 2011 09:18:15 -0700 [thread overview]
Message-ID: <1301588295.22383.10.camel@wwguy-ubuntu> (raw)
In-Reply-To: <1301585788-7331-3-git-send-email-sgruszka@redhat.com>
On Thu, 2011-03-31 at 08:36 -0700, Stanislaw Gruszka wrote:
> We now use priv->mutex to serialize sync command, remove old
> priv->sync_cmd_mutex and add assertion that priv->mutex must be locked.
>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
> ---
> drivers/net/wireless/iwlwifi/iwl-agn.c | 4 ----
> drivers/net/wireless/iwlwifi/iwl-dev.h | 1 -
> drivers/net/wireless/iwlwifi/iwl-hcmd.c | 13 +++++--------
> 3 files changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
> index 0c49d1a..6f188fd 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-agn.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
> @@ -2565,9 +2565,6 @@ static void __iwl_down(struct iwl_priv *priv)
> priv->bt_full_concurrent = false;
> priv->bt_ci_compliance = 0;
>
> - /* Unblock any waiting calls */
> - wake_up_interruptible_all(&priv->wait_command_queue);
> -
> /* Wipe out the EXIT_PENDING status bit if we are not actually
> * exiting the module */
> if (!exit_pending)
> @@ -3814,7 +3811,6 @@ static int iwl_init_drv(struct iwl_priv *priv)
> INIT_LIST_HEAD(&priv->free_frames);
>
> mutex_init(&priv->mutex);
> - mutex_init(&priv->sync_cmd_mutex);
>
> priv->ieee_channels = NULL;
> priv->ieee_rates = NULL;
> diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
> index 9e63bd8..ca30f95 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-dev.h
> +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
> @@ -1306,7 +1306,6 @@ struct iwl_priv {
> spinlock_t hcmd_lock; /* protect hcmd */
> spinlock_t reg_lock; /* protect hw register access */
> struct mutex mutex;
> - struct mutex sync_cmd_mutex; /* enable serialization of sync commands */
>
> /* basic pci-network driver stuff */
> struct pci_dev *pci_dev;
> diff --git a/drivers/net/wireless/iwlwifi/iwl-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
> index 02499f6..c71c0a4 100644
> --- a/drivers/net/wireless/iwlwifi/iwl-hcmd.c
> +++ b/drivers/net/wireless/iwlwifi/iwl-hcmd.c
> @@ -171,14 +171,13 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
> int cmd_idx;
> int ret;
>
> - BUG_ON(cmd->flags & CMD_ASYNC);
> + lockdep_assert_held(&priv->mutex);
>
> /* A synchronous command can not have a callback set. */
> - BUG_ON(cmd->callback);
> + BUG_ON((cmd->flags & CMD_ASYNC) || cmd->callback);
>
> IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n",
> get_cmd_string(cmd->id));
> - mutex_lock(&priv->sync_cmd_mutex);
>
> set_bit(STATUS_HCMD_ACTIVE, &priv->status);
> IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n",
> @@ -189,7 +188,7 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
> ret = cmd_idx;
> IWL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n",
> get_cmd_string(cmd->id), ret);
> - goto out;
> + return ret;
> }
>
> ret = wait_event_interruptible_timeout(priv->wait_command_queue,
> @@ -229,8 +228,7 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
> goto cancel;
> }
>
> - ret = 0;
> - goto out;
> + return 0;
>
> cancel:
> if (cmd->flags & CMD_WANT_SKB) {
> @@ -248,8 +246,7 @@ fail:
> iwl_free_pages(priv, cmd->reply_page);
> cmd->reply_page = 0;
> }
> -out:
> - mutex_unlock(&priv->sync_cmd_mutex);
> +
> return ret;
> }
>
next prev parent reply other threads:[~2011-03-31 16:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-31 15:36 [PATCH 1/3] iwlwifi: fix enqueue hcmd race conditions Stanislaw Gruszka
2011-03-31 15:36 ` [PATCH 2/3] iwlwifi: more priv->mutex serialization Stanislaw Gruszka
2011-03-31 16:15 ` wwguy
2011-03-31 15:36 ` [PATCH 3/3] iwlwifi: remove sync_cmd_mutex Stanislaw Gruszka
2011-03-31 16:18 ` wwguy [this message]
2011-03-31 16:36 ` [PATCH 1/3] iwlwifi: fix enqueue hcmd race conditions Guy, Wey-Yi W
2011-04-01 7:22 ` Stanislaw Gruszka
2011-04-01 15:07 ` wwguy
2011-04-06 14:18 ` Stanislaw Gruszka
2011-04-06 14:21 ` Guy, Wey-Yi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1301588295.22383.10.camel@wwguy-ubuntu \
--to=wey-yi.w.guy@intel.com \
--cc=ilw@linux.intel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=sgruszka@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).