iwlwifi/iwl3945 : unify apm stop operation
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>
Fri, 2 Oct 2009 20:44:04 +0000 (13:44 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 7 Oct 2009 20:39:45 +0000 (16:39 -0400)
Unify the usage of apm_stop_master and apm_stop
across all hardwares.

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@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-1000.c
drivers/net/wireless/iwlwifi/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-dev.h

index 86d93b52c6fcd5639ec4bb295e3ef8fa1365f504..679a67ff76ebcf4193a8005ce3b0ed3a1530d0c6 100644 (file)
@@ -112,7 +112,7 @@ static struct iwl_lib_ops iwl1000_lib = {
        .apm_ops = {
                .init = iwl5000_apm_init,
                .reset = iwl5000_apm_reset,
-               .stop = iwl5000_apm_stop,
+               .stop = iwl_apm_stop,
                .config = iwl1000_nic_config,
                .set_pwr_src = iwl_set_pwr_src,
        },
index f0ce5c45ca05956bbf8d8b93da5a44b6ca13f5e9..c5d1d57b4e0bdb8e0062c543403ffd629c96552b 100644 (file)
@@ -1167,48 +1167,9 @@ void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv)
        iwl3945_hw_txq_ctx_free(priv);
 }
 
-static int iwl3945_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);
-
-       iwl_poll_direct_bit(priv, CSR_RESET,
-                           CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
-
-       if (ret < 0)
-               goto out;
-
-out:
-       spin_unlock_irqrestore(&priv->lock, flags);
-       IWL_DEBUG_INFO(priv, "stop master\n");
-
-       return ret;
-}
-
-static void iwl3945_apm_stop(struct iwl_priv *priv)
-{
-       unsigned long flags;
-
-       iwl3945_apm_stop_master(priv);
-
-       spin_lock_irqsave(&priv->lock, flags);
-
-       iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
-
-       udelay(10);
-       /* clear "init complete"  move adapter D0A* --> D0U state */
-       iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
-       spin_unlock_irqrestore(&priv->lock, flags);
-}
-
 static int iwl3945_apm_reset(struct iwl_priv *priv)
 {
-       iwl3945_apm_stop_master(priv);
+       iwl_apm_stop_master(priv);
 
 
        iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
@@ -2841,7 +2802,7 @@ static struct iwl_lib_ops iwl3945_lib = {
        .apm_ops = {
                .init = iwl3945_apm_init,
                .reset = iwl3945_apm_reset,
-               .stop = iwl3945_apm_stop,
+               .stop = iwl_apm_stop,
                .config = iwl3945_nic_config,
                .set_pwr_src = iwl3945_set_pwr_src,
        },
index 8717946de011c54adddf740a674c3e904d0bfc53..dd10c426ecc45122a9711f9b737e4b76fa712487 100644 (file)
@@ -396,45 +396,11 @@ static void iwl4965_nic_config(struct iwl_priv *priv)
        spin_unlock_irqrestore(&priv->lock, flags);
 }
 
-static int iwl4965_apm_stop_master(struct iwl_priv *priv)
-{
-       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);
-
-       iwl_poll_direct_bit(priv, CSR_RESET,
-                       CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
-
-       spin_unlock_irqrestore(&priv->lock, flags);
-       IWL_DEBUG_INFO(priv, "stop master\n");
-
-       return 0;
-}
-
-static void iwl4965_apm_stop(struct iwl_priv *priv)
-{
-       unsigned long flags;
-
-       iwl4965_apm_stop_master(priv);
-
-       spin_lock_irqsave(&priv->lock, flags);
-
-       iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
-
-       udelay(10);
-       /* clear "init complete"  move adapter D0A* --> D0U state */
-       iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
-       spin_unlock_irqrestore(&priv->lock, flags);
-}
-
 static int iwl4965_apm_reset(struct iwl_priv *priv)
 {
        int ret = 0;
 
-       iwl4965_apm_stop_master(priv);
+       iwl_apm_stop_master(priv);
 
 
        iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
@@ -2306,7 +2272,7 @@ static struct iwl_lib_ops iwl4965_lib = {
        .apm_ops = {
                .init = iwl4965_apm_init,
                .reset = iwl4965_apm_reset,
-               .stop = iwl4965_apm_stop,
+               .stop = iwl_apm_stop,
                .config = iwl4965_nic_config,
                .set_pwr_src = iwl_set_pwr_src,
        },
index 624853503db1e81725396171538443a9a396919f..d8dadbf04138762a84d0181dad7b660cf8a31fd8 100644 (file)
@@ -72,26 +72,6 @@ static const u16 iwl5000_default_queue_to_tx_fifo[] = {
        IWL_TX_FIFO_HCCA_2
 };
 
-/* FIXME: same implementation as 4965 */
-static int iwl5000_apm_stop_master(struct iwl_priv *priv)
-{
-       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);
-
-       iwl_poll_direct_bit(priv, CSR_RESET,
-                                 CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
-
-       spin_unlock_irqrestore(&priv->lock, flags);
-       IWL_DEBUG_INFO(priv, "stop master\n");
-
-       return 0;
-}
-
-
 int iwl5000_apm_init(struct iwl_priv *priv)
 {
        int ret = 0;
@@ -137,31 +117,11 @@ int iwl5000_apm_init(struct iwl_priv *priv)
        return ret;
 }
 
-/* FIXME: this is identical to 4965 */
-void iwl5000_apm_stop(struct iwl_priv *priv)
-{
-       unsigned long flags;
-
-       iwl5000_apm_stop_master(priv);
-
-       spin_lock_irqsave(&priv->lock, flags);
-
-       iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
-
-       udelay(10);
-
-       /* clear "init complete"  move adapter D0A* --> D0U state */
-       iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
-
-       spin_unlock_irqrestore(&priv->lock, flags);
-}
-
-
 int iwl5000_apm_reset(struct iwl_priv *priv)
 {
        int ret = 0;
 
-       iwl5000_apm_stop_master(priv);
+       iwl_apm_stop_master(priv);
 
        iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
 
@@ -1561,7 +1521,7 @@ struct iwl_lib_ops iwl5000_lib = {
        .apm_ops = {
                .init = iwl5000_apm_init,
                .reset = iwl5000_apm_reset,
-               .stop = iwl5000_apm_stop,
+               .stop = iwl_apm_stop,
                .config = iwl5000_nic_config,
                .set_pwr_src = iwl_set_pwr_src,
        },
@@ -1613,7 +1573,7 @@ static struct iwl_lib_ops iwl5150_lib = {
        .apm_ops = {
                .init = iwl5000_apm_init,
                .reset = iwl5000_apm_reset,
-               .stop = iwl5000_apm_stop,
+               .stop = iwl_apm_stop,
                .config = iwl5000_nic_config,
                .set_pwr_src = iwl_set_pwr_src,
        },
index a002214f4d49a4b38e45c23dcfc130b0d8e60dfd..d1f0b0b4ad0cae97b62b4af9da65130612f51b02 100644 (file)
@@ -193,7 +193,7 @@ static struct iwl_lib_ops iwl6000_lib = {
        .apm_ops = {
                .init = iwl5000_apm_init,
                .reset = iwl5000_apm_reset,
-               .stop = iwl5000_apm_stop,
+               .stop = iwl_apm_stop,
                .config = iwl6000_nic_config,
                .set_pwr_src = iwl_set_pwr_src,
        },
index 34547cf3a66e912bc609255cdaed0cad8732167e..7c0ef8e4ebbf25632a2eb17a57c33747e6c41b17 100644 (file)
@@ -1329,6 +1329,42 @@ void iwl_irq_handle_error(struct iwl_priv *priv)
 }
 EXPORT_SYMBOL(iwl_irq_handle_error);
 
+int iwl_apm_stop_master(struct iwl_priv *priv)
+{
+       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);
+
+       iwl_poll_direct_bit(priv, CSR_RESET,
+                       CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
+
+       spin_unlock_irqrestore(&priv->lock, flags);
+       IWL_DEBUG_INFO(priv, "stop master\n");
+
+       return 0;
+}
+EXPORT_SYMBOL(iwl_apm_stop_master);
+
+void iwl_apm_stop(struct iwl_priv *priv)
+{
+       unsigned long flags;
+
+       iwl_apm_stop_master(priv);
+
+       spin_lock_irqsave(&priv->lock, flags);
+
+       iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
+
+       udelay(10);
+       /* clear "init complete"  move adapter D0A* --> D0U state */
+       iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
+       spin_unlock_irqrestore(&priv->lock, flags);
+}
+EXPORT_SYMBOL(iwl_apm_stop);
+
 void iwl_configure_filter(struct ieee80211_hw *hw,
                          unsigned int changed_flags,
                          unsigned int *total_flags,
index eb586a5461811d250a607e96ca75caa2f9c285c5..6688b694420020fe1bb0ca2ac3cde9ce66d59d80 100644 (file)
@@ -658,6 +658,8 @@ extern void iwl_rx_reply_rx_phy(struct iwl_priv *priv,
                                    struct iwl_rx_mem_buffer *rxb);
 void iwl_rx_reply_compressed_ba(struct iwl_priv *priv,
                                           struct iwl_rx_mem_buffer *rxb);
+void iwl_apm_stop(struct iwl_priv *priv);
+int iwl_apm_stop_master(struct iwl_priv *priv);
 
 void iwl_setup_rxon_timing(struct iwl_priv *priv);
 static inline int iwl_send_rxon_assoc(struct iwl_priv *priv)
@@ -677,5 +679,4 @@ static inline const struct ieee80211_supported_band *iwl_get_hw_mode(
 {
        return priv->hw->wiphy->bands[band];
 }
-
 #endif /* __iwl_core_h__ */
index eabc55695affab65b3f03eb2a104692875081987..72946c144be7ca2ced914babbc596d8090d6bc79 100644 (file)
@@ -86,7 +86,6 @@ extern void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
 extern int iwl5000_calc_rssi(struct iwl_priv *priv,
                             struct iwl_rx_phy_res *rx_resp);
 extern int iwl5000_apm_init(struct iwl_priv *priv);
-extern void iwl5000_apm_stop(struct iwl_priv *priv);
 extern int iwl5000_apm_reset(struct iwl_priv *priv);
 extern void iwl5000_nic_config(struct iwl_priv *priv);
 extern u16 iwl5000_eeprom_calib_version(struct iwl_priv *priv);