]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iwlwifi: fix the preparation of the card
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 5 Aug 2012 13:55:06 +0000 (16:55 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 21 Aug 2012 16:31:27 +0000 (18:31 +0200)
There is no need to check if the ownership has been
relinquished but we should rather try to get it in a
loop.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/pcie/trans.c

index f981b738729256ff200f03699c820ce8d1f3bf11..f76efac230e23263b16fbb8164e46adf0184606a 100644 (file)
@@ -897,6 +897,7 @@ static int iwl_set_hw_ready(struct iwl_trans *trans)
 static int iwl_prepare_card_hw(struct iwl_trans *trans)
 {
        int ret;
+       int t = 0;
 
        IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n");
 
@@ -909,17 +910,15 @@ static int iwl_prepare_card_hw(struct iwl_trans *trans)
        iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG,
                    CSR_HW_IF_CONFIG_REG_PREPARE);
 
-       ret = iwl_poll_bit(trans, CSR_HW_IF_CONFIG_REG,
-                          ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE,
-                          CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000);
+       do {
+               ret = iwl_set_hw_ready(trans);
+               if (ret >= 0)
+                       return 0;
 
-       if (ret < 0)
-               return ret;
+               usleep_range(200, 1000);
+               t += 200;
+       } while (t < 150000);
 
-       /* HW should be ready by now, check again. */
-       ret = iwl_set_hw_ready(trans);
-       if (ret >= 0)
-               return 0;
        return ret;
 }