Skip to content

Commit

Permalink
iwlwifi: retfactor get_temperature functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Emmanuel Grumbach authored and John W. Linville committed Jun 14, 2008
1 parent 47f4a58 commit 91dbc5b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
24 changes: 9 additions & 15 deletions drivers/net/wireless/iwlwifi/iwl-4965.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "iwl-sta.h"

static int iwl4965_send_tx_power(struct iwl_priv *priv);
static int iwl4965_hw_get_temperature(const struct iwl_priv *priv);

/* module parameters */
static struct iwl_mod_params iwl4965_mod_params = {
Expand Down Expand Up @@ -283,7 +284,7 @@ static void iwl4965_init_alive_start(struct iwl_priv *priv)
}

/* Calculate temperature */
priv->temperature = iwl4965_get_temperature(priv);
priv->temperature = iwl4965_hw_get_temperature(priv);

/* Send pointers to protocol/runtime uCode image ... init code will
* load and launch runtime uCode, which will send us another "Alive"
Expand Down Expand Up @@ -1691,11 +1692,6 @@ static int iwl4965_shared_mem_rx_idx(struct iwl_priv *priv)
return le32_to_cpu(s->rb_closed) & 0xFFF;
}

int iwl4965_hw_get_temperature(struct iwl_priv *priv)
{
return priv->temperature;
}

unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
struct iwl_frame *frame, u8 rate)
{
Expand Down Expand Up @@ -1793,12 +1789,12 @@ static s32 sign_extend(u32 oper, int index)
}

/**
* iwl4965_get_temperature - return the calibrated temperature (in Kelvin)
* iwl4965_hw_get_temperature - return the calibrated temperature (in Kelvin)
* @statistics: Provides the temperature reading from the uCode
*
* A return of <0 indicates bogus data in the statistics
*/
int iwl4965_get_temperature(const struct iwl_priv *priv)
static int iwl4965_hw_get_temperature(const struct iwl_priv *priv)
{
s32 temperature;
s32 vt;
Expand Down Expand Up @@ -1833,8 +1829,7 @@ int iwl4965_get_temperature(const struct iwl_priv *priv)
vt = sign_extend(
le32_to_cpu(priv->statistics.general.temperature), 23);

IWL_DEBUG_TEMP("Calib values R[1-3]: %d %d %d R4: %d\n",
R1, R2, R3, vt);
IWL_DEBUG_TEMP("Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt);

if (R3 == R1) {
IWL_ERROR("Calibration conflict R1 == R3\n");
Expand All @@ -1845,11 +1840,10 @@ int iwl4965_get_temperature(const struct iwl_priv *priv)
* Add offset to center the adjustment around 0 degrees Centigrade. */
temperature = TEMPERATURE_CALIB_A_VAL * (vt - R2);
temperature /= (R3 - R1);
temperature = (temperature * 97) / 100 +
TEMPERATURE_CALIB_KELVIN_OFFSET;
temperature = (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET;

IWL_DEBUG_TEMP("Calibrated temperature: %dK, %dC\n", temperature,
KELVIN_TO_CELSIUS(temperature));
IWL_DEBUG_TEMP("Calibrated temperature: %dK, %dC\n",
temperature, KELVIN_TO_CELSIUS(temperature));

return temperature;
}
Expand Down Expand Up @@ -1977,7 +1971,7 @@ void iwl4965_hw_rx_statistics(struct iwl_priv *priv,
if (!change)
return;

temp = iwl4965_get_temperature(priv);
temp = iwl4965_hw_get_temperature(priv);
if (temp < 0)
return;

Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/iwlwifi/iwl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ static inline int iwl_is_ready_rf(struct iwl_priv *priv)
return iwl_is_ready(priv);
}


enum iwlcore_card_notify {
IWLCORE_INIT_EVT = 0,
IWLCORE_START_EVT = 1,
Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/iwlwifi/iwl-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,6 @@ extern void iwl4965_hw_cancel_deferred_work(struct iwl_priv *priv);
extern int iwl4965_hw_set_hw_params(struct iwl_priv *priv);
extern int iwl_rxq_stop(struct iwl_priv *priv);
extern void iwl_txq_ctx_stop(struct iwl_priv *priv);
extern int iwl4965_hw_get_temperature(struct iwl_priv *priv);
extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
struct iwl_frame *frame, u8 rate);
extern void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/iwlwifi/iwl4965-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -3867,7 +3867,7 @@ static ssize_t show_temperature(struct device *d,
if (!iwl_is_alive(priv))
return -EAGAIN;

return sprintf(buf, "%d\n", iwl4965_hw_get_temperature(priv));
return sprintf(buf, "%d\n", priv->temperature);
}

static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);
Expand Down

0 comments on commit 91dbc5b

Please sign in to comment.