mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-31 00:17:44 +00:00
iwlwifi: fix power index handling
The power index that the user gives as module parameter in in range 1-5, but we need to decrease it in order to create an array index out of it (0-4) for the power table command. Signed-off-by: Amit Beka <amit.beka@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
f6be8b7845
commit
11e116517b
1 changed files with 6 additions and 2 deletions
|
@ -253,6 +253,8 @@ static void iwl_static_sleep_cmd(struct iwl_priv *priv,
|
||||||
|
|
||||||
IWL_DEBUG_POWER(priv, "numSkipDtim = %u, dtimPeriod = %d\n",
|
IWL_DEBUG_POWER(priv, "numSkipDtim = %u, dtimPeriod = %d\n",
|
||||||
skip, period);
|
skip, period);
|
||||||
|
/* The power level here is 0-4 (used as array index), but user expects
|
||||||
|
to see 1-5 (according to spec). */
|
||||||
IWL_DEBUG_POWER(priv, "Sleep command for index %d\n", lvl + 1);
|
IWL_DEBUG_POWER(priv, "Sleep command for index %d\n", lvl + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,10 +310,12 @@ static void iwl_power_build_cmd(struct iwl_priv *priv,
|
||||||
priv->power_data.debug_sleep_level_override,
|
priv->power_data.debug_sleep_level_override,
|
||||||
dtimper);
|
dtimper);
|
||||||
else {
|
else {
|
||||||
|
/* Note that the user parameter is 1-5 (according to spec),
|
||||||
|
but we pass 0-4 because it acts as an array index. */
|
||||||
if (iwlwifi_mod_params.power_level > IWL_POWER_INDEX_1 &&
|
if (iwlwifi_mod_params.power_level > IWL_POWER_INDEX_1 &&
|
||||||
iwlwifi_mod_params.power_level <= IWL_POWER_INDEX_5)
|
iwlwifi_mod_params.power_level <= IWL_POWER_NUM)
|
||||||
iwl_static_sleep_cmd(priv, cmd,
|
iwl_static_sleep_cmd(priv, cmd,
|
||||||
iwlwifi_mod_params.power_level, dtimper);
|
iwlwifi_mod_params.power_level - 1, dtimper);
|
||||||
else
|
else
|
||||||
iwl_static_sleep_cmd(priv, cmd,
|
iwl_static_sleep_cmd(priv, cmd,
|
||||||
IWL_POWER_INDEX_1, dtimper);
|
IWL_POWER_INDEX_1, dtimper);
|
||||||
|
|
Loading…
Reference in a new issue