Patchwork [RFC,v2,32/32] PCI/rtl8192e: use PCIe capabilities access functions to simplify implementation

login
register
mail settings
Submitter Jiang Liu
Date July 24, 2012, 4:41 p.m.
Message ID <1343148077-25941-9-git-send-email-jiang.liu@huawei.com>
Download mbox | patch
Permalink /patch/172959/
State Superseded
Headers show

Comments

Jiang Liu - July 24, 2012, 4:41 p.m.
From: Jiang Liu <jiang.liu@huawei.com>

Use PCIe capabilities access functions to simplify rtl8192e driver's
implementation.

Signed-off-by: Jiang Liu <liuj97@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_pci.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Patch

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
index ddadcc3..820cc68 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c
@@ -31,12 +31,10 @@  static void rtl8192_parse_pci_configuration(struct pci_dev *pdev,
 	struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
 
 	u8 tmp;
-	int pos;
-	u8 LinkCtrlReg;
+	u16 LinkCtrlReg;
 
-	pos = pci_find_capability(priv->pdev, PCI_CAP_ID_EXP);
-	pci_read_config_byte(priv->pdev, pos + PCI_EXP_LNKCTL, &LinkCtrlReg);
-	priv->NdisAdapter.LinkCtrlReg = LinkCtrlReg;
+	pci_pcie_capability_read_word(priv->pdev, PCI_EXP_LNKCTL, &LinkCtrlReg);
+	priv->NdisAdapter.LinkCtrlReg = (u8)LinkCtrlReg;
 
 	RT_TRACE(COMP_INIT, "Link Control Register =%x\n",
 		 priv->NdisAdapter.LinkCtrlReg);