iwlwifi: refactor stop master function
This patch refactors stop master function for 4965 and 5000.
Currently it duplicates the function.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 27cfe3c..d607452 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -56,6 +56,31 @@
IWL_TX_FIFO_HCCA_2
};
+/* FIXME: same implementation as 4965 */
+static int iwl5000_apm_stop_master(struct iwl_priv *priv)
+{
+ int ret = 0;
+ unsigned long flags;
+
+ spin_lock_irqsave(&priv->lock, flags);
+
+ /* set stop master bit */
+ iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
+
+ ret = iwl_poll_bit(priv, CSR_RESET,
+ CSR_RESET_REG_FLAG_MASTER_DISABLED,
+ CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
+ if (ret < 0)
+ goto out;
+
+out:
+ spin_unlock_irqrestore(&priv->lock, flags);
+ IWL_DEBUG_INFO("stop master\n");
+
+ return ret;
+}
+
+
static int iwl5000_apm_init(struct iwl_priv *priv)
{
int ret = 0;
@@ -105,7 +130,7 @@
{
unsigned long flags;
- iwl4965_hw_nic_stop_master(priv);
+ iwl5000_apm_stop_master(priv);
spin_lock_irqsave(&priv->lock, flags);
@@ -124,7 +149,7 @@
int ret = 0;
unsigned long flags;
- iwl4965_hw_nic_stop_master(priv);
+ iwl5000_apm_stop_master(priv);
spin_lock_irqsave(&priv->lock, flags);