iwlagn: move hcmd_lock to transport layer
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Fri, 26 Aug 2011 06:11:07 +0000 (23:11 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 29 Aug 2011 19:30:27 +0000 (15:30 -0400)
Since it is needed for host commands only, it is needed in transport layer only

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
drivers/net/wireless/iwlwifi/iwl-trans.c
drivers/net/wireless/iwlwifi/iwl-trans.h

index f559c6362a00a7cd5bc800d6247d4affa6be97c3..9c5f08a938ebb5db84693d3260f9d700d0e11742 100644 (file)
@@ -3059,7 +3059,6 @@ static int iwl_init_drv(struct iwl_priv *priv)
        int ret;
 
        spin_lock_init(&priv->shrd->sta_lock);
-       spin_lock_init(&priv->hcmd_lock);
 
        mutex_init(&priv->shrd->mutex);
 
index eac25c507d30605539ccef7f534afdfd423278e5..de293cf0217717c40a67a99e05399f467df0eb5a 100644 (file)
@@ -1178,7 +1178,6 @@ struct iwl_priv {
        u8 mgmt_tx_ant;
 
        /* spinlock */
-       spinlock_t hcmd_lock;   /* protect hcmd */
        spinlock_t reg_lock;    /* protect hw register access */
 
        /*TODO: remove these pointers - use bus(priv) instead */
index 1704eab8ddf29ce5c966e42c4e601f8157f90c8c..835e3edb9ccefd05aa0e4c3d5925f502d2f81d18 100644 (file)
@@ -601,10 +601,10 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
                return -EIO;
        }
 
-       spin_lock_irqsave(&priv->hcmd_lock, flags);
+       spin_lock_irqsave(&trans->hcmd_lock, flags);
 
        if (iwl_queue_space(q) < ((cmd->flags & CMD_ASYNC) ? 2 : 1)) {
-               spin_unlock_irqrestore(&priv->hcmd_lock, flags);
+               spin_unlock_irqrestore(&trans->hcmd_lock, flags);
 
                IWL_ERR(trans, "No space in command queue\n");
                is_ct_kill = iwl_check_for_ct_kill(priv);
@@ -713,7 +713,7 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
        iwl_txq_update_write_ptr(priv, txq);
 
  out:
-       spin_unlock_irqrestore(&priv->hcmd_lock, flags);
+       spin_unlock_irqrestore(&trans->hcmd_lock, flags);
        return idx;
 }
 
@@ -796,7 +796,7 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
        } else if (meta->callback)
                meta->callback(priv, cmd, pkt);
 
-       spin_lock_irqsave(&priv->hcmd_lock, flags);
+       spin_lock_irqsave(&trans->hcmd_lock, flags);
 
        iwl_hcmd_queue_reclaim(priv, txq_id, index);
 
@@ -809,7 +809,7 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
 
        meta->flags = 0;
 
-       spin_unlock_irqrestore(&priv->hcmd_lock, flags);
+       spin_unlock_irqrestore(&trans->hcmd_lock, flags);
 }
 
 const char *get_cmd_string(u8 cmd)
index b448e79c259b44af50a9c3953de655ccb468e9f3..73883fe1c2d1ecd886902ed1210509e68d798af6 100644 (file)
@@ -1284,6 +1284,7 @@ static struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd)
                iwl_trans->ops = &trans_ops_pcie;
                iwl_trans->shrd = shrd;
                trans_pcie->trans = iwl_trans;
+               spin_lock_init(&iwl_trans->hcmd_lock);
        }
 
        return iwl_trans;
index da6cc59dfa2b5288076989f9c28a5b78c055206f..78bd2f636452f207c50e5b8c9a5fbabe6f931242 100644 (file)
@@ -146,10 +146,12 @@ struct iwl_trans_ops {
  * struct iwl_trans - transport common data
  * @ops - pointer to iwl_trans_ops
  * @shrd - pointer to iwl_shared which holds shared data from the upper layer
+ * @hcmd_lock: protects HCMD
  */
 struct iwl_trans {
        const struct iwl_trans_ops *ops;
        struct iwl_shared *shrd;
+       spinlock_t hcmd_lock;
 
        /* pointer to trans specific struct */
        /*Ensure that this pointer will always be aligned to sizeof pointer */