From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rafal Kozik Subject: [PATCH 2/4] bus/pci: reference driver structure Date: Wed, 11 Apr 2018 16:07:15 +0200 Message-ID: <1523455637-31719-3-git-send-email-rk@semihalf.com> References: <1523455637-31719-1-git-send-email-rk@semihalf.com> Cc: mw@semihalf.com, mk@semihalf.com, gtzalik@amazon.com, evgenys@amazon.com, matua@amazon.com, igorch@amazon.com, ferruh.yigit@intel.com, Rafal Kozik To: dev@dpdk.org Return-path: Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by dpdk.org (Postfix) with ESMTP id 5E0E01BBCC for ; Wed, 11 Apr 2018 16:07:40 +0200 (CEST) Received: by mail-wr0-f193.google.com with SMTP id c24so1916622wrc.6 for ; Wed, 11 Apr 2018 07:07:40 -0700 (PDT) In-Reply-To: <1523455637-31719-1-git-send-email-rk@semihalf.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Reference driver structure before calling rte_pci_map_device. It allow to use driver flags for adjusting configuration. Signed-off-by: Rafal Kozik --- drivers/bus/pci/pci_common.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index 2a00f36..15e9a47 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -159,17 +159,20 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, RTE_LOG(INFO, EAL, " probe driver: %x:%x %s\n", dev->id.vendor_id, dev->id.device_id, dr->driver.name); + /* reference driver structure */ + dev->driver = dr; + dev->device.driver = &dr->driver; + if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) { /* map resources for devices that use igb_uio */ ret = rte_pci_map_device(dev); - if (ret != 0) + if (ret != 0) { + dev->driver = NULL; + dev->device.driver = NULL; return ret; + } } - /* reference driver structure */ - dev->driver = dr; - dev->device.driver = &dr->driver; - /* call the driver probe() function */ ret = dr->probe(dr, dev); if (ret) { -- 2.7.4