diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-09-02 23:26:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-09-08 14:23:19 -0400 |
commit | e7b635814b640c6fd9dca1c254dc22fac6fb9a1a (patch) | |
tree | ff09a16f4a704b81dedde80a68728ddc4e423505 /drivers/net/wireless/iwlwifi/iwl-power.c | |
parent | 926f0b2ef24041db876ec7213fbddd7cd4555951 (diff) |
iwlwifi: cleanup PCI register handling
This patch cleans up pci registers handling.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
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/iwl-power.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-power.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index a099c9e30e55..eb6312d867d1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -152,9 +152,10 @@ static u16 iwl_get_auto_power_mode(struct iwl_priv *priv) | |||
152 | /* initialize to default */ | 152 | /* initialize to default */ |
153 | static int iwl_power_init_handle(struct iwl_priv *priv) | 153 | static int iwl_power_init_handle(struct iwl_priv *priv) |
154 | { | 154 | { |
155 | int ret = 0, i; | ||
156 | struct iwl_power_mgr *pow_data; | 155 | struct iwl_power_mgr *pow_data; |
157 | int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX; | 156 | int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX; |
157 | struct iwl_powertable_cmd *cmd; | ||
158 | int i; | ||
158 | u16 pci_pm; | 159 | u16 pci_pm; |
159 | 160 | ||
160 | IWL_DEBUG_POWER("Initialize power \n"); | 161 | IWL_DEBUG_POWER("Initialize power \n"); |
@@ -167,25 +168,19 @@ static int iwl_power_init_handle(struct iwl_priv *priv) | |||
167 | memcpy(&pow_data->pwr_range_1[0], &range_1[0], size); | 168 | memcpy(&pow_data->pwr_range_1[0], &range_1[0], size); |
168 | memcpy(&pow_data->pwr_range_2[0], &range_2[0], size); | 169 | memcpy(&pow_data->pwr_range_2[0], &range_2[0], size); |
169 | 170 | ||
170 | ret = pci_read_config_word(priv->pci_dev, | 171 | pci_read_config_word(priv->pci_dev, PCI_CFG_LINK_CTRL, &pci_pm); |
171 | PCI_LINK_CTRL, &pci_pm); | ||
172 | if (ret != 0) | ||
173 | return 0; | ||
174 | else { | ||
175 | struct iwl_powertable_cmd *cmd; | ||
176 | 172 | ||
177 | IWL_DEBUG_POWER("adjust power command flags\n"); | 173 | IWL_DEBUG_POWER("adjust power command flags\n"); |
178 | 174 | ||
179 | for (i = 0; i < IWL_POWER_MAX; i++) { | 175 | for (i = 0; i < IWL_POWER_MAX; i++) { |
180 | cmd = &pow_data->pwr_range_0[i].cmd; | 176 | cmd = &pow_data->pwr_range_0[i].cmd; |
181 | 177 | ||
182 | if (pci_pm & 0x1) | 178 | if (pci_pm & PCI_CFG_LINK_CTRL_VAL_L0S_EN) |
183 | cmd->flags &= ~IWL_POWER_PCI_PM_MSK; | 179 | cmd->flags &= ~IWL_POWER_PCI_PM_MSK; |
184 | else | 180 | else |
185 | cmd->flags |= IWL_POWER_PCI_PM_MSK; | 181 | cmd->flags |= IWL_POWER_PCI_PM_MSK; |
186 | } | ||
187 | } | 182 | } |
188 | return ret; | 183 | return 0; |
189 | } | 184 | } |
190 | 185 | ||
191 | /* adjust power command according to dtim period and power level*/ | 186 | /* adjust power command according to dtim period and power level*/ |