diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2012-08-05 09:55:06 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-08-21 12:31:27 -0400 |
commit | 289e5501c3141191dd830957f1d764d3dc14a54f (patch) | |
tree | 41b802ef568f2689e93bae4595fb39c50551b50b /drivers/net/wireless/iwlwifi | |
parent | da0cabb8de68d9dba254810f65aa7146eb5f47b3 (diff) |
iwlwifi: fix the preparation of the card
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>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/pcie/trans.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index f981b7387292..f76efac230e2 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -897,6 +897,7 @@ static int iwl_set_hw_ready(struct iwl_trans *trans) | |||
897 | static int iwl_prepare_card_hw(struct iwl_trans *trans) | 897 | static int iwl_prepare_card_hw(struct iwl_trans *trans) |
898 | { | 898 | { |
899 | int ret; | 899 | int ret; |
900 | int t = 0; | ||
900 | 901 | ||
901 | IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n"); | 902 | IWL_DEBUG_INFO(trans, "iwl_trans_prepare_card_hw enter\n"); |
902 | 903 | ||
@@ -909,17 +910,15 @@ static int iwl_prepare_card_hw(struct iwl_trans *trans) | |||
909 | iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, | 910 | iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, |
910 | CSR_HW_IF_CONFIG_REG_PREPARE); | 911 | CSR_HW_IF_CONFIG_REG_PREPARE); |
911 | 912 | ||
912 | ret = iwl_poll_bit(trans, CSR_HW_IF_CONFIG_REG, | 913 | do { |
913 | ~CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, | 914 | ret = iwl_set_hw_ready(trans); |
914 | CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000); | 915 | if (ret >= 0) |
916 | return 0; | ||
915 | 917 | ||
916 | if (ret < 0) | 918 | usleep_range(200, 1000); |
917 | return ret; | 919 | t += 200; |
920 | } while (t < 150000); | ||
918 | 921 | ||
919 | /* HW should be ready by now, check again. */ | ||
920 | ret = iwl_set_hw_ready(trans); | ||
921 | if (ret >= 0) | ||
922 | return 0; | ||
923 | return ret; | 922 | return ret; |
924 | } | 923 | } |
925 | 924 | ||