From patchwork Wed Aug 1 15:54:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 1265151 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 97EC43FC23 for ; Wed, 1 Aug 2012 16:02:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756060Ab2HAP70 (ORCPT ); Wed, 1 Aug 2012 11:59:26 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:61939 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755556Ab2HAP7V (ORCPT ); Wed, 1 Aug 2012 11:59:21 -0400 Received: by mail-pb0-f46.google.com with SMTP id rp8so1286503pbb.19 for ; Wed, 01 Aug 2012 08:59:21 -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=kCyOwo5cK0cTWx7Xlg8JUzSeMLyZR1QM/MD/O9v4VOc=; b=yPLEpOdikGH1DCyuO3ya3phUvv+6V6KfKj80qbspXPS6q7pfRCJ4ZGQl7YzOB0fxiu 7qhLh++zTq5z1xt3txxecbN+lHtCqNXEb7K0yq+us5WF0T+9FFUyRah6HZ8SCbwc52em 0fuNi5vbeUSYUIvGGA992FzQ3BNWpdsREgvBK03oKbp5esGn++n2nkfG/1YKrgSkiyiL 0+Pdtp+Gd+3jZprABYaRIRpL6QFV205FxpwTyA19zabo+lBX9CNRr8rPTMnx8XvYsHlV oRMhb4bLLsn2GkWwLL3itwdFkmiV3G2mBBt1MIooYOcOCsWboLvv4hA6CCxCqRhC8/fi 2dUA== Received: by 10.68.201.195 with SMTP id kc3mr53696700pbc.33.1343836761630; Wed, 01 Aug 2012 08:59:21 -0700 (PDT) Received: from localhost.localdomain ([58.250.81.2]) by mx.google.com with ESMTPS id pe8sm2816231pbc.76.2012.08.01.08.59.10 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Aug 2012 08:59:20 -0700 (PDT) From: Jiang Liu To: Bjorn Helgaas , Don Dutile , Stanislaw Gruszka , "John W. Linville" , Johannes Berg , Wey-Yi Guy , Intel Linux Wireless , Larry Finger , Chaoming Li 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: [PATCH v3 25/32] PCI/iwl: use PCIe capabilities access functions to simplify implementation Date: Wed, 1 Aug 2012 23:54:30 +0800 Message-Id: <1343836477-7287-26-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1343836477-7287-1-git-send-email-jiang.liu@huawei.com> References: <1343836477-7287-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 Intel Wireless drivers' implementation. Signed-off-by: Jiang Liu --- drivers/net/wireless/iwlegacy/common.h | 5 ++--- drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | 4 +--- drivers/net/wireless/rtlwifi/pci.c | 8 +++----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h index 5f50177..d119fa3 100644 --- a/drivers/net/wireless/iwlegacy/common.h +++ b/drivers/net/wireless/iwlegacy/common.h @@ -1832,10 +1832,9 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd); static inline u16 il_pcie_link_ctl(struct il_priv *il) { - int pos; u16 pci_lnk_ctl; - pos = pci_pcie_cap(il->pci_dev); - pci_read_config_word(il->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl); + pci_pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, + &pci_lnk_ctl); return pci_lnk_ctl; } diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c index ec6fb39..48b9561 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c @@ -643,15 +643,13 @@ static void iwl_set_pwr_vmain(struct iwl_trans *trans) static u16 iwl_pciexp_link_ctrl(struct iwl_trans *trans) { - int pos; u16 pci_lnk_ctl; struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); struct pci_dev *pci_dev = trans_pcie->pci_dev; - pos = pci_pcie_cap(pci_dev); - pci_read_config_word(pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl); + pci_pcie_capability_read_word(pci_dev, PCI_EXP_LNKCTL, &pci_lnk_ctl); return pci_lnk_ctl; } diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 2062ea1..1018b5b 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c @@ -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; + pci_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);