Commit 8447c163 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by John W. Linville

iwlwifi: remove sync_cmd_mutex

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: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Acked-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent dc1a4068
...@@ -2371,9 +2371,6 @@ static void __iwl_down(struct iwl_priv *priv) ...@@ -2371,9 +2371,6 @@ static void __iwl_down(struct iwl_priv *priv)
priv->bt_full_concurrent = false; priv->bt_full_concurrent = false;
priv->bt_ci_compliance = 0; 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 /* Wipe out the EXIT_PENDING status bit if we are not actually
* exiting the module */ * exiting the module */
if (!exit_pending) if (!exit_pending)
...@@ -3620,7 +3617,6 @@ static int iwl_init_drv(struct iwl_priv *priv) ...@@ -3620,7 +3617,6 @@ static int iwl_init_drv(struct iwl_priv *priv)
INIT_LIST_HEAD(&priv->free_frames); INIT_LIST_HEAD(&priv->free_frames);
mutex_init(&priv->mutex); mutex_init(&priv->mutex);
mutex_init(&priv->sync_cmd_mutex);
priv->ieee_channels = NULL; priv->ieee_channels = NULL;
priv->ieee_rates = NULL; priv->ieee_rates = NULL;
......
...@@ -1307,7 +1307,6 @@ struct iwl_priv { ...@@ -1307,7 +1307,6 @@ struct iwl_priv {
spinlock_t hcmd_lock; /* protect hcmd */ spinlock_t hcmd_lock; /* protect hcmd */
spinlock_t reg_lock; /* protect hw register access */ spinlock_t reg_lock; /* protect hw register access */
struct mutex mutex; struct mutex mutex;
struct mutex sync_cmd_mutex; /* enable serialization of sync commands */
/* basic pci-network driver stuff */ /* basic pci-network driver stuff */
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
......
...@@ -171,14 +171,13 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) ...@@ -171,14 +171,13 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
int cmd_idx; int cmd_idx;
int ret; int ret;
BUG_ON(cmd->flags & CMD_ASYNC); lockdep_assert_held(&priv->mutex);
/* A synchronous command can not have a callback set. */ /* 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", IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n",
get_cmd_string(cmd->id)); get_cmd_string(cmd->id));
mutex_lock(&priv->sync_cmd_mutex);
set_bit(STATUS_HCMD_ACTIVE, &priv->status); set_bit(STATUS_HCMD_ACTIVE, &priv->status);
IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n", 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) ...@@ -189,7 +188,7 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
ret = cmd_idx; ret = cmd_idx;
IWL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n", IWL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n",
get_cmd_string(cmd->id), ret); get_cmd_string(cmd->id), ret);
goto out; return ret;
} }
ret = wait_event_interruptible_timeout(priv->wait_command_queue, 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) ...@@ -229,8 +228,7 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
goto cancel; goto cancel;
} }
ret = 0; return 0;
goto out;
cancel: cancel:
if (cmd->flags & CMD_WANT_SKB) { if (cmd->flags & CMD_WANT_SKB) {
...@@ -248,8 +246,7 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd) ...@@ -248,8 +246,7 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
iwl_free_pages(priv, cmd->reply_page); iwl_free_pages(priv, cmd->reply_page);
cmd->reply_page = 0; cmd->reply_page = 0;
} }
out:
mutex_unlock(&priv->sync_cmd_mutex);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment