Commit 4cd2bf76 authored by Johannes Berg's avatar Johannes Berg Committed by Wey-Yi Guy

iwlagn: remove hw_ready variable

This variable is only ever checked right after
the function that sets it, but the same function
will also return the status, so we can pass it
through instead of checking hw_ready later.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent dbf28e21
...@@ -2306,8 +2306,7 @@ int iwlagn_start_device(struct iwl_priv *priv) ...@@ -2306,8 +2306,7 @@ int iwlagn_start_device(struct iwl_priv *priv)
{ {
int ret; int ret;
iwl_prepare_card_hw(priv); if (iwl_prepare_card_hw(priv)) {
if (!priv->hw_ready) {
IWL_WARN(priv, "Exit HW not ready\n"); IWL_WARN(priv, "Exit HW not ready\n");
return -EIO; return -EIO;
} }
......
...@@ -2367,9 +2367,10 @@ static void iwl_down(struct iwl_priv *priv) ...@@ -2367,9 +2367,10 @@ static void iwl_down(struct iwl_priv *priv)
#define HW_READY_TIMEOUT (50) #define HW_READY_TIMEOUT (50)
/* Note: returns poll_bit return value, which is >= 0 if success */
static int iwl_set_hw_ready(struct iwl_priv *priv) static int iwl_set_hw_ready(struct iwl_priv *priv)
{ {
int ret = 0; int ret;
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_NIC_READY); CSR_HW_IF_CONFIG_REG_BIT_NIC_READY);
...@@ -2379,25 +2380,21 @@ static int iwl_set_hw_ready(struct iwl_priv *priv) ...@@ -2379,25 +2380,21 @@ static int iwl_set_hw_ready(struct iwl_priv *priv)
CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, CSR_HW_IF_CONFIG_REG_BIT_NIC_READY,
CSR_HW_IF_CONFIG_REG_BIT_NIC_READY, CSR_HW_IF_CONFIG_REG_BIT_NIC_READY,
HW_READY_TIMEOUT); HW_READY_TIMEOUT);
if (ret != -ETIMEDOUT)
priv->hw_ready = true;
else
priv->hw_ready = false;
IWL_DEBUG_INFO(priv, "hardware %s\n", IWL_DEBUG_INFO(priv, "hardware%s ready\n", ret < 0 ? " not" : "");
(priv->hw_ready == 1) ? "ready" : "not ready");
return ret; return ret;
} }
/* Note: returns standard 0/-ERROR code */
int iwl_prepare_card_hw(struct iwl_priv *priv) int iwl_prepare_card_hw(struct iwl_priv *priv)
{ {
int ret = 0; int ret;
IWL_DEBUG_INFO(priv, "iwl_prepare_card_hw enter\n"); IWL_DEBUG_INFO(priv, "iwl_prepare_card_hw enter\n");
ret = iwl_set_hw_ready(priv); ret = iwl_set_hw_ready(priv);
if (priv->hw_ready) if (ret >= 0)
return ret; return 0;
/* If HW is not ready, prepare the conditions to check again */ /* If HW is not ready, prepare the conditions to check again */
iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG, iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
...@@ -2407,10 +2404,13 @@ int iwl_prepare_card_hw(struct iwl_priv *priv) ...@@ -2407,10 +2404,13 @@ 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,
CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000); CSR_HW_IF_CONFIG_REG_BIT_NIC_PREPARE_DONE, 150000);
/* HW should be ready by now, check again. */ if (ret < 0)
if (ret != -ETIMEDOUT) return ret;
iwl_set_hw_ready(priv);
/* HW should be ready by now, check again. */
ret = iwl_set_hw_ready(priv);
if (ret >= 0)
return 0;
return ret; return ret;
} }
...@@ -3741,8 +3741,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -3741,8 +3741,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
* PCI Tx retries from interfering with C3 CPU state */ * PCI Tx retries from interfering with C3 CPU state */
pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00); pci_write_config_byte(pdev, PCI_CFG_RETRY_TIMEOUT, 0x00);
iwl_prepare_card_hw(priv); if (iwl_prepare_card_hw(priv)) {
if (!priv->hw_ready) {
IWL_WARN(priv, "Failed, HW not ready\n"); IWL_WARN(priv, "Failed, HW not ready\n");
goto out_iounmap; goto out_iounmap;
} }
......
...@@ -1503,7 +1503,6 @@ struct iwl_priv { ...@@ -1503,7 +1503,6 @@ struct iwl_priv {
struct timer_list statistics_periodic; struct timer_list statistics_periodic;
struct timer_list ucode_trace; struct timer_list ucode_trace;
struct timer_list watchdog; struct timer_list watchdog;
bool hw_ready;
struct iwl_event_log event_log; struct iwl_event_log event_log;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment