aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorZhu Yi <yi.zhu@intel.com>2007-07-12 04:09:32 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-07-17 21:56:17 -0400
commit4e157f08a01f6395a43d10630fb3a629d90a02bc (patch)
tree50be542bc5f2d5c66ba3628e41c39aee82d6b234 /drivers/net/wireless
parent9f3b2416fec56de34408eafbef19bf8ec9a81493 (diff)
[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>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ipw2200.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index aa32a97380ec..4b5ec3666ee6 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -2506,7 +2506,7 @@ static int ipw_send_power_mode(struct ipw_priv *priv, u32 mode)
2506 break; 2506 break;
2507 } 2507 }
2508 2508
2509 param = cpu_to_le32(mode); 2509 param = cpu_to_le32(param);
2510 return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param), 2510 return ipw_send_cmd_pdu(priv, IPW_CMD_POWER_MODE, sizeof(param),
2511 &param); 2511 &param);
2512} 2512}
@@ -9568,6 +9568,7 @@ static int ipw_wx_set_power(struct net_device *dev,
9568 priv->power_mode = IPW_POWER_ENABLED | IPW_POWER_BATTERY; 9568 priv->power_mode = IPW_POWER_ENABLED | IPW_POWER_BATTERY;
9569 else 9569 else
9570 priv->power_mode = IPW_POWER_ENABLED | priv->power_mode; 9570 priv->power_mode = IPW_POWER_ENABLED | priv->power_mode;
9571
9571 err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode)); 9572 err = ipw_send_power_mode(priv, IPW_POWER_LEVEL(priv->power_mode));
9572 if (err) { 9573 if (err) {
9573 IPW_DEBUG_WX("failed setting power mode.\n"); 9574 IPW_DEBUG_WX("failed setting power mode.\n");
@@ -9604,22 +9605,19 @@ static int ipw_wx_set_powermode(struct net_device *dev,
9604 struct ipw_priv *priv = ieee80211_priv(dev); 9605 struct ipw_priv *priv = ieee80211_priv(dev);
9605 int mode = *(int *)extra; 9606 int mode = *(int *)extra;
9606 int err; 9607 int err;
9608
9607 mutex_lock(&priv->mutex); 9609 mutex_lock(&priv->mutex);
9608 if ((mode < 1) || (mode > IPW_POWER_LIMIT)) { 9610 if ((mode < 1) || (mode > IPW_POWER_LIMIT))
9609 mode = IPW_POWER_AC; 9611 mode = IPW_POWER_AC;
9610 priv->power_mode = mode;
9611 } else {
9612 priv->power_mode = IPW_POWER_ENABLED | mode;
9613 }
9614 9612
9615 if (priv->power_mode != mode) { 9613 if (IPW_POWER_LEVEL(priv->power_mode) != mode) {
9616 err = ipw_send_power_mode(priv, mode); 9614 err = ipw_send_power_mode(priv, mode);
9617
9618 if (err) { 9615 if (err) {
9619 IPW_DEBUG_WX("failed setting power mode.\n"); 9616 IPW_DEBUG_WX("failed setting power mode.\n");
9620 mutex_unlock(&priv->mutex); 9617 mutex_unlock(&priv->mutex);
9621 return err; 9618 return err;
9622 } 9619 }
9620 priv->power_mode = IPW_POWER_ENABLED | mode;
9623 } 9621 }
9624 mutex_unlock(&priv->mutex); 9622 mutex_unlock(&priv->mutex);
9625 return 0; 9623 return 0;