]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
iwlagn: warn about nested SYNC commands
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Thu, 9 Jun 2011 12:48:36 +0000 (05:48 -0700)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Sat, 18 Jun 2011 15:19:07 +0000 (08:19 -0700)
Since there is no protection around SYNC host command mechanism, at least WARN
when collision happens between two SYNC host comamnds. I am not sure there is a
real  issue (beyond the HCMD_ACTIVE flag maintenance) with having two SYNC host
commands at the same time, but at least now, we will know about it.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-hcmd.c

index 34f9d0f6702ab310f87f694c4019558d8605fd22..2d13d8928e2c2c174db4e7f659abbfcbb8873348 100644 (file)
@@ -1300,6 +1300,7 @@ struct iwl_priv {
 
        /* command queue number */
        u8 cmd_queue;
+       u8 last_sync_cmd_id;
 
        /* max number of station keys */
        u8 sta_key_max_num;
index 76f9966231405bf50a97e89ece9381300e30c4d1..7cdb1ec73b54b7a40f015a64ec1bd8bc2861951c 100644 (file)
@@ -181,7 +181,16 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
        IWL_DEBUG_INFO(priv, "Attempting to send sync command %s\n",
                        get_cmd_string(cmd->id));
 
-       set_bit(STATUS_HCMD_ACTIVE, &priv->status);
+       if (test_and_set_bit(STATUS_HCMD_ACTIVE, &priv->status)) {
+               IWL_ERR(priv, "STATUS_HCMD_ACTIVE already set while sending %s"
+                             ". Previous SYNC cmdn is %s\n",
+                       get_cmd_string(cmd->id),
+                       get_cmd_string(priv->last_sync_cmd_id));
+               WARN_ON(1);
+       } else {
+               priv->last_sync_cmd_id = cmd->id;
+       }
+
        IWL_DEBUG_INFO(priv, "Setting HCMD_ACTIVE for command %s\n",
                        get_cmd_string(cmd->id));