DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 3/7] virtio: fix build with mempool debug enabled
Date: Tue,  3 Mar 2015 16:23:46 +0100	[thread overview]
Message-ID: <1425396230-13379-4-git-send-email-thomas.monjalon@6wind.com> (raw)
In-Reply-To: <1425396230-13379-1-git-send-email-thomas.monjalon@6wind.com>

The mempool header forces error on -Wcast-qual:
	error: cast discards ‘const’ qualifier from pointer target type

Let's fix it by removing const qualifier of pci driver from commit
	5e9f6d1340ff ("pci: reference driver structure for each device")
It's needed because the driver flags are changed depending on using uio or not.
Actually these driver flags should be directly attached to each device.

Fixes: da978dfdc43b ("virtio: use port IO to get PCI resource")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/librte_eal/common/include/rte_pci.h | 2 +-
 lib/librte_pmd_virtio/Makefile          | 2 --
 lib/librte_pmd_virtio/virtio_ethdev.c   | 8 ++------
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index b9cdf8b..995f814 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -158,7 +158,7 @@ struct rte_pci_device {
 	struct rte_pci_id id;                   /**< PCI ID. */
 	struct rte_pci_resource mem_resource[PCI_MAX_RESOURCE];   /**< PCI Memory Resource */
 	struct rte_intr_handle intr_handle;     /**< Interrupt handle */
-	const struct rte_pci_driver *driver;    /**< Associated driver */
+	struct rte_pci_driver *driver;          /**< Associated driver */
 	uint16_t max_vfs;                       /**< sriov enable if not zero */
 	int numa_node;                          /**< NUMA node connection */
 	struct rte_devargs *devargs;            /**< Device user arguments */
diff --git a/lib/librte_pmd_virtio/Makefile b/lib/librte_pmd_virtio/Makefile
index 0baaf46..793067f 100644
--- a/lib/librte_pmd_virtio/Makefile
+++ b/lib/librte_pmd_virtio/Makefile
@@ -57,6 +57,4 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_eal lib/librte_ether
 DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_mempool lib/librte_mbuf
 DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_net lib/librte_malloc
 
-CFLAGS_virtio_ethdev.o += -Wno-cast-qual
-
 include $(RTE_SDK)/mk/rte.lib.mk
diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c
index 88ecd57..4bad1e4 100644
--- a/lib/librte_pmd_virtio/virtio_ethdev.c
+++ b/lib/librte_pmd_virtio/virtio_ethdev.c
@@ -938,8 +938,6 @@ static int virtio_resource_init_by_uio(struct rte_pci_device *pci_dev)
 	char filename[PATH_MAX];
 	unsigned long start, size;
 	unsigned int uio_num;
-	struct rte_pci_driver *pci_drv =
-			(struct rte_pci_driver *)pci_dev->driver;
 
 	if (get_uio_dev(&pci_dev->addr, dirname, sizeof(dirname), &uio_num) < 0)
 		return -1;
@@ -978,7 +976,7 @@ static int virtio_resource_init_by_uio(struct rte_pci_device *pci_dev)
 	}
 
 	pci_dev->intr_handle.type = RTE_INTR_HANDLE_UIO;
-	pci_drv->drv_flags |= RTE_PCI_DRV_INTR_LSC;
+	pci_dev->driver->drv_flags |= RTE_PCI_DRV_INTR_LSC;
 
 	return 0;
 }
@@ -993,8 +991,6 @@ static int virtio_resource_init_by_ioports(struct rte_pci_device *pci_dev)
 	char pci_id[16];
 	int found = 0;
 	size_t linesz;
-	struct rte_pci_driver *pci_drv =
-			(struct rte_pci_driver *)pci_dev->driver;
 
 	snprintf(pci_id, sizeof(pci_id), PCI_PRI_FMT,
 		 pci_dev->addr.domain,
@@ -1046,7 +1042,7 @@ static int virtio_resource_init_by_ioports(struct rte_pci_device *pci_dev)
 		start, size);
 
 	/* can't support lsc interrupt without uio */
-	pci_drv->drv_flags &= ~RTE_PCI_DRV_INTR_LSC;
+	pci_dev->driver->drv_flags &= ~RTE_PCI_DRV_INTR_LSC;
 
 	return 0;
 }
-- 
2.2.2

  parent reply	other threads:[~2015-03-03 15:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 15:23 [dpdk-dev] [PATCH 0/7] fix build with " Thomas Monjalon
2015-03-03 15:23 ` [dpdk-dev] [PATCH 1/7] mempool: " Thomas Monjalon
2015-03-04  9:59   ` Olivier MATZ
2015-03-03 15:23 ` [dpdk-dev] [PATCH 2/7] fm10k: " Thomas Monjalon
2015-03-03 15:23 ` Thomas Monjalon [this message]
2015-03-04  1:15   ` [dpdk-dev] [PATCH 3/7] virtio: fix build with mempool " Ouyang, Changchun
2015-03-03 15:23 ` [dpdk-dev] [PATCH 4/7] virtio: fix build with " Thomas Monjalon
2015-03-04  1:17   ` Ouyang, Changchun
2015-03-03 15:23 ` [dpdk-dev] [PATCH 5/7] mlx4: fix build with mempool " Thomas Monjalon
2015-03-03 16:02   ` Adrien Mazarguil
2015-03-03 15:23 ` [dpdk-dev] [PATCH 6/7] mlx4: mute auto config in quiet mode Thomas Monjalon
2015-03-03 16:03   ` Adrien Mazarguil
2015-03-03 15:23 ` [dpdk-dev] [PATCH 7/7] bond: remove debug function to fix link with shared lib Thomas Monjalon
2015-03-04  9:49   ` Declan Doherty
2015-03-04 10:21 ` [dpdk-dev] [PATCH 0/7] fix build with debug enabled Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425396230-13379-4-git-send-email-thomas.monjalon@6wind.com \
    --to=thomas.monjalon@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).