[PATCH] Fix ipw2200 set wrong power parameter causing firmware error
The power mode can only be set 0~5 to firmware. Otherwise there will be a firmware error generated. This patch fixed the invalid power mode requested by driver. Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
9f3b2416fe
commit
4e157f08a0
|
@ -2506,7 +2506,7 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
param = cpu_to_le32(mode);
|
param = cpu_to_le32(param);
|
||||||
return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param),
|
return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param),
|
||||||
¶m);
|
¶m);
|
||||||
}
|
}
|
||||||
|
@ -9568,6 +9568,7 @@ static int ipw_wx_set_power(struct net_device *dev,
|
||||||
priv->power_mode = IPW_POWER_ENABLED | IPW_POWER_BATTERY;
|
priv->power_mode = IPW_POWER_ENABLED | IPW_POWER_BATTERY;
|
||||||
else
|
else
|
||||||
priv->power_mode = IPW_POWER_ENABLED | priv->power_mode;
|
priv->power_mode = IPW_POWER_ENABLED | priv->power_mode;
|
||||||
|
|
||||||
err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode));
|
err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode));
|
||||||
if (err) {
|
if (err) {
|
||||||
IPW_DEBUG_WX("failed setting power mode.\n");
|
IPW_DEBUG_WX("failed setting power mode.\n");
|
||||||
|
@ -9604,22 +9605,19 @@ static int ipw_wx_set_powermode(struct net_device *dev,
|
||||||
struct ipw_priv *priv = ieee80211_priv(dev);
|
struct ipw_priv *priv = ieee80211_priv(dev);
|
||||||
int mode = *(int *)extra;
|
int mode = *(int *)extra;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
mutex_lock(&priv->mutex);
|
mutex_lock(&priv->mutex);
|
||||||
if ((mode < 1) || (mode > IPW_POWER_LIMIT)) {
|
if ((mode < 1) || (mode > IPW_POWER_LIMIT))
|
||||||
mode = IPW_POWER_AC;
|
mode = IPW_POWER_AC;
|
||||||
priv->power_mode = mode;
|
|
||||||
} else {
|
|
||||||
priv->power_mode = IPW_POWER_ENABLED | mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->power_mode != mode) {
|
if (IPW_POWER_LEVEL(priv->power_mode) != mode) {
|
||||||
err = ipw_send_power_mode(priv, mode);
|
err = ipw_send_power_mode(priv, mode);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
IPW_DEBUG_WX("failed setting power mode.\n");
|
IPW_DEBUG_WX("failed setting power mode.\n");
|
||||||
mutex_unlock(&priv->mutex);
|
mutex_unlock(&priv->mutex);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
priv->power_mode = IPW_POWER_ENABLED | mode;
|
||||||
}
|
}
|
||||||
mutex_unlock(&priv->mutex);
|
mutex_unlock(&priv->mutex);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue