iwlwifi: Check HW ready before prepare card.
authorMohamed Abbas <mohamed.abbas@intel.com>
Fri, 19 Jun 2009 20:52:41 +0000 (13:52 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 10 Jul 2009 19:01:55 +0000 (15:01 -0400)
Hardware may be ready for us to manage it without us trying to prepare
it first. Check if this is the case.

Signed-off-by: Mohamed Abbas <mohamed.abbas@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-agn.c

index 6d1519e1f011ad9f565a9256b3a6175dc54bb424..63cba8c0ad4dde9db01dc8a4ce6659d1dc3a20d2 100644 (file)
@@ -1812,6 +1812,11 @@ static int iwl_prepare_card_hw(struct iwl_priv *priv)
 
        IWL_DEBUG_INFO(priv, "iwl_prepare_card_hw enter \n");
 
+       ret = iwl_set_hw_ready(priv);
+       if (priv->hw_ready)
+               return ret;
+
+       /* If HW is not ready, prepare the conditions to check again */
        iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                        CSR_HW_IF_CONFIG_REG_PREPARE);
 
@@ -1819,6 +1824,7 @@ static int iwl_prepare_card_hw(struct iwl_priv *priv)
                        ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE,
                        CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000);
 
+       /* HW should be ready by now, check again. */
        if (ret != -ETIMEDOUT)
                iwl_set_hw_ready(priv);