|
@@ -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;
|
|
|
}
|
|
|
|