aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2008-06-11 21:47:14 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-06-14 12:18:09 -0400
commit91dbc5bdbaccc3e89f757afb53c6956c40b80306 (patch)
treed7bc2473babb988513ab90ee62110b1a5bc1151f
parent47f4a5871614756627d7209e0569b58faf99b0d9 (diff)
iwlwifi: retfactor get_temperature functions
This patch renames iwl4965_get_tempearture to iwl4965_hw_get_temperature and replaces usage of original iwl4965_hw_get_temperature by direct access to priv->temperature. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c24
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c2
4 files changed, 10 insertions, 18 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index aeb29b9bf3c1..6e6038fd22f7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -47,6 +47,7 @@
47#include "iwl-sta.h" 47#include "iwl-sta.h"
48 48
49static int iwl4965_send_tx_power(struct iwl_priv *priv); 49static int iwl4965_send_tx_power(struct iwl_priv *priv);
50static int iwl4965_hw_get_temperature(const struct iwl_priv *priv);
50 51
51/* module parameters */ 52/* module parameters */
52static struct iwl_mod_params iwl4965_mod_params = { 53static struct iwl_mod_params iwl4965_mod_params = {
@@ -283,7 +284,7 @@ static void iwl4965_init_alive_start(struct iwl_priv *priv)
283 } 284 }
284 285
285 /* Calculate temperature */ 286 /* Calculate temperature */
286 priv->temperature = iwl4965_get_temperature(priv); 287 priv->temperature = iwl4965_hw_get_temperature(priv);
287 288
288 /* Send pointers to protocol/runtime uCode image ... init code will 289 /* Send pointers to protocol/runtime uCode image ... init code will
289 * load and launch runtime uCode, which will send us another "Alive" 290 * load and launch runtime uCode, which will send us another "Alive"
@@ -1691,11 +1692,6 @@ static int iwl4965_shared_mem_rx_idx(struct iwl_priv *priv)
1691 return le32_to_cpu(s->rb_closed) & 0xFFF; 1692 return le32_to_cpu(s->rb_closed) & 0xFFF;
1692} 1693}
1693 1694
1694int iwl4965_hw_get_temperature(struct iwl_priv *priv)
1695{
1696 return priv->temperature;
1697}
1698
1699unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, 1695unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
1700 struct iwl_frame *frame, u8 rate) 1696 struct iwl_frame *frame, u8 rate)
1701{ 1697{
@@ -1793,12 +1789,12 @@ static s32 sign_extend(u32 oper, int index)
1793} 1789}
1794 1790
1795/** 1791/**
1796 * iwl4965_get_temperature - return the calibrated temperature (in Kelvin) 1792 * iwl4965_hw_get_temperature - return the calibrated temperature (in Kelvin)
1797 * @statistics: Provides the temperature reading from the uCode 1793 * @statistics: Provides the temperature reading from the uCode
1798 * 1794 *
1799 * A return of <0 indicates bogus data in the statistics 1795 * A return of <0 indicates bogus data in the statistics
1800 */ 1796 */
1801int iwl4965_get_temperature(const struct iwl_priv *priv) 1797static int iwl4965_hw_get_temperature(const struct iwl_priv *priv)
1802{ 1798{
1803 s32 temperature; 1799 s32 temperature;
1804 s32 vt; 1800 s32 vt;
@@ -1833,8 +1829,7 @@ int iwl4965_get_temperature(const struct iwl_priv *priv)
1833 vt = sign_extend( 1829 vt = sign_extend(
1834 le32_to_cpu(priv->statistics.general.temperature), 23); 1830 le32_to_cpu(priv->statistics.general.temperature), 23);
1835 1831
1836 IWL_DEBUG_TEMP("Calib values R[1-3]: %d %d %d R4: %d\n", 1832 IWL_DEBUG_TEMP("Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt);
1837 R1, R2, R3, vt);
1838 1833
1839 if (R3 == R1) { 1834 if (R3 == R1) {
1840 IWL_ERROR("Calibration conflict R1 == R3\n"); 1835 IWL_ERROR("Calibration conflict R1 == R3\n");
@@ -1845,11 +1840,10 @@ int iwl4965_get_temperature(const struct iwl_priv *priv)
1845 * Add offset to center the adjustment around 0 degrees Centigrade. */ 1840 * Add offset to center the adjustment around 0 degrees Centigrade. */
1846 temperature = TEMPERATURE_CALIB_A_VAL * (vt - R2); 1841 temperature = TEMPERATURE_CALIB_A_VAL * (vt - R2);
1847 temperature /= (R3 - R1); 1842 temperature /= (R3 - R1);
1848 temperature = (temperature * 97) / 100 + 1843 temperature = (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET;
1849 TEMPERATURE_CALIB_KELVIN_OFFSET;
1850 1844
1851 IWL_DEBUG_TEMP("Calibrated temperature: %dK, %dC\n", temperature, 1845 IWL_DEBUG_TEMP("Calibrated temperature: %dK, %dC\n",
1852 KELVIN_TO_CELSIUS(temperature)); 1846 temperature, KELVIN_TO_CELSIUS(temperature));
1853 1847
1854 return temperature; 1848 return temperature;
1855} 1849}
@@ -1977,7 +1971,7 @@ void iwl4965_hw_rx_statistics(struct iwl_priv *priv,
1977 if (!change) 1971 if (!change)
1978 return; 1972 return;
1979 1973
1980 temp = iwl4965_get_temperature(priv); 1974 temp = iwl4965_hw_get_temperature(priv);
1981 if (temp < 0) 1975 if (temp < 0)
1982 return; 1976 return;
1983 1977
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 59dd34232fc3..054ab7cb421d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -359,7 +359,6 @@ static inline int iwl_is_ready_rf(struct iwl_priv *priv)
359 return iwl_is_ready(priv); 359 return iwl_is_ready(priv);
360} 360}
361 361
362
363enum iwlcore_card_notify { 362enum iwlcore_card_notify {
364 IWLCORE_INIT_EVT = 0, 363 IWLCORE_INIT_EVT = 0,
365 IWLCORE_START_EVT = 1, 364 IWLCORE_START_EVT = 1,
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index ef7415928b74..70018545591b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -643,7 +643,6 @@ extern void iwl4965_hw_cancel_deferred_work(struct iwl_priv *priv);
643extern int iwl4965_hw_set_hw_params(struct iwl_priv *priv); 643extern int iwl4965_hw_set_hw_params(struct iwl_priv *priv);
644extern int iwl_rxq_stop(struct iwl_priv *priv); 644extern int iwl_rxq_stop(struct iwl_priv *priv);
645extern void iwl_txq_ctx_stop(struct iwl_priv *priv); 645extern void iwl_txq_ctx_stop(struct iwl_priv *priv);
646extern int iwl4965_hw_get_temperature(struct iwl_priv *priv);
647extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, 646extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
648 struct iwl_frame *frame, u8 rate); 647 struct iwl_frame *frame, u8 rate);
649extern void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv, 648extern void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 3717f9924358..14d44321771f 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -3867,7 +3867,7 @@ static ssize_t show_temperature(struct device *d,
3867 if (!iwl_is_alive(priv)) 3867 if (!iwl_is_alive(priv))
3868 return -EAGAIN; 3868 return -EAGAIN;
3869 3869
3870 return sprintf(buf, "%d\n", iwl4965_hw_get_temperature(priv)); 3870 return sprintf(buf, "%d\n", priv->temperature);
3871} 3871}
3872 3872
3873static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL); 3873static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);