aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/htc_drv_main.c
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2010-06-01 05:44:16 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-03 14:14:40 -0400
commit23367769af90b63231cce6d70a39f1700ca5c03d (patch)
tree4c6ee38e365c15b73cc314a876a58e9815fc1375 /drivers/net/wireless/ath/ath9k/htc_drv_main.c
parent3901737e25a85052e9650547f95aede62abc999b (diff)
ath9k_htc: Fix locking for ps_idle
ps_idle is protected by the htc_pm_lock mutex. Use it to protect the variable. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/htc_drv_main.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index c6ad15ae40cb..b62bfa57dd42 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1401,16 +1401,17 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)
1401 bool enable_radio = false; 1401 bool enable_radio = false;
1402 bool idle = !!(conf->flags & IEEE80211_CONF_IDLE); 1402 bool idle = !!(conf->flags & IEEE80211_CONF_IDLE);
1403 1403
1404 mutex_lock(&priv->htc_pm_lock);
1404 if (!idle && priv->ps_idle) 1405 if (!idle && priv->ps_idle)
1405 enable_radio = true; 1406 enable_radio = true;
1406
1407 priv->ps_idle = idle; 1407 priv->ps_idle = idle;
1408 mutex_unlock(&priv->htc_pm_lock);
1408 1409
1409 if (enable_radio) { 1410 if (enable_radio) {
1410 ath9k_htc_setpower(priv, ATH9K_PM_AWAKE);
1411 ath9k_htc_radio_enable(hw);
1412 ath_print(common, ATH_DBG_CONFIG, 1411 ath_print(common, ATH_DBG_CONFIG,
1413 "not-idle: enabling radio\n"); 1412 "not-idle: enabling radio\n");
1413 ath9k_htc_setpower(priv, ATH9K_PM_AWAKE);
1414 ath9k_htc_radio_enable(hw);
1414 } 1415 }
1415 } 1416 }
1416 1417
@@ -1453,14 +1454,21 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)
1453 } 1454 }
1454 } 1455 }
1455 1456
1456 if ((changed & IEEE80211_CONF_CHANGE_IDLE) && priv->ps_idle) { 1457 if (changed & IEEE80211_CONF_CHANGE_IDLE) {
1458 mutex_lock(&priv->htc_pm_lock);
1459 if (!priv->ps_idle) {
1460 mutex_unlock(&priv->htc_pm_lock);
1461 goto out;
1462 }
1463 mutex_unlock(&priv->htc_pm_lock);
1464
1457 ath_print(common, ATH_DBG_CONFIG, 1465 ath_print(common, ATH_DBG_CONFIG,
1458 "idle: disabling radio\n"); 1466 "idle: disabling radio\n");
1459 ath9k_htc_radio_disable(hw); 1467 ath9k_htc_radio_disable(hw);
1460 } 1468 }
1461 1469
1470out:
1462 mutex_unlock(&priv->mutex); 1471 mutex_unlock(&priv->mutex);
1463
1464 return 0; 1472 return 0;
1465} 1473}
1466 1474