iwlagn: move iwl_suspend / iwl_resume to the transport layer
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-power.c
index 3ec619c..9f0e620 100644 (file)
@@ -43,6 +43,7 @@
 #include "iwl-debug.h"
 #include "iwl-power.h"
 #include "iwl-trans.h"
+#include "iwl-shared.h"
 
 /*
  * Setting power level allows the card to go to sleep when not busy.
@@ -335,7 +336,7 @@ static int iwl_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd)
                        le32_to_cpu(cmd->sleep_interval[3]),
                        le32_to_cpu(cmd->sleep_interval[4]));
 
-       return trans_send_cmd_pdu(&priv->trans, POWER_TABLE_CMD, CMD_SYNC,
+       return iwl_trans_send_cmd_pdu(trans(priv), POWER_TABLE_CMD, CMD_SYNC,
                                sizeof(struct iwl_powertable_cmd), cmd);
 }
 
@@ -347,9 +348,10 @@ static void iwl_power_build_cmd(struct iwl_priv *priv,
 
        dtimper = priv->hw->conf.ps_dtim_period ?: 1;
 
-       if (priv->wowlan)
+       if (priv->shrd->wowlan)
                iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, dtimper);
-       else if (priv->hw->conf.flags & IEEE80211_CONF_IDLE)
+       else if (!priv->cfg->base_params->no_idle_support &&
+                priv->hw->conf.flags & IEEE80211_CONF_IDLE)
                iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_5, 20);
        else if (iwl_tt_is_low_power_state(priv)) {
                /* in thermal throttling low power state */
@@ -381,7 +383,7 @@ int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd,
        int ret;
        bool update_chains;
 
-       lockdep_assert_held(&priv->mutex);
+       lockdep_assert_held(&priv->shrd->mutex);
 
        /* Don't update the RX chain when chain noise calibration is running */
        update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE ||
@@ -395,18 +397,18 @@ int iwl_power_set_mode(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd,
 
        /* scan complete use sleep_power_next, need to be updated */
        memcpy(&priv->power_data.sleep_cmd_next, cmd, sizeof(*cmd));
-       if (test_bit(STATUS_SCANNING, &priv->status) && !force) {
+       if (test_bit(STATUS_SCANNING, &priv->shrd->status) && !force) {
                IWL_DEBUG_INFO(priv, "Defer power set mode while scanning\n");
                return 0;
        }
 
        if (cmd->flags & IWL_POWER_DRIVER_ALLOW_SLEEP_MSK)
-               set_bit(STATUS_POWER_PMI, &priv->status);
+               set_bit(STATUS_POWER_PMI, &priv->shrd->status);
 
        ret = iwl_set_power(priv, cmd);
        if (!ret) {
                if (!(cmd->flags & IWL_POWER_DRIVER_ALLOW_SLEEP_MSK))
-                       clear_bit(STATUS_POWER_PMI, &priv->status);
+                       clear_bit(STATUS_POWER_PMI, &priv->shrd->status);
 
                if (update_chains)
                        iwl_update_chain_flags(priv);