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>
This commit is contained in:

committed by
John W. Linville

parent
926f0b2ef2
commit
e7b635814b
@@ -152,9 +152,10 @@ static u16 iwl_get_auto_power_mode(struct iwl_priv *priv)
|
||||
/* initialize to default */
|
||||
static int iwl_power_init_handle(struct iwl_priv *priv)
|
||||
{
|
||||
int ret = 0, i;
|
||||
struct iwl_power_mgr *pow_data;
|
||||
int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX;
|
||||
struct iwl_powertable_cmd *cmd;
|
||||
int i;
|
||||
u16 pci_pm;
|
||||
|
||||
IWL_DEBUG_POWER("Initialize power \n");
|
||||
@@ -167,25 +168,19 @@ static int iwl_power_init_handle(struct iwl_priv *priv)
|
||||
memcpy(&pow_data->pwr_range_1[0], &range_1[0], size);
|
||||
memcpy(&pow_data->pwr_range_2[0], &range_2[0], size);
|
||||
|
||||
ret = pci_read_config_word(priv->pci_dev,
|
||||
PCI_LINK_CTRL, &pci_pm);
|
||||
if (ret != 0)
|
||||
return 0;
|
||||
else {
|
||||
struct iwl_powertable_cmd *cmd;
|
||||
pci_read_config_word(priv->pci_dev, PCI_CFG_LINK_CTRL, &pci_pm);
|
||||
|
||||
IWL_DEBUG_POWER("adjust power command flags\n");
|
||||
IWL_DEBUG_POWER("adjust power command flags\n");
|
||||
|
||||
for (i = 0; i < IWL_POWER_MAX; i++) {
|
||||
cmd = &pow_data->pwr_range_0[i].cmd;
|
||||
for (i = 0; i < IWL_POWER_MAX; i++) {
|
||||
cmd = &pow_data->pwr_range_0[i].cmd;
|
||||
|
||||
if (pci_pm & 0x1)
|
||||
cmd->flags &= ~IWL_POWER_PCI_PM_MSK;
|
||||
else
|
||||
cmd->flags |= IWL_POWER_PCI_PM_MSK;
|
||||
}
|
||||
if (pci_pm & PCI_CFG_LINK_CTRL_VAL_L0S_EN)
|
||||
cmd->flags &= ~IWL_POWER_PCI_PM_MSK;
|
||||
else
|
||||
cmd->flags |= IWL_POWER_PCI_PM_MSK;
|
||||
}
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* adjust power command according to dtim period and power level*/
|
||||
|
Reference in New Issue
Block a user