From patchwork Wed Mar 13 23:27:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 2266781 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 B7F4CE00E6 for ; Wed, 13 Mar 2013 23:34:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964835Ab3CMXeY (ORCPT ); Wed, 13 Mar 2013 19:34:24 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:17543 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964793Ab3CMX2c (ORCPT ); Wed, 13 Mar 2013 19:28:32 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r2DNSOhS015230 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 13 Mar 2013 23:28:25 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r2DNSNJW019157 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 13 Mar 2013 23:28:24 GMT Received: from abhmt103.oracle.com (abhmt103.oracle.com [141.146.116.55]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r2DNSNY9005232; Wed, 13 Mar 2013 18:28:23 -0500 Received: from linux-siqj.site (/10.132.126.191) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 13 Mar 2013 16:28:23 -0700 From: Yinghai Lu To: Bjorn Helgaas , Ram Pai Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH v3 04/27] PCI: Add is_pci_*_resource_idx() helpers Date: Wed, 13 Mar 2013 16:27:59 -0700 Message-Id: <1363217302-14383-5-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1363217302-14383-1-git-send-email-yinghai@kernel.org> References: <1363217302-14383-1-git-send-email-yinghai@kernel.org> X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org According to resource pointer find out if the resource is some type resource like bridge, sriov, or std. Signed-off-by: Yinghai Lu --- include/linux/pci.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/linux/pci.h b/include/linux/pci.h index 127a856..efb348b 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -92,6 +92,29 @@ enum { DEVICE_COUNT_RESOURCE = PCI_NUM_RESOURCES, }; +static inline bool is_pci_std_resource_idx(int i) +{ + return i >= PCI_STD_RESOURCES && i <= PCI_STD_RESOURCE_END; +} + +static inline bool is_pci_rom_resource_idx(int i) +{ + return i == PCI_ROM_RESOURCE; +} + +static inline bool is_pci_iov_resource_idx(int i) +{ +#ifdef CONFIG_PCI_IOV + return i >= PCI_IOV_RESOURCES && i <= PCI_IOV_RESOURCE_END; +#endif + return false; +} + +static inline bool is_pci_bridge_resource_idx(int i) +{ + return i >= PCI_BRIDGE_RESOURCES && i <= PCI_BRIDGE_RESOURCE_END; +} + typedef int __bitwise pci_power_t; #define PCI_D0 ((pci_power_t __force) 0)