Patchwork [12/12] iwlwifi: Use standard #defines for PCIe Capability ASPM fields

login
register
mail settings
Submitter Bjorn Helgaas
Date Dec. 5, 2012, 8:58 p.m.
Message ID <20121205205821.13851.59050.stgit@bhelgaas.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/203957/
State Accepted
Headers show

Comments

Bjorn Helgaas - Dec. 5, 2012, 8:58 p.m.
Use the standard #defines rather than creating local definitions for
PCIe Capability ASPM fields.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: "John W. Linville" <linville@tuxdriver.com>
CC: Johannes Berg <johannes.berg@intel.com>
CC: Wey-Yi Guy <wey-yi.w.guy@intel.com>
CC: Intel Linux Wireless <ilw@linux.intel.com>
CC: linux-wireless@vger.kernel.org
---
 drivers/net/wireless/iwlwifi/pcie/trans.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg - Dec. 5, 2012, 9:04 p.m.
On Wed, 2012-12-05 at 13:58 -0700, Bjorn Helgaas wrote:
> Use the standard #defines rather than creating local definitions for
> PCIe Capability ASPM fields.

I'll pick up the iwlwifi ones if you want, or do you want to merge them
somewhere centrally instead?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bjorn Helgaas - Dec. 5, 2012, 9:20 p.m.
On Wed, Dec 5, 2012 at 2:04 PM, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Wed, 2012-12-05 at 13:58 -0700, Bjorn Helgaas wrote:
>> Use the standard #defines rather than creating local definitions for
>> PCIe Capability ASPM fields.
>
> I'll pick up the iwlwifi ones if you want, or do you want to merge them
> somewhere centrally instead?

They do depend on a previous patch that adds the #defines to
include/uapi/linux/pci_regs.h
(http://marc.info/?l=linux-pci&m=135474107109010&w=2).

I think I'll merge at least the PCI core parts of this via my PCI tree
in the v3.8 merge window next week.  If it won't cause conflicts for
you, I could include the iwlwifi bits there, too.  If it does, at
least the #define will exist and you can merge it at your leisure.

Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg - Dec. 5, 2012, 9:26 p.m.
On Wed, 2012-12-05 at 14:20 -0700, Bjorn Helgaas wrote:
> On Wed, Dec 5, 2012 at 2:04 PM, Johannes Berg <johannes@sipsolutions.net> wrote:
> > On Wed, 2012-12-05 at 13:58 -0700, Bjorn Helgaas wrote:
> >> Use the standard #defines rather than creating local definitions for
> >> PCIe Capability ASPM fields.
> >
> > I'll pick up the iwlwifi ones if you want, or do you want to merge them
> > somewhere centrally instead?
> 
> They do depend on a previous patch that adds the #defines to
> include/uapi/linux/pci_regs.h
> (http://marc.info/?l=linux-pci&m=135474107109010&w=2).
> 
> I think I'll merge at least the PCI core parts of this via my PCI tree
> in the v3.8 merge window next week.  If it won't cause conflicts for
> you, I could include the iwlwifi bits there, too.  If it does, at
> least the #define will exist and you can merge it at your leisure.

Ok, that's fine, feel free to include the iwlwifi bits.

Acked-by: Johannes Berg <johannes.berg@intel.com>

:)

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 5cd06b3..1dfa6be 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -670,8 +670,6 @@  static void iwl_set_pwr_vmain(struct iwl_trans *trans)
 
 /* PCI registers */
 #define PCI_CFG_RETRY_TIMEOUT	0x041
-#define PCI_CFG_LINK_CTRL_VAL_L0S_EN	0x01
-#define PCI_CFG_LINK_CTRL_VAL_L1_EN	0x02
 
 static void iwl_apm_config(struct iwl_trans *trans)
 {
@@ -688,8 +686,7 @@  static void iwl_apm_config(struct iwl_trans *trans)
 	 */
 
 	pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl);
-	if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) ==
-				PCI_CFG_LINK_CTRL_VAL_L1_EN) {
+	if (lctl & PCI_EXP_LNKCTL_ASPM_L1) {
 		/* L1-ASPM enabled; disable(!) L0S */
 		iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED);
 		dev_printk(KERN_INFO, trans->dev,
@@ -700,7 +697,7 @@  static void iwl_apm_config(struct iwl_trans *trans)
 		dev_printk(KERN_INFO, trans->dev,
 			   "L1 Disabled; Enabling L0S\n");
 	}
-	trans->pm_support = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN);
+	trans->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S);
 }
 
 /*