diff options
author | Zhu Yi <yi.zhu@intel.com> | 2007-12-19 00:59:52 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-12-19 21:31:01 -0500 |
commit | b24d22b1d12c436a86282347868785207cff8a88 (patch) | |
tree | 90a6c107466be49653c2a5b92b82fb3eb77c211d /drivers/net/wireless/iwlwifi/iwl4965-base.c | |
parent | 7d2e941b0b741d17e95baf095dbf1c77f2b95b56 (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/iwl4965-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 18 |
1 files changed, 5 insertions, 13 deletions
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 | } |