Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761540Ab3ICXng (ORCPT ); Tue, 3 Sep 2013 19:43:36 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:49933 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761484Ab3ICXnd (ORCPT ); Tue, 3 Sep 2013 19:43:33 -0400 Date: Tue, 3 Sep 2013 17:43:28 -0600 From: Bjorn Helgaas To: Yijing Wang Cc: Benjamin Herrenschmidt , Gavin Shan , "James E.J. Bottomley" , "David S. Miller" , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Hanjun Guo , Jiang Liu , Naresh Kumar Inna , Jesper Juhl , linux-scsi@vger.kernel.org Subject: Re: [PATCH 2/7] scsi/csiostor: use pcie_capability_xxx to simplify code Message-ID: <20130903234328.GC24733@google.com> References: <1378193715-25328-1-git-send-email-wangyijing@huawei.com> <1378193715-25328-2-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1378193715-25328-2-git-send-email-wangyijing@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2003 Lines: 59 On Tue, Sep 03, 2013 at 03:35:10PM +0800, Yijing Wang wrote: > Pcie_capability_xxx() interfaces were introudced to s/introudced/introduced/ > simplify code to access PCIe Cap config space. And > because PCI core saves the PCIe Cap offset in > set_pcie_port_type() when device is enumerated. > So we can use pci_is_pcie() instead. > > Signed-off-by: Yijing Wang > Cc: Jiang Liu > Cc: "James E.J. Bottomley" > Cc: Naresh Kumar Inna > Cc: "David S. Miller" > Cc: Jesper Juhl > Cc: linux-scsi@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > --- > drivers/scsi/csiostor/csio_hw.c | 9 +++------ > 1 files changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c > index 0eb35b9..be9a6ef 100644 > --- a/drivers/scsi/csiostor/csio_hw.c > +++ b/drivers/scsi/csiostor/csio_hw.c > @@ -856,15 +856,12 @@ static void > csio_set_pcie_completion_timeout(struct csio_hw *hw, u8 range) > { > uint16_t val; > - int pcie_cap; > > - if (!csio_pci_capability(hw->pdev, PCI_CAP_ID_EXP, &pcie_cap)) { > - pci_read_config_word(hw->pdev, > - pcie_cap + PCI_EXP_DEVCTL2, &val); > + if (pci_is_pcie(hw->pdev)) { > + pcie_capability_read_word(hw->pdev, PCI_EXP_DEVCTL2, &val); > val &= 0xfff0; > val |= range ; > - pci_write_config_word(hw->pdev, > - pcie_cap + PCI_EXP_DEVCTL2, val); > + pcie_capability_write_word(hw->pdev, PCI_EXP_DEVCTL2, val); Please add a #define for the Completion Timeout Value field and use pcie_capability_clear_and_set_word() instead of writing it out the long way here. > } > } > > -- > 1.7.1 > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/