rtlwifi: Use PCI Express Capability accessors
authorJiang Liu <jiang.liu@huawei.com>
Mon, 20 Aug 2012 20:18:08 +0000 (14:18 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 23 Aug 2012 16:11:15 +0000 (10:11 -0600)
Use PCI Express Capability access functions to simplify rtlwifi driver.

[bhelgaas: split iwlegacy, iwlwifi, rtlwifi into separate patches]
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/net/wireless/rtlwifi/pci.c

index 80f75d3..5983631 100644 (file)
@@ -372,13 +372,11 @@ static void rtl_pci_parse_configuration(struct pci_dev *pdev,
        struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
 
        u8 tmp;
-       int pos;
-       u8 linkctrl_reg;
+       u16 linkctrl_reg;
 
        /*Link Control Register */
-       pos = pci_pcie_cap(pdev);
-       pci_read_config_byte(pdev, pos + PCI_EXP_LNKCTL, &linkctrl_reg);
-       pcipriv->ndis_adapter.linkctrl_reg = linkctrl_reg;
+       pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &linkctrl_reg);
+       pcipriv->ndis_adapter.linkctrl_reg = (u8)linkctrl_reg;
 
        RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Link Control Register =%x\n",
                 pcipriv->ndis_adapter.linkctrl_reg);