From patchwork Tue Jul 24 16:41:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 1232561 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 771D5DFFCE for ; Tue, 24 Jul 2012 16:45:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932067Ab2GXQoo (ORCPT ); Tue, 24 Jul 2012 12:44:44 -0400 Received: from mail-gh0-f174.google.com ([209.85.160.174]:58608 "EHLO mail-gh0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932066Ab2GXQon (ORCPT ); Tue, 24 Jul 2012 12:44:43 -0400 Received: by mail-gh0-f174.google.com with SMTP id r11so6863911ghr.19 for ; Tue, 24 Jul 2012 09:44:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=ZJ3IHSbXeX/0O/1cON10BhnlJv3upTa5vgvnWFVfOtU=; b=GepWZ/yqeZ2RwSIZH/meRNK26i9pcTMgICUl2lsmwWsIeO96u1eMouiyQZwyqgPsSG iiBk5T7QcNqAYF5W8tnWcvG6ze6kFTr9rE2z//vdyaANWXoE+MRRSdxvU3Er4tjNCgmv CTP+hZvIJBypYp/67qp/xOFs+IPkh4ayM/IFFrN1JJrjkhek2ypLDGtlIOriy1MBe2ds GTjm4f2Yo18hJbHk0MJwUsge5QqrXBepUBV9hOlIyaNdcdun2fRLnFGBhkB+OLbGpsfQ RvWpQMu7CZXd+p6SKWNy+fKy26PNaI/s1izUpFI4298VTBU7TrmZ2V/i7Ij/DC0dxU1D m7jA== Received: by 10.66.80.34 with SMTP id o2mr5948122pax.36.1343148282501; Tue, 24 Jul 2012 09:44:42 -0700 (PDT) Received: from localhost.localdomain ([221.221.26.244]) by mx.google.com with ESMTPS id wk10sm7863878pbc.71.2012.07.24.09.44.32 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jul 2012 09:44:40 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas , Don Dutile Cc: Jiang Liu , Yinghai Lu , Taku Izumi , "Rafael J . Wysocki" , Kenji Kaneshige , Yijing Wang , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Jiang Liu Subject: [RFC PATCH v2 32/32] PCI/rtl8192e: use PCIe capabilities access functions to simplify implementation Date: Wed, 25 Jul 2012 00:41:17 +0800 Message-Id: <1343148077-25941-9-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1343148077-25941-1-git-send-email-jiang.liu@huawei.com> References: <1343148077-25941-1-git-send-email-jiang.liu@huawei.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Jiang Liu Use PCIe capabilities access functions to simplify rtl8192e driver's implementation. Signed-off-by: Jiang Liu --- drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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);