Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-power.c
index 8ccc0bb..581c683 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
+ * Copyright(c) 2007 - 2010 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
@@ -29,6 +29,7 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/init.h>
 
 #include <net/mac80211.h>
@@ -303,13 +304,12 @@ static int iwl_set_power(struct iwl_priv *priv, struct iwl_powertable_cmd *cmd)
                                sizeof(struct iwl_powertable_cmd), cmd);
 }
 
-
+/* priv->mutex must be held */
 int iwl_power_update_mode(struct iwl_priv *priv, bool force)
 {
        int ret = 0;
        struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
-       bool enabled = (priv->iw_mode == NL80211_IFTYPE_STATION) &&
-                       (priv->hw->conf.flags & IEEE80211_CONF_PS);
+       bool enabled = priv->hw->conf.flags & IEEE80211_CONF_PS;
        bool update_chains;
        struct iwl_powertable_cmd cmd;
        int dtimper;
@@ -319,7 +319,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force)
                        priv->chain_noise_data.state == IWL_CHAIN_NOISE_ALIVE;
 
        if (priv->vif)
-               dtimper = priv->vif->bss_conf.dtim_period;
+               dtimper = priv->hw->conf.ps_dtim_period;
        else
                dtimper = 1;
 
@@ -384,10 +384,10 @@ EXPORT_SYMBOL(iwl_ht_enabled);
 
 bool iwl_within_ct_kill_margin(struct iwl_priv *priv)
 {
-       s32 temp = priv->temperature; /* degrees CELSIUS except 4965 */
+       s32 temp = priv->temperature; /* degrees CELSIUS except specified */
        bool within_margin = false;
 
-       if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965)
+       if (priv->cfg->temperature_kelvin)
                temp = KELVIN_TO_CELSIUS(priv->temperature);
 
        if (!priv->thermal_throttle.advanced_tt)
@@ -840,12 +840,12 @@ EXPORT_SYMBOL(iwl_tt_exit_ct_kill);
 static void iwl_bg_tt_work(struct work_struct *work)
 {
        struct iwl_priv *priv = container_of(work, struct iwl_priv, tt_work);
-       s32 temp = priv->temperature; /* degrees CELSIUS except 4965 */
+       s32 temp = priv->temperature; /* degrees CELSIUS except specified */
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
-       if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965)
+       if (priv->cfg->temperature_kelvin)
                temp = KELVIN_TO_CELSIUS(priv->temperature);
 
        if (!priv->thermal_throttle.advanced_tt)
@@ -875,7 +875,7 @@ void iwl_tt_initialize(struct iwl_priv *priv)
        int size = sizeof(struct iwl_tt_trans) * (IWL_TI_STATE_MAX - 1);
        struct iwl_tt_trans *transaction;
 
-       IWL_DEBUG_POWER(priv, "Initialize Thermal Throttling \n");
+       IWL_DEBUG_POWER(priv, "Initialize Thermal Throttling\n");
 
        memset(tt, 0, sizeof(struct iwl_tt_mgmt));