aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
authorZhu Yi <yi.zhu@intel.com>2007-12-19 00:59:52 -0500
committerJohn W. Linville <linville@tuxdriver.com>2007-12-19 21:31:01 -0500
commitb24d22b1d12c436a86282347868785207cff8a88 (patch)
tree90a6c107466be49653c2a5b92b82fb3eb77c211d /drivers/net/wireless/iwlwifi
parent7d2e941b0b741d17e95baf095dbf1c77f2b95b56 (diff)
iwlwifi: fix possible priv->mutex deadlock during suspend
This patch moves _cancel_deferred_work out of mutex protection and removes unnecessary mutex in pci_suspend and pci_resume. Cc: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c18
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c18
2 files changed, 10 insertions, 26 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 4bdf237f6adc..5c67b5b409e0 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6243,8 +6243,6 @@ static void __iwl_down(struct iwl_priv *priv)
6243 /* Unblock any waiting calls */ 6243 /* Unblock any waiting calls */
6244 wake_up_interruptible_all(&priv->wait_command_queue); 6244 wake_up_interruptible_all(&priv->wait_command_queue);
6245 6245
6246 iwl_cancel_deferred_work(priv);
6247
6248 /* Wipe out the EXIT_PENDING status bit if we are not actually 6246 /* Wipe out the EXIT_PENDING status bit if we are not actually
6249 * exiting the module */ 6247 * exiting the module */
6250 if (!exit_pending) 6248 if (!exit_pending)
@@ -6319,6 +6317,8 @@ static void iwl_down(struct iwl_priv *priv)
6319 mutex_lock(&priv->mutex); 6317 mutex_lock(&priv->mutex);
6320 __iwl_down(priv); 6318 __iwl_down(priv);
6321 mutex_unlock(&priv->mutex); 6319 mutex_unlock(&priv->mutex);
6320
6321 iwl_cancel_deferred_work(priv);
6322} 6322}
6323 6323
6324#define MAX_HW_RESTARTS 5 6324#define MAX_HW_RESTARTS 5
@@ -8577,10 +8577,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
8577 8577
8578 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); 8578 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
8579 8579
8580 mutex_lock(&priv->mutex);
8581 set_bit(STATUS_EXIT_PENDING, &priv->status); 8580 set_bit(STATUS_EXIT_PENDING, &priv->status);
8582 __iwl_down(priv); 8581
8583 mutex_unlock(&priv->mutex); 8582 iwl_down(priv);
8584 8583
8585 /* Free MAC hash list for ADHOC */ 8584 /* Free MAC hash list for ADHOC */
8586 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { 8585 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
@@ -8639,12 +8638,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8639{ 8638{
8640 struct iwl_priv *priv = pci_get_drvdata(pdev); 8639 struct iwl_priv *priv = pci_get_drvdata(pdev);
8641 8640
8642 mutex_lock(&priv->mutex);
8643
8644 set_bit(STATUS_IN_SUSPEND, &priv->status); 8641 set_bit(STATUS_IN_SUSPEND, &priv->status);
8645 8642
8646 /* Take down the device; powers it off, etc. */ 8643 /* Take down the device; powers it off, etc. */
8647 __iwl_down(priv); 8644 iwl_down(priv);
8648 8645
8649 if (priv->mac80211_registered) 8646 if (priv->mac80211_registered)
8650 ieee80211_stop_queues(priv->hw); 8647 ieee80211_stop_queues(priv->hw);
@@ -8653,8 +8650,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8653 pci_disable_device(pdev); 8650 pci_disable_device(pdev);
8654 pci_set_power_state(pdev, PCI_D3hot); 8651 pci_set_power_state(pdev, PCI_D3hot);
8655 8652
8656 mutex_unlock(&priv->mutex);
8657
8658 return 0; 8653 return 0;
8659} 8654}
8660 8655
@@ -8712,8 +8707,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
8712 8707
8713 printk(KERN_INFO "Coming out of suspend...\n"); 8708 printk(KERN_INFO "Coming out of suspend...\n");
8714 8709
8715 mutex_lock(&priv->mutex);
8716
8717 pci_set_power_state(pdev, PCI_D0); 8710 pci_set_power_state(pdev, PCI_D0);
8718 err = pci_enable_device(pdev); 8711 err = pci_enable_device(pdev);
8719 pci_restore_state(pdev); 8712 pci_restore_state(pdev);
@@ -8727,7 +8720,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
8727 pci_write_config_byte(pdev, 0x41, 0x00); 8720 pci_write_config_byte(pdev, 0x41, 0x00);
8728 8721
8729 iwl_resume(priv); 8722 iwl_resume(priv);
8730 mutex_unlock(&priv->mutex);
8731 8723
8732 return 0; 8724 return 0;
8733} 8725}
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 8f85564ec6fa..ed148ea3dec3 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -6598,8 +6598,6 @@ static void __iwl_down(struct iwl_priv *priv)
6598 /* Unblock any waiting calls */ 6598 /* Unblock any waiting calls */
6599 wake_up_interruptible_all(&priv->wait_command_queue); 6599 wake_up_interruptible_all(&priv->wait_command_queue);
6600 6600
6601 iwl_cancel_deferred_work(priv);
6602
6603 /* Wipe out the EXIT_PENDING status bit if we are not actually 6601 /* Wipe out the EXIT_PENDING status bit if we are not actually
6604 * exiting the module */ 6602 * exiting the module */
6605 if (!exit_pending) 6603 if (!exit_pending)
@@ -6674,6 +6672,8 @@ static void iwl_down(struct iwl_priv *priv)
6674 mutex_lock(&priv->mutex); 6672 mutex_lock(&priv->mutex);
6675 __iwl_down(priv); 6673 __iwl_down(priv);
6676 mutex_unlock(&priv->mutex); 6674 mutex_unlock(&priv->mutex);
6675
6676 iwl_cancel_deferred_work(priv);
6677} 6677}
6678 6678
6679#define MAX_HW_RESTARTS 5 6679#define MAX_HW_RESTARTS 5
@@ -9171,10 +9171,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
9171 9171
9172 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); 9172 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
9173 9173
9174 mutex_lock(&priv->mutex);
9175 set_bit(STATUS_EXIT_PENDING, &priv->status); 9174 set_bit(STATUS_EXIT_PENDING, &priv->status);
9176 __iwl_down(priv); 9175
9177 mutex_unlock(&priv->mutex); 9176 iwl_down(priv);
9178 9177
9179 /* Free MAC hash list for ADHOC */ 9178 /* Free MAC hash list for ADHOC */
9180 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { 9179 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
@@ -9233,12 +9232,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
9233{ 9232{
9234 struct iwl_priv *priv = pci_get_drvdata(pdev); 9233 struct iwl_priv *priv = pci_get_drvdata(pdev);
9235 9234
9236 mutex_lock(&priv->mutex);
9237
9238 set_bit(STATUS_IN_SUSPEND, &priv->status); 9235 set_bit(STATUS_IN_SUSPEND, &priv->status);
9239 9236
9240 /* Take down the device; powers it off, etc. */ 9237 /* Take down the device; powers it off, etc. */
9241 __iwl_down(priv); 9238 iwl_down(priv);
9242 9239
9243 if (priv->mac80211_registered) 9240 if (priv->mac80211_registered)
9244 ieee80211_stop_queues(priv->hw); 9241 ieee80211_stop_queues(priv->hw);
@@ -9247,8 +9244,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
9247 pci_disable_device(pdev); 9244 pci_disable_device(pdev);
9248 pci_set_power_state(pdev, PCI_D3hot); 9245 pci_set_power_state(pdev, PCI_D3hot);
9249 9246
9250 mutex_unlock(&priv->mutex);
9251
9252 return 0; 9247 return 0;
9253} 9248}
9254 9249
@@ -9306,8 +9301,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
9306 9301
9307 printk(KERN_INFO "Coming out of suspend...\n"); 9302 printk(KERN_INFO "Coming out of suspend...\n");
9308 9303
9309 mutex_lock(&priv->mutex);
9310
9311 pci_set_power_state(pdev, PCI_D0); 9304 pci_set_power_state(pdev, PCI_D0);
9312 err = pci_enable_device(pdev); 9305 err = pci_enable_device(pdev);
9313 pci_restore_state(pdev); 9306 pci_restore_state(pdev);
@@ -9321,7 +9314,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
9321 pci_write_config_byte(pdev, 0x41, 0x00); 9314 pci_write_config_byte(pdev, 0x41, 0x00);
9322 9315
9323 iwl_resume(priv); 9316 iwl_resume(priv);
9324 mutex_unlock(&priv->mutex);
9325 9317
9326 return 0; 9318 return 0;
9327} 9319}