diff options
author | Reinette Chatre <reinette.chatre@intel.com> | 2009-02-10 15:02:49 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-11 11:27:21 -0500 |
commit | 89c581b3fb2986e303f1299e6458e3e9b115fa3f (patch) | |
tree | 6123009bfd05d833060ecf44c9965870beb5e3d5 | |
parent | efb43f4b2ccf8066abc3920a0e6858e4350a65c7 (diff) |
iwlwifi: fix suspend/resume and its usage of pci saved state
Here we do two things:
First, revert "iwlwifi: save PCI state before suspend, restore after
resume". That misguided patch led to being unable to use iwlwifi
devices after resume.
Next, indicate to PCI driver that the saved PCI state is valid during suspend.
We restore PCI state and enable the device when network interface is created,
similarly PCI state is saved and the device is disabled when network interface
is removed. Thus, when .suspend is called the PCI state is saved and device
is disabled. This is the case even if an interface is never created as PCI
state is saved and device disabled during .probe.
PCI driver assumes PCI state is saved in .suspend. Saving the state at this
time will save state of disabled device and thus cause problems during
resume (resuming a disabled device). We thus indicate directly to PCI
driver that current PCI saved state is valid.
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Tested-by: Alex Riesen <fork0@users.sf.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 15 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 15 |
2 files changed, 26 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index c01ea48da5fe..36bafeb353ce 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -4042,7 +4042,19 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
4042 | priv->is_open = 1; | 4042 | priv->is_open = 1; |
4043 | } | 4043 | } |
4044 | 4044 | ||
4045 | pci_save_state(pdev); | 4045 | /* pci driver assumes state will be saved in this function. |
4046 | * pci state is saved and device disabled when interface is | ||
4047 | * stopped, so at this time pci device will always be disabled - | ||
4048 | * whether interface was started or not. saving pci state now will | ||
4049 | * cause saved state be that of a disabled device, which will cause | ||
4050 | * problems during resume in that we will end up with a disabled device. | ||
4051 | * | ||
4052 | * indicate that the current saved state (from when interface was | ||
4053 | * stopped) is valid. if interface was never up at time of suspend | ||
4054 | * then the saved state will still be valid as it was saved during | ||
4055 | * .probe. */ | ||
4056 | pdev->state_saved = true; | ||
4057 | |||
4046 | pci_set_power_state(pdev, PCI_D3hot); | 4058 | pci_set_power_state(pdev, PCI_D3hot); |
4047 | 4059 | ||
4048 | return 0; | 4060 | return 0; |
@@ -4053,7 +4065,6 @@ static int iwl_pci_resume(struct pci_dev *pdev) | |||
4053 | struct iwl_priv *priv = pci_get_drvdata(pdev); | 4065 | struct iwl_priv *priv = pci_get_drvdata(pdev); |
4054 | 4066 | ||
4055 | pci_set_power_state(pdev, PCI_D0); | 4067 | pci_set_power_state(pdev, PCI_D0); |
4056 | pci_restore_state(pdev); | ||
4057 | 4068 | ||
4058 | if (priv->is_open) | 4069 | if (priv->is_open) |
4059 | iwl_mac_start(priv->hw); | 4070 | iwl_mac_start(priv->hw); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 5b44d322b99f..93be74a1f139 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -8143,7 +8143,19 @@ static int iwl3945_pci_suspend(struct pci_dev *pdev, pm_message_t state) | |||
8143 | priv->is_open = 1; | 8143 | priv->is_open = 1; |
8144 | } | 8144 | } |
8145 | 8145 | ||
8146 | pci_save_state(pdev); | 8146 | /* pci driver assumes state will be saved in this function. |
8147 | * pci state is saved and device disabled when interface is | ||
8148 | * stopped, so at this time pci device will always be disabled - | ||
8149 | * whether interface was started or not. saving pci state now will | ||
8150 | * cause saved state be that of a disabled device, which will cause | ||
8151 | * problems during resume in that we will end up with a disabled device. | ||
8152 | * | ||
8153 | * indicate that the current saved state (from when interface was | ||
8154 | * stopped) is valid. if interface was never up at time of suspend | ||
8155 | * then the saved state will still be valid as it was saved during | ||
8156 | * .probe. */ | ||
8157 | pdev->state_saved = true; | ||
8158 | |||
8147 | pci_set_power_state(pdev, PCI_D3hot); | 8159 | pci_set_power_state(pdev, PCI_D3hot); |
8148 | 8160 | ||
8149 | return 0; | 8161 | return 0; |
@@ -8154,7 +8166,6 @@ static int iwl3945_pci_resume(struct pci_dev *pdev) | |||
8154 | struct iwl3945_priv *priv = pci_get_drvdata(pdev); | 8166 | struct iwl3945_priv *priv = pci_get_drvdata(pdev); |
8155 | 8167 | ||
8156 | pci_set_power_state(pdev, PCI_D0); | 8168 | pci_set_power_state(pdev, PCI_D0); |
8157 | pci_restore_state(pdev); | ||
8158 | 8169 | ||
8159 | if (priv->is_open) | 8170 | if (priv->is_open) |
8160 | iwl3945_mac_start(priv->hw); | 8171 | iwl3945_mac_start(priv->hw); |