From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 5B04012001 for ; Tue, 17 Apr 2018 19:52:30 +0200 (CEST) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 2A3C730C044; Tue, 17 Apr 2018 10:52:29 -0700 (PDT) Received: from C02VPB22HTD6.dhcp.broadcom.net (c02vpb22htd6.dhcp.broadcom.net [10.136.50.120]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id BB616AC0729; Tue, 17 Apr 2018 10:52:28 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: Scott Branden Date: Tue, 17 Apr 2018 10:52:25 -0700 Message-Id: <20180417175225.41628-1-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.15.1 (Apple Git-101) In-Reply-To: <8CEF83825BEC744B83065625E567D7C24E0AE9AB@IRSMSX108.ger.corp.intel.com> References: <8CEF83825BEC744B83065625E567D7C24E0AE9AB@IRSMSX108.ger.corp.intel.com> Subject: [dpdk-dev] [PATCH v2] igb_uio: only check for pci bridge if supported by linux kernel X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Apr 2018 17:52:30 -0000 From: Scott Branden Starting from Linux v3.16 pci_is_bridge() is in linux/pci.h, in previous versions it is in drivers/pci/pci.h which is private header. Fix build error when calling pci_is_bridge by not calling/supporting pci_is_bridge with kernel versions before 3.16. Fixes: 6f0841b7701b ("igb_uio: bind error if PCIe bridge") Signed-off-by: Scott Branden Signed-off-by: Ajit Khaparde Reported-by: Ferruh Yigit Acked-by: Bernard Iremonger -- v1->v2: add fixes line in commit message. --- kernel/linux/igb_uio/compat.h | 4 ++++ kernel/linux/igb_uio/igb_uio.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/kernel/linux/igb_uio/compat.h b/kernel/linux/igb_uio/compat.h index ce456d4bb..d9f4d29fc 100644 --- a/kernel/linux/igb_uio/compat.h +++ b/kernel/linux/igb_uio/compat.h @@ -121,6 +121,10 @@ static bool pci_check_and_mask_intx(struct pci_dev *pdev) #endif /* < 3.3.0 */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) +#define HAVE_PCI_IS_BRIDGE_API 1 +#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) #define HAVE_ALLOC_IRQ_VECTORS 1 #endif diff --git a/kernel/linux/igb_uio/igb_uio.c b/kernel/linux/igb_uio/igb_uio.c index cbc5ab63a..cd9b7e721 100644 --- a/kernel/linux/igb_uio/igb_uio.c +++ b/kernel/linux/igb_uio/igb_uio.c @@ -473,10 +473,12 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) void *map_addr; int err; +#ifdef HAVE_PCI_IS_BRIDGE_API if (pci_is_bridge(dev)) { dev_warn(&dev->dev, "Ignoring PCI bridge device\n"); return -ENODEV; } +#endif udev = kzalloc(sizeof(struct rte_uio_pci_dev), GFP_KERNEL); if (!udev) -- 2.15.1 (Apple Git-101)