DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 00/12] cleanup useless casts of void *
@ 2019-05-29 19:14 Stephen Hemminger
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 01/12] net/atlantic: remove unnecessary cast Stephen Hemminger
                   ` (12 more replies)
  0 siblings, 13 replies; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:14 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

Many DPDK drivers have unnecessary cast of the void * pointer
dev->data->dev_private.

Stephen Hemminger (12):
  net/atlantic: remove unnecessary cast
  net/ark: remove unnecessary cast
  net/axgbe: remove unnecessary cast
  net/bnxt: remove unnecessary cast
  net/bonding: remove unnecessary cast
  net/cxgbe: remove unnecessary cast
  net/e1000: remove unnecessary cast of void *
  net/ena: remove unnecessary cast
  net/enic: remove unnecessary cast
  net/i40e: remove unnecessary cast
  net/ixgbe: remove unnecessary cast
  net/mlx5: remove unnecessary cast

 drivers/net/ark/ark_ethdev.c           | 51 +++++----------
 drivers/net/ark/ark_ethdev_rx.c        |  4 +-
 drivers/net/ark/ark_ethdev_tx.c        |  2 +-
 drivers/net/atlantic/atl_ethdev.c      |  9 +--
 drivers/net/axgbe/axgbe_ethdev.c       | 24 ++++---
 drivers/net/axgbe/axgbe_rxtx.c         |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c         | 86 +++++++++++++-------------
 drivers/net/bnxt/bnxt_flow.c           | 10 +--
 drivers/net/bnxt/bnxt_irq.c            |  2 +-
 drivers/net/bnxt/bnxt_rxq.c            |  6 +-
 drivers/net/bnxt/bnxt_stats.c          |  6 +-
 drivers/net/bnxt/bnxt_txq.c            |  2 +-
 drivers/net/bnxt/bnxt_txr.c            |  4 +-
 drivers/net/bnxt/rte_pmd_bnxt.c        | 32 +++++-----
 drivers/net/bonding/rte_eth_bond_pmd.c | 20 +++---
 drivers/net/cxgbe/base/adapter.h       |  2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c       | 60 +++++++++---------
 drivers/net/cxgbe/cxgbe_filter.c       |  2 +-
 drivers/net/cxgbe/cxgbe_main.c         |  6 +-
 drivers/net/cxgbe/cxgbevf_ethdev.c     |  6 +-
 drivers/net/cxgbe/cxgbevf_main.c       |  2 +-
 drivers/net/cxgbe/sge.c                |  8 +--
 drivers/net/e1000/igb_ethdev.c         | 18 ++----
 drivers/net/ena/ena_ethdev.c           | 66 +++++++-------------
 drivers/net/enic/enic.h                |  2 +-
 drivers/net/i40e/i40e_ethdev.c         | 24 +++----
 drivers/net/ixgbe/ixgbe_ethdev.c       | 33 ++++------
 drivers/net/ixgbe/ixgbe_rxtx.c         | 14 ++---
 drivers/net/mlx5/mlx5_flow.c           |  2 +-
 29 files changed, 218 insertions(+), 287 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH 01/12] net/atlantic: remove unnecessary cast
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
@ 2019-05-29 19:14 ` Stephen Hemminger
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 02/12] net/ark: " Stephen Hemminger
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:14 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The device private pointer (dev_private) is of type void *
therefore no cast is necessary in C.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/atlantic/atl_ethdev.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index d110e351ec03..fdc0a7f2db96 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -371,8 +371,7 @@ atl_disable_intr(struct aq_hw_s *hw)
 static int
 eth_atl_dev_init(struct rte_eth_dev *eth_dev)
 {
-	struct atl_adapter *adapter =
-		(struct atl_adapter *)eth_dev->data->dev_private;
+	struct atl_adapter *adapter = eth_dev->data->dev_private;
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	struct aq_hw_s *hw = ATL_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
@@ -1015,8 +1014,7 @@ static int
 atl_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats,
 		   unsigned int n)
 {
-	struct atl_adapter *adapter =
-	(struct atl_adapter *)dev->data->dev_private;
+	struct atl_adapter *adapter = dev->data->dev_private;
 	struct aq_hw_s *hw = &adapter->hw;
 	struct get_stats req = { 0 };
 	struct macsec_msg_fw_request msg = { 0 };
@@ -1352,8 +1350,7 @@ atl_dev_interrupt_action(struct rte_eth_dev *dev,
 {
 	struct atl_interrupt *intr =
 		ATL_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
-	struct atl_adapter *adapter =
-		(struct atl_adapter *)dev->data->dev_private;
+	struct atl_adapter *adapter = dev->data->dev_private;
 	struct aq_hw_s *hw = &adapter->hw;
 
 	if (!(intr->flags & ATL_FLAG_NEED_LINK_UPDATE))
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH 02/12] net/ark: remove unnecessary cast
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 01/12] net/atlantic: remove unnecessary cast Stephen Hemminger
@ 2019-05-29 19:14 ` Stephen Hemminger
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 03/12] net/axgbe: " Stephen Hemminger
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:14 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The device private pointer (dev_private) is of type void *
therefore no cast is necessary in C.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/ark/ark_ethdev.c    | 51 +++++++++++----------------------
 drivers/net/ark/ark_ethdev_rx.c |  4 +--
 drivers/net/ark/ark_ethdev_tx.c |  2 +-
 3 files changed, 20 insertions(+), 37 deletions(-)

diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index 7692aa2d9571..7fd784cd0e30 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -241,8 +241,7 @@ check_for_ext(struct ark_adapter *ark)
 static int
 eth_ark_dev_init(struct rte_eth_dev *dev)
 {
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 	struct rte_pci_device *pci_dev;
 	int ret;
 	int port_count = 1;
@@ -418,8 +417,7 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
 static int
 ark_config_device(struct rte_eth_dev *dev)
 {
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 	uint16_t num_q, i;
 	struct ark_mpu_t *mpu;
 
@@ -494,8 +492,7 @@ ark_config_device(struct rte_eth_dev *dev)
 static int
 eth_ark_dev_uninit(struct rte_eth_dev *dev)
 {
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
@@ -517,8 +514,7 @@ static int
 eth_ark_dev_configure(struct rte_eth_dev *dev)
 {
 	PMD_FUNC_LOG(DEBUG, "\n");
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 
 	eth_ark_dev_set_link_up(dev);
 	if (ark->user_ext.dev_configure)
@@ -544,8 +540,7 @@ delay_pg_start(void *arg)
 static int
 eth_ark_dev_start(struct rte_eth_dev *dev)
 {
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 	int i;
 
 	PMD_FUNC_LOG(DEBUG, "\n");
@@ -597,8 +592,7 @@ eth_ark_dev_stop(struct rte_eth_dev *dev)
 {
 	uint16_t i;
 	int status;
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 	struct ark_mpu_t *mpu;
 
 	PMD_FUNC_LOG(DEBUG, "\n");
@@ -688,8 +682,7 @@ eth_ark_dev_stop(struct rte_eth_dev *dev)
 static void
 eth_ark_dev_close(struct rte_eth_dev *dev)
 {
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 	uint16_t i;
 
 	if (ark->user_ext.dev_close)
@@ -719,8 +712,7 @@ static void
 eth_ark_dev_info_get(struct rte_eth_dev *dev,
 		     struct rte_eth_dev_info *dev_info)
 {
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 	struct ark_mpu_t *tx_mpu = RTE_PTR_ADD(ark->bar0, ARK_MPU_TX_BASE);
 	struct ark_mpu_t *rx_mpu = RTE_PTR_ADD(ark->bar0, ARK_MPU_RX_BASE);
 	uint16_t ports = ark->num_ports;
@@ -755,8 +747,7 @@ eth_ark_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 {
 	PMD_DEBUG_LOG(DEBUG, "link status = %d\n",
 			dev->data->dev_link.link_status);
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 
 	if (ark->user_ext.link_update) {
 		return ark->user_ext.link_update
@@ -770,8 +761,7 @@ static int
 eth_ark_dev_set_link_up(struct rte_eth_dev *dev)
 {
 	dev->data->dev_link.link_status = 1;
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 
 	if (ark->user_ext.dev_set_link_up)
 		return ark->user_ext.dev_set_link_up(dev,
@@ -783,8 +773,7 @@ static int
 eth_ark_dev_set_link_down(struct rte_eth_dev *dev)
 {
 	dev->data->dev_link.link_status = 0;
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 
 	if (ark->user_ext.dev_set_link_down)
 		return ark->user_ext.dev_set_link_down(dev,
@@ -796,8 +785,7 @@ static int
 eth_ark_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
 	uint16_t i;
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 
 	stats->ipackets = 0;
 	stats->ibytes = 0;
@@ -820,8 +808,7 @@ static void
 eth_ark_dev_stats_reset(struct rte_eth_dev *dev)
 {
 	uint16_t i;
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++)
 		eth_tx_queue_stats_reset(dev->data->tx_queues[i]);
@@ -838,8 +825,7 @@ eth_ark_macaddr_add(struct rte_eth_dev *dev,
 		    uint32_t index,
 		    uint32_t pool)
 {
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 
 	if (ark->user_ext.mac_addr_add) {
 		ark->user_ext.mac_addr_add(dev,
@@ -855,8 +841,7 @@ eth_ark_macaddr_add(struct rte_eth_dev *dev,
 static void
 eth_ark_macaddr_remove(struct rte_eth_dev *dev, uint32_t index)
 {
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 
 	if (ark->user_ext.mac_addr_remove)
 		ark->user_ext.mac_addr_remove(dev, index,
@@ -867,8 +852,7 @@ static int
 eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,
 			     struct rte_ether_addr *mac_addr)
 {
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 
 	if (ark->user_ext.mac_addr_set) {
 		ark->user_ext.mac_addr_set(dev, mac_addr,
@@ -881,8 +865,7 @@ eth_ark_set_default_mac_addr(struct rte_eth_dev *dev,
 static int
 eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t  size)
 {
-	struct ark_adapter *ark =
-		(struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 
 	if (ark->user_ext.set_mtu)
 		return ark->user_ext.set_mtu(dev, size,
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index 300029d6b86e..7de1a9851683 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -121,7 +121,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 			   struct rte_mempool *mb_pool)
 {
 	static int warning1;		/* = 0 */
-	struct ark_adapter *ark = (struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 
 	struct ark_rx_queue *queue;
 	uint32_t i;
@@ -611,7 +611,7 @@ eth_rx_queue_stats_reset(void *vqueue)
 void
 eth_ark_udm_force_close(struct rte_eth_dev *dev)
 {
-	struct ark_adapter *ark = (struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 	struct ark_rx_queue *queue;
 	uint32_t index;
 	uint16_t i;
diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c
index 94da5f9580a2..1967655707aa 100644
--- a/drivers/net/ark/ark_ethdev_tx.c
+++ b/drivers/net/ark/ark_ethdev_tx.c
@@ -207,7 +207,7 @@ eth_ark_tx_queue_setup(struct rte_eth_dev *dev,
 		       unsigned int socket_id,
 		       const struct rte_eth_txconf *tx_conf __rte_unused)
 {
-	struct ark_adapter *ark = (struct ark_adapter *)dev->data->dev_private;
+	struct ark_adapter *ark = dev->data->dev_private;
 	struct ark_tx_queue *queue;
 	int status;
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH 03/12] net/axgbe: remove unnecessary cast
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 01/12] net/atlantic: remove unnecessary cast Stephen Hemminger
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 02/12] net/ark: " Stephen Hemminger
@ 2019-05-29 19:14 ` Stephen Hemminger
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 04/12] net/bnxt: " Stephen Hemminger
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:14 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The device private pointer (dev_private) is of type void *
therefore no cast is necessary in C.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/axgbe/axgbe_ethdev.c | 24 +++++++++++++++---------
 drivers/net/axgbe/axgbe_rxtx.c   |  2 +-
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 221979c5e9f5..6b3bc3eea34f 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -157,7 +157,7 @@ axgbe_dev_configure(struct rte_eth_dev *dev)
 static int
 axgbe_dev_rx_mq_config(struct rte_eth_dev *dev)
 {
-	struct axgbe_port *pdata = (struct axgbe_port *)dev->data->dev_private;
+	struct axgbe_port *pdata = dev->data->dev_private;
 
 	if (dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_RSS)
 		pdata->rss_enable = 1;
@@ -171,10 +171,11 @@ axgbe_dev_rx_mq_config(struct rte_eth_dev *dev)
 static int
 axgbe_dev_start(struct rte_eth_dev *dev)
 {
-	PMD_INIT_FUNC_TRACE();
-	struct axgbe_port *pdata = (struct axgbe_port *)dev->data->dev_private;
+	struct axgbe_port *pdata = dev->data->dev_private;
 	int ret;
 
+	PMD_INIT_FUNC_TRACE();
+
 	/* Multiqueue RSS */
 	ret = axgbe_dev_rx_mq_config(dev);
 	if (ret) {
@@ -209,9 +210,10 @@ axgbe_dev_start(struct rte_eth_dev *dev)
 static void
 axgbe_dev_stop(struct rte_eth_dev *dev)
 {
-	PMD_INIT_FUNC_TRACE();
 	struct axgbe_port *pdata = dev->data->dev_private;
 
+	PMD_INIT_FUNC_TRACE();
+
 	rte_intr_disable(&pdata->pci_dev->intr_handle);
 
 	if (axgbe_test_bit(AXGBE_STOPPED, &pdata->dev_state))
@@ -237,27 +239,30 @@ axgbe_dev_close(struct rte_eth_dev *dev)
 static void
 axgbe_dev_promiscuous_enable(struct rte_eth_dev *dev)
 {
-	PMD_INIT_FUNC_TRACE();
 	struct axgbe_port *pdata = dev->data->dev_private;
 
+	PMD_INIT_FUNC_TRACE();
+
 	AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 1);
 }
 
 static void
 axgbe_dev_promiscuous_disable(struct rte_eth_dev *dev)
 {
-	PMD_INIT_FUNC_TRACE();
 	struct axgbe_port *pdata = dev->data->dev_private;
 
+	PMD_INIT_FUNC_TRACE();
+
 	AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PR, 0);
 }
 
 static void
 axgbe_dev_allmulticast_enable(struct rte_eth_dev *dev)
 {
-	PMD_INIT_FUNC_TRACE();
 	struct axgbe_port *pdata = dev->data->dev_private;
 
+	PMD_INIT_FUNC_TRACE();
+
 	if (AXGMAC_IOREAD_BITS(pdata, MAC_PFR, PM))
 		return;
 	AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PM, 1);
@@ -266,9 +271,10 @@ axgbe_dev_allmulticast_enable(struct rte_eth_dev *dev)
 static void
 axgbe_dev_allmulticast_disable(struct rte_eth_dev *dev)
 {
-	PMD_INIT_FUNC_TRACE();
 	struct axgbe_port *pdata = dev->data->dev_private;
 
+	PMD_INIT_FUNC_TRACE();
+
 	if (!AXGMAC_IOREAD_BITS(pdata, MAC_PFR, PM))
 		return;
 	AXGMAC_IOWRITE_BITS(pdata, MAC_PFR, PM, 0);
@@ -578,7 +584,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	pdata = (struct axgbe_port *)eth_dev->data->dev_private;
+	pdata = eth_dev->data->dev_private;
 	/* initial state */
 	axgbe_set_bit(AXGBE_DOWN, &pdata->dev_state);
 	axgbe_set_bit(AXGBE_STOPPED, &pdata->dev_state);
diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c
index e76601d149d5..cfc55b359ae8 100644
--- a/drivers/net/axgbe/axgbe_rxtx.c
+++ b/drivers/net/axgbe/axgbe_rxtx.c
@@ -342,7 +342,7 @@ int axgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 	const struct rte_memzone *tz;
 
 	tx_desc = nb_desc;
-	pdata = (struct axgbe_port *)dev->data->dev_private;
+	pdata = dev->data->dev_private;
 
 	/*
 	 * validate tx descriptors count
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH 04/12] net/bnxt: remove unnecessary cast
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
                   ` (2 preceding siblings ...)
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 03/12] net/axgbe: " Stephen Hemminger
@ 2019-05-29 19:14 ` Stephen Hemminger
  2019-06-04 13:27   ` Lance Richardson
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 05/12] net/bonding: " Stephen Hemminger
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:14 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The device private pointer (dev_private) is of type void *
therefore no cast is necessary in C.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bnxt/bnxt_ethdev.c  | 86 ++++++++++++++++-----------------
 drivers/net/bnxt/bnxt_flow.c    | 10 ++--
 drivers/net/bnxt/bnxt_irq.c     |  2 +-
 drivers/net/bnxt/bnxt_rxq.c     |  6 +--
 drivers/net/bnxt/bnxt_stats.c   |  6 +--
 drivers/net/bnxt/bnxt_txq.c     |  2 +-
 drivers/net/bnxt/bnxt_txr.c     |  4 +-
 drivers/net/bnxt/rte_pmd_bnxt.c | 32 ++++++------
 8 files changed, 74 insertions(+), 74 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b0244d6d19ea..be9cd318ec87 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -441,7 +441,7 @@ static int bnxt_init_nic(struct bnxt *bp)
 static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 				  struct rte_eth_dev_info *dev_info)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	uint16_t max_vnics, i, j, vpool, vrxq;
 	unsigned int max_rx_rings;
 
@@ -537,7 +537,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 /* Configure the device based on the configuration provided */
 static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
 	int rc;
 
@@ -626,7 +626,7 @@ static int bnxt_dev_lsc_intr_setup(struct rte_eth_dev *eth_dev)
 
 static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
 	int vlan_mask = 0;
 	int rc;
@@ -664,7 +664,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 
 static int bnxt_dev_set_link_up_op(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	int rc = 0;
 
 	if (!bp->link_info.link_up)
@@ -678,7 +678,7 @@ static int bnxt_dev_set_link_up_op(struct rte_eth_dev *eth_dev)
 
 static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 
 	eth_dev->data->dev_link.link_status = 0;
 	bnxt_set_hwrm_link_config(bp, false);
@@ -690,7 +690,7 @@ static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)
 /* Unload the driver, release resources */
 static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 
 	bp->flags &= ~BNXT_FLAG_INIT_DONE;
 	if (bp->eth_dev->data->dev_started) {
@@ -707,7 +707,7 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 
 static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 
 	if (bp->dev_stopped == 0)
 		bnxt_dev_stop_op(eth_dev);
@@ -727,7 +727,7 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev,
 				    uint32_t index)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	uint64_t pool_mask = eth_dev->data->mac_pool_sel[index];
 	struct bnxt_vnic_info *vnic;
 	struct bnxt_filter_info *filter, *temp_filter;
@@ -763,7 +763,7 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev,
 				struct rte_ether_addr *mac_addr,
 				uint32_t index, uint32_t pool)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic = &bp->vnic_info[pool];
 	struct bnxt_filter_info *filter;
 
@@ -798,7 +798,7 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev,
 int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 {
 	int rc = 0;
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	struct rte_eth_link new;
 	unsigned int cnt = BNXT_LINK_WAIT_CNT;
 
@@ -838,7 +838,7 @@ int bnxt_link_update_op(struct rte_eth_dev *eth_dev, int wait_to_complete)
 
 static void bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic;
 
 	if (bp->vnic_info == NULL)
@@ -852,7 +852,7 @@ static void bnxt_promiscuous_enable_op(struct rte_eth_dev *eth_dev)
 
 static void bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic;
 
 	if (bp->vnic_info == NULL)
@@ -866,7 +866,7 @@ static void bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
 
 static void bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic;
 
 	if (bp->vnic_info == NULL)
@@ -880,7 +880,7 @@ static void bnxt_allmulticast_enable_op(struct rte_eth_dev *eth_dev)
 
 static void bnxt_allmulticast_disable_op(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic;
 
 	if (bp->vnic_info == NULL)
@@ -896,7 +896,7 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,
 			    struct rte_eth_rss_reta_entry64 *reta_conf,
 			    uint16_t reta_size)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
 	struct bnxt_vnic_info *vnic;
 	int i;
@@ -923,7 +923,7 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
 			      struct rte_eth_rss_reta_entry64 *reta_conf,
 			      uint16_t reta_size)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
 	struct rte_intr_handle *intr_handle
 		= &bp->pdev->intr_handle;
@@ -954,7 +954,7 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
 static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
 				   struct rte_eth_rss_conf *rss_conf)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
 	struct bnxt_vnic_info *vnic;
 	uint16_t hash_type = 0;
@@ -1010,7 +1010,7 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
 static int bnxt_rss_hash_conf_get_op(struct rte_eth_dev *eth_dev,
 				     struct rte_eth_rss_conf *rss_conf)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
 	int len;
 	uint32_t hash_types;
@@ -1068,7 +1068,7 @@ static int bnxt_rss_hash_conf_get_op(struct rte_eth_dev *eth_dev,
 static int bnxt_flow_ctrl_get_op(struct rte_eth_dev *dev,
 			       struct rte_eth_fc_conf *fc_conf)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct rte_eth_link link_info;
 	int rc;
 
@@ -1100,7 +1100,7 @@ static int bnxt_flow_ctrl_get_op(struct rte_eth_dev *dev,
 static int bnxt_flow_ctrl_set_op(struct rte_eth_dev *dev,
 			       struct rte_eth_fc_conf *fc_conf)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 
 	if (!BNXT_SINGLE_PF(bp) || BNXT_VF(bp)) {
 		PMD_DRV_LOG(ERR, "Flow Control Settings cannot be modified\n");
@@ -1156,7 +1156,7 @@ static int
 bnxt_udp_tunnel_port_add_op(struct rte_eth_dev *eth_dev,
 			 struct rte_eth_udp_tunnel *udp_tunnel)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	uint16_t tunnel_type = 0;
 	int rc = 0;
 
@@ -1204,7 +1204,7 @@ static int
 bnxt_udp_tunnel_port_del_op(struct rte_eth_dev *eth_dev,
 			 struct rte_eth_udp_tunnel *udp_tunnel)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	uint16_t tunnel_type = 0;
 	uint16_t port = 0;
 	int rc = 0;
@@ -1404,7 +1404,7 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id)
 static int bnxt_vlan_filter_set_op(struct rte_eth_dev *eth_dev,
 		uint16_t vlan_id, int on)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 
 	/* These operations apply to ALL existing MAC/VLAN filters */
 	if (on)
@@ -1416,7 +1416,7 @@ static int bnxt_vlan_filter_set_op(struct rte_eth_dev *eth_dev,
 static int
 bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	uint64_t rx_offloads = dev->data->dev_conf.rxmode.offloads;
 	unsigned int i;
 
@@ -1454,7 +1454,7 @@ static int
 bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev,
 			struct rte_ether_addr *addr)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	/* Default Filter is tied to VNIC 0 */
 	struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
 	struct bnxt_filter_info *filter;
@@ -1493,7 +1493,7 @@ bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev,
 			  struct rte_ether_addr *mc_addr_set,
 			  uint32_t nb_mc_addr)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	char *mc_addr_list = (char *)mc_addr_set;
 	struct bnxt_vnic_info *vnic;
 	uint32_t off = 0, i = 0;
@@ -1522,7 +1522,7 @@ bnxt_dev_set_mc_addr_list_op(struct rte_eth_dev *eth_dev,
 static int
 bnxt_fw_version_get(struct rte_eth_dev *dev, char *fw_version, size_t fw_size)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	uint8_t fw_major = (bp->fw_ver >> 24) & 0xff;
 	uint8_t fw_minor = (bp->fw_ver >> 16) & 0xff;
 	uint8_t fw_updt = (bp->fw_ver >> 8) & 0xff;
@@ -1632,7 +1632,7 @@ static int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 static int
 bnxt_vlan_pvid_set_op(struct rte_eth_dev *dev, uint16_t pvid, int on)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	uint16_t vlan = bp->vlan;
 	int rc;
 
@@ -1652,7 +1652,7 @@ bnxt_vlan_pvid_set_op(struct rte_eth_dev *dev, uint16_t pvid, int on)
 static int
 bnxt_dev_led_on_op(struct rte_eth_dev *dev)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 
 	return bnxt_hwrm_port_led_cfg(bp, true);
 }
@@ -1660,7 +1660,7 @@ bnxt_dev_led_on_op(struct rte_eth_dev *dev)
 static int
 bnxt_dev_led_off_op(struct rte_eth_dev *dev)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 
 	return bnxt_hwrm_port_led_cfg(bp, false);
 }
@@ -1852,7 +1852,7 @@ bnxt_ethertype_filter(struct rte_eth_dev *dev,
 			enum rte_filter_op filter_op,
 			void *arg)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct rte_eth_ethertype_filter *efilter =
 			(struct rte_eth_ethertype_filter *)arg;
 	struct bnxt_filter_info *bfilter, *filter1;
@@ -2156,7 +2156,7 @@ bnxt_ntuple_filter(struct rte_eth_dev *dev,
 			enum rte_filter_op filter_op,
 			void *arg)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	int ret;
 
 	if (filter_op == RTE_ETH_FILTER_NOP)
@@ -2473,7 +2473,7 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
 		 enum rte_filter_op filter_op,
 		 void *arg)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct rte_eth_fdir_filter *fdir  = (struct rte_eth_fdir_filter *)arg;
 	struct bnxt_filter_info *filter, *match;
 	struct bnxt_vnic_info *vnic, *mvnic;
@@ -2759,7 +2759,7 @@ static int
 bnxt_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *ts)
 {
 	uint64_t ns;
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
 
 	if (!ptp)
@@ -2776,7 +2776,7 @@ static int
 bnxt_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts)
 {
 	uint64_t ns, systime_cycles;
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
 
 	if (!ptp)
@@ -2791,7 +2791,7 @@ bnxt_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts)
 static int
 bnxt_timesync_enable(struct rte_eth_dev *dev)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
 	uint32_t shift = 0;
 
@@ -2827,7 +2827,7 @@ bnxt_timesync_enable(struct rte_eth_dev *dev)
 static int
 bnxt_timesync_disable(struct rte_eth_dev *dev)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
 
 	if (!ptp)
@@ -2849,7 +2849,7 @@ bnxt_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
 				 struct timespec *timestamp,
 				 uint32_t flags __rte_unused)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
 	uint64_t rx_tstamp_cycles = 0;
 	uint64_t ns;
@@ -2867,7 +2867,7 @@ static int
 bnxt_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 				 struct timespec *timestamp)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
 	uint64_t tx_tstamp_cycles = 0;
 	uint64_t ns;
@@ -2885,7 +2885,7 @@ bnxt_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 static int
 bnxt_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
 
 	if (!ptp)
@@ -2899,7 +2899,7 @@ bnxt_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta)
 static int
 bnxt_get_eeprom_length_op(struct rte_eth_dev *dev)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	int rc;
 	uint32_t dir_entries;
 	uint32_t entry_length;
@@ -2919,7 +2919,7 @@ static int
 bnxt_get_eeprom_op(struct rte_eth_dev *dev,
 		struct rte_dev_eeprom_info *in_eeprom)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	uint32_t index;
 	uint32_t offset;
 
@@ -2990,7 +2990,7 @@ static int
 bnxt_set_eeprom_op(struct rte_eth_dev *dev,
 		struct rte_dev_eeprom_info *in_eeprom)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	uint8_t index, dir_op;
 	uint16_t type, ext, ordinal, attr;
 
diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index bb7f672fcf2a..6f92e3de5cd1 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -715,7 +715,7 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,
 {
 	const struct rte_flow_action *act =
 		bnxt_flow_non_void_action(actions);
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	const struct rte_flow_action_queue *act_q;
 	const struct rte_flow_action_vf *act_vf;
 	struct bnxt_vnic_info *vnic, *vnic0;
@@ -900,7 +900,7 @@ bnxt_flow_validate(struct rte_eth_dev *dev,
 		   const struct rte_flow_action actions[],
 		   struct rte_flow_error *error)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_filter_info *filter;
 	int ret = 0;
 
@@ -999,7 +999,7 @@ bnxt_flow_create(struct rte_eth_dev *dev,
 		 const struct rte_flow_action actions[],
 		 struct rte_flow_error *error)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_filter_info *filter;
 	struct bnxt_vnic_info *vnic = NULL;
 	bool update_flow = false;
@@ -1100,7 +1100,7 @@ bnxt_flow_destroy(struct rte_eth_dev *dev,
 		  struct rte_flow *flow,
 		  struct rte_flow_error *error)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_filter_info *filter = flow->filter;
 	struct bnxt_vnic_info *vnic = flow->vnic;
 	int ret = 0;
@@ -1129,7 +1129,7 @@ bnxt_flow_destroy(struct rte_eth_dev *dev,
 static int
 bnxt_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_vnic_info *vnic;
 	struct rte_flow *flow;
 	unsigned int i;
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index 7ef7023eb607..e03766b41f35 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -20,7 +20,7 @@
 static void bnxt_int_handler(void *param)
 {
 	struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param;
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_cp_ring_info *cpr = bp->def_cp_ring;
 	struct cmpl_base *cmp;
 	uint32_t raw_cons;
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index f1ee9eedea37..cce5340595e9 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -288,7 +288,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 			       const struct rte_eth_rxconf *rx_conf,
 			       struct rte_mempool *mp)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
 	struct bnxt_rx_queue *rxq;
 	int rc = 0;
@@ -399,7 +399,7 @@ bnxt_rx_queue_intr_disable_op(struct rte_eth_dev *eth_dev, uint16_t queue_id)
 
 int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
 	struct bnxt_rx_queue *rxq = bp->rx_queues[rx_queue_id];
 	struct bnxt_vnic_info *vnic = NULL;
@@ -439,7 +439,7 @@ int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 
 int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
 	struct bnxt_vnic_info *vnic = NULL;
 	struct bnxt_rx_queue *rxq = NULL;
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index cae3b9ea27f7..ad28887743e7 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -387,7 +387,7 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 
 void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	unsigned int i;
 
 	if (!(bp->flags & BNXT_FLAG_INIT_DONE)) {
@@ -406,7 +406,7 @@ void bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
 int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 			   struct rte_eth_xstat *xstats, unsigned int n)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 
 	unsigned int count, i;
 	uint64_t tx_drop_pkts;
@@ -532,7 +532,7 @@ int bnxt_dev_xstats_get_names_op(__rte_unused struct rte_eth_dev *eth_dev,
 
 void bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 
 	if (bp->flags & BNXT_FLAG_PORT_STATS && BNXT_SINGLE_PF(bp))
 		bnxt_hwrm_port_clr_stats(bp);
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index 5a7bfaf3e769..665bfbc12629 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -80,7 +80,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 			       unsigned int socket_id,
 			       const struct rte_eth_txconf *tx_conf)
 {
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+	struct bnxt *bp = eth_dev->data->dev_private;
 	struct bnxt_tx_queue *txq;
 	int rc = 0;
 
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 9de12e0d0f90..f460665ff6d6 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -475,7 +475,7 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
 int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
 
 	dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
@@ -487,7 +487,7 @@ int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 
 int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 {
-	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_tx_queue *txq = bp->tx_queues[tx_queue_id];
 
 	/* Handle TX completions */
diff --git a/drivers/net/bnxt/rte_pmd_bnxt.c b/drivers/net/bnxt/rte_pmd_bnxt.c
index f0778967048f..fbd2dd493db9 100644
--- a/drivers/net/bnxt/rte_pmd_bnxt.c
+++ b/drivers/net/bnxt/rte_pmd_bnxt.c
@@ -54,7 +54,7 @@ int rte_pmd_bnxt_set_tx_loopback(uint16_t port, uint8_t on)
 	if (!is_bnxt_supported(eth_dev))
 		return -ENOTSUP;
 
-	bp = (struct bnxt *)eth_dev->data->dev_private;
+	bp = eth_dev->data->dev_private;
 
 	if (!BNXT_PF(bp)) {
 		PMD_DRV_LOG(ERR,
@@ -96,7 +96,7 @@ int rte_pmd_bnxt_set_all_queues_drop_en(uint16_t port, uint8_t on)
 	if (!is_bnxt_supported(eth_dev))
 		return -ENOTSUP;
 
-	bp = (struct bnxt *)eth_dev->data->dev_private;
+	bp = eth_dev->data->dev_private;
 
 	if (!BNXT_PF(bp)) {
 		PMD_DRV_LOG(ERR,
@@ -146,7 +146,7 @@ int rte_pmd_bnxt_set_vf_mac_addr(uint16_t port, uint16_t vf,
 		return -ENOTSUP;
 
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 
 	if (vf >= dev_info.max_vfs || mac_addr == NULL)
 		return -EINVAL;
@@ -180,7 +180,7 @@ int rte_pmd_bnxt_set_vf_rate_limit(uint16_t port, uint16_t vf,
 		return -ENOTSUP;
 
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)eth_dev->data->dev_private;
+	bp = eth_dev->data->dev_private;
 
 	if (!bp->pf.active_vfs)
 		return -EINVAL;
@@ -231,7 +231,7 @@ int rte_pmd_bnxt_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
 		return -ENOTSUP;
 
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 
 	if (!BNXT_PF(bp)) {
 		PMD_DRV_LOG(ERR,
@@ -283,7 +283,7 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf, uint8_t on)
 		return -ENOTSUP;
 
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 
 	if (!BNXT_PF(bp)) {
 		PMD_DRV_LOG(ERR,
@@ -333,7 +333,7 @@ rte_pmd_bnxt_set_vf_vlan_stripq(uint16_t port, uint16_t vf, uint8_t on)
 		return -ENOTSUP;
 
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 
 	if (vf >= dev_info.max_vfs)
 		return -EINVAL;
@@ -370,7 +370,7 @@ int rte_pmd_bnxt_set_vf_rxmode(uint16_t port, uint16_t vf,
 		return -ENOTSUP;
 
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 
 	if (!bp->pf.vf_info)
 		return -EINVAL;
@@ -462,7 +462,7 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint16_t port, uint16_t vlan,
 	if (!is_bnxt_supported(dev))
 		return -ENOTSUP;
 
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 	if (!bp->pf.vf_info)
 		return -EINVAL;
 
@@ -551,7 +551,7 @@ int rte_pmd_bnxt_get_vf_stats(uint16_t port,
 		return -ENOTSUP;
 
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 
 	if (vf_id >= dev_info.max_vfs)
 		return -EINVAL;
@@ -578,7 +578,7 @@ int rte_pmd_bnxt_reset_vf_stats(uint16_t port,
 		return -ENOTSUP;
 
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 
 	if (vf_id >= dev_info.max_vfs)
 		return -EINVAL;
@@ -604,7 +604,7 @@ int rte_pmd_bnxt_get_vf_rx_status(uint16_t port, uint16_t vf_id)
 		return -ENOTSUP;
 
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 
 	if (vf_id >= dev_info.max_vfs)
 		return -EINVAL;
@@ -631,7 +631,7 @@ int rte_pmd_bnxt_get_vf_tx_drop_count(uint16_t port, uint16_t vf_id,
 		return -ENOTSUP;
 
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 
 	if (vf_id >= dev_info.max_vfs)
 		return -EINVAL;
@@ -663,7 +663,7 @@ int rte_pmd_bnxt_mac_addr_add(uint16_t port, struct rte_ether_addr *addr,
 		return -ENOTSUP;
 
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 
 	if (vf_id >= dev_info.max_vfs)
 		return -EINVAL;
@@ -739,7 +739,7 @@ rte_pmd_bnxt_set_vf_vlan_insert(uint16_t port, uint16_t vf,
 		return -ENOTSUP;
 
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 
 	if (vf >= dev_info.max_vfs)
 		return -EINVAL;
@@ -776,7 +776,7 @@ int rte_pmd_bnxt_set_vf_persist_stats(uint16_t port, uint16_t vf, uint8_t on)
 
 	dev = &rte_eth_devices[port];
 	rte_eth_dev_info_get(port, &dev_info);
-	bp = (struct bnxt *)dev->data->dev_private;
+	bp = dev->data->dev_private;
 
 	if (!BNXT_PF(bp)) {
 		PMD_DRV_LOG(ERR,
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH 05/12] net/bonding: remove unnecessary cast
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
                   ` (3 preceding siblings ...)
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 04/12] net/bnxt: " Stephen Hemminger
@ 2019-05-29 19:14 ` Stephen Hemminger
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 06/12] net/cxgbe: " Stephen Hemminger
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:14 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The device private pointer (dev_private) is of type void *
therefore no cast is necessary in C.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 7087bc01b139..cea289c246d1 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -160,8 +160,7 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
 		uint16_t slave_port) {
 	struct rte_eth_dev_info slave_info;
 	struct rte_flow_error error;
-	struct bond_dev_private *internals = (struct bond_dev_private *)
-			(bond_dev->data->dev_private);
+	struct bond_dev_private *internals = bond_dev->data->dev_private;
 
 	const struct rte_flow_action_queue lacp_queue_conf = {
 		.index = 0,
@@ -201,8 +200,7 @@ bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
 int
 bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) {
 	struct rte_eth_dev *bond_dev = &rte_eth_devices[port_id];
-	struct bond_dev_private *internals = (struct bond_dev_private *)
-			(bond_dev->data->dev_private);
+	struct bond_dev_private *internals = bond_dev->data->dev_private;
 	struct rte_eth_dev_info bond_info;
 	uint16_t idx;
 
@@ -227,9 +225,7 @@ int
 bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint16_t slave_port) {
 
 	struct rte_flow_error error;
-	struct bond_dev_private *internals = (struct bond_dev_private *)
-			(bond_dev->data->dev_private);
-
+	struct bond_dev_private *internals = bond_dev->data->dev_private;
 	struct rte_flow_action_queue lacp_queue_conf = {
 		.index = internals->mode4.dedicated_queues.rx_qid,
 	};
@@ -1735,8 +1731,7 @@ slave_configure_slow_queue(struct rte_eth_dev *bonded_eth_dev,
 		struct rte_eth_dev *slave_eth_dev)
 {
 	int errval = 0;
-	struct bond_dev_private *internals = (struct bond_dev_private *)
-		bonded_eth_dev->data->dev_private;
+	struct bond_dev_private *internals = bonded_eth_dev->data->dev_private;
 	struct port *port = &bond_mode_8023ad_ports[slave_eth_dev->data->port_id];
 
 	if (port->slow_pool == NULL) {
@@ -1802,8 +1797,7 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev,
 	uint16_t q_id;
 	struct rte_flow_error flow_error;
 
-	struct bond_dev_private *internals = (struct bond_dev_private *)
-		bonded_eth_dev->data->dev_private;
+	struct bond_dev_private *internals = bonded_eth_dev->data->dev_private;
 
 	/* Stop slave */
 	rte_eth_dev_stop(slave_eth_dev->data->port_id);
@@ -2421,8 +2415,8 @@ bond_ethdev_slave_link_status_change_monitor(void *cb_arg)
 	if (cb_arg == NULL)
 		return;
 
-	bonded_ethdev = (struct rte_eth_dev *)cb_arg;
-	internals = (struct bond_dev_private *)bonded_ethdev->data->dev_private;
+	bonded_ethdev = cb_arg;
+	internals = bonded_ethdev->data->dev_private;
 
 	if (!bonded_ethdev->data->dev_started ||
 		!internals->link_status_polling_enabled)
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH 06/12] net/cxgbe: remove unnecessary cast
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
                   ` (4 preceding siblings ...)
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 05/12] net/bonding: " Stephen Hemminger
@ 2019-05-29 19:14 ` Stephen Hemminger
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 07/12] net/e1000: remove unnecessary cast of void * Stephen Hemminger
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:14 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The device private pointer (dev_private) is of type void *
therefore no cast is necessary in C.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/cxgbe/base/adapter.h   |  2 +-
 drivers/net/cxgbe/cxgbe_ethdev.c   | 60 +++++++++++++++---------------
 drivers/net/cxgbe/cxgbe_filter.c   |  2 +-
 drivers/net/cxgbe/cxgbe_main.c     |  6 +--
 drivers/net/cxgbe/cxgbevf_ethdev.c |  6 +--
 drivers/net/cxgbe/cxgbevf_main.c   |  2 +-
 drivers/net/cxgbe/sge.c            |  8 ++--
 7 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h
index 122166410a60..e548f9f63a10 100644
--- a/drivers/net/cxgbe/base/adapter.h
+++ b/drivers/net/cxgbe/base/adapter.h
@@ -368,7 +368,7 @@ static inline void t4_os_write_unlock(rte_rwlock_t *lock)
  */
 static inline struct port_info *ethdev2pinfo(const struct rte_eth_dev *dev)
 {
-	return (struct port_info *)dev->data->dev_private;
+	return dev->data->dev_private;
 }
 
 /**
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index c03559640a49..2a8e61b9f6e1 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -112,7 +112,7 @@ uint16_t cxgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 			struct rte_eth_dev_info *device_info)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	int max_queues = adapter->sge.max_ethqsets / adapter->params.nports;
 
@@ -148,7 +148,7 @@ void cxgbe_dev_info_get(struct rte_eth_dev *eth_dev,
 
 void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
 	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
@@ -157,7 +157,7 @@ void cxgbe_dev_promiscuous_enable(struct rte_eth_dev *eth_dev)
 
 void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
 	t4_set_rxmode(adapter, adapter->mbox, pi->viid, -1,
@@ -166,7 +166,7 @@ void cxgbe_dev_promiscuous_disable(struct rte_eth_dev *eth_dev)
 
 void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
 	/* TODO: address filters ?? */
@@ -177,7 +177,7 @@ void cxgbe_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
 
 void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
 	/* TODO: address filters ?? */
@@ -189,7 +189,7 @@ void cxgbe_dev_allmulticast_disable(struct rte_eth_dev *eth_dev)
 int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,
 			  int wait_to_complete)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	struct sge *s = &adapter->sge;
 	struct rte_eth_link new_link = { 0 };
@@ -224,7 +224,7 @@ int cxgbe_dev_link_update(struct rte_eth_dev *eth_dev,
  */
 int cxgbe_dev_set_link_up(struct rte_eth_dev *dev)
 {
-	struct port_info *pi = (struct port_info *)(dev->data->dev_private);
+	struct port_info *pi = dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	unsigned int work_done, budget = 32;
 	struct sge *s = &adapter->sge;
@@ -250,7 +250,7 @@ int cxgbe_dev_set_link_up(struct rte_eth_dev *dev)
  */
 int cxgbe_dev_set_link_down(struct rte_eth_dev *dev)
 {
-	struct port_info *pi = (struct port_info *)(dev->data->dev_private);
+	struct port_info *pi = dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	unsigned int work_done, budget = 32;
 	struct sge *s = &adapter->sge;
@@ -273,7 +273,7 @@ int cxgbe_dev_set_link_down(struct rte_eth_dev *dev)
 
 int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	struct rte_eth_dev_info dev_info;
 	int err;
@@ -306,7 +306,7 @@ int cxgbe_dev_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu)
  */
 void cxgbe_dev_close(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
 	CXGBE_FUNC_TRACE();
@@ -328,7 +328,7 @@ void cxgbe_dev_close(struct rte_eth_dev *eth_dev)
  */
 int cxgbe_dev_start(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct rte_eth_rxmode *rx_conf = &eth_dev->data->dev_conf.rxmode;
 	struct adapter *adapter = pi->adapter;
 	int err = 0, i;
@@ -386,7 +386,7 @@ int cxgbe_dev_start(struct rte_eth_dev *eth_dev)
  */
 void cxgbe_dev_stop(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
 	CXGBE_FUNC_TRACE();
@@ -406,7 +406,7 @@ void cxgbe_dev_stop(struct rte_eth_dev *eth_dev)
 
 int cxgbe_dev_configure(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	int err;
 
@@ -466,7 +466,7 @@ int cxgbe_dev_tx_queue_setup(struct rte_eth_dev *eth_dev,
 			     unsigned int socket_id,
 			     const struct rte_eth_txconf *tx_conf __rte_unused)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	struct sge *s = &adapter->sge;
 	struct sge_eth_txq *txq = &s->ethtxq[pi->first_qset + queue_idx];
@@ -531,7 +531,7 @@ void cxgbe_dev_tx_queue_release(void *q)
 int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 {
 	int ret;
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adap = pi->adapter;
 	struct sge_rspq *q;
 
@@ -550,7 +550,7 @@ int cxgbe_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 int cxgbe_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id)
 {
 	int ret;
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adap = pi->adapter;
 	struct sge_rspq *q;
 
@@ -571,7 +571,7 @@ int cxgbe_dev_rx_queue_setup(struct rte_eth_dev *eth_dev,
 			     const struct rte_eth_rxconf *rx_conf __rte_unused,
 			     struct rte_mempool *mp)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	struct sge *s = &adapter->sge;
 	struct sge_eth_rxq *rxq = &s->ethrxq[pi->first_qset + queue_idx];
@@ -668,7 +668,7 @@ void cxgbe_dev_rx_queue_release(void *q)
 static int cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev,
 				struct rte_eth_stats *eth_stats)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	struct sge *s = &adapter->sge;
 	struct port_stats ps;
@@ -716,7 +716,7 @@ static int cxgbe_dev_stats_get(struct rte_eth_dev *eth_dev,
  */
 static void cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	struct sge *s = &adapter->sge;
 	unsigned int i;
@@ -742,7 +742,7 @@ static void cxgbe_dev_stats_reset(struct rte_eth_dev *eth_dev)
 static int cxgbe_flow_ctrl_get(struct rte_eth_dev *eth_dev,
 			       struct rte_eth_fc_conf *fc_conf)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct link_config *lc = &pi->link_cfg;
 	int rx_pause, tx_pause;
 
@@ -764,7 +764,7 @@ static int cxgbe_flow_ctrl_get(struct rte_eth_dev *eth_dev,
 static int cxgbe_flow_ctrl_set(struct rte_eth_dev *eth_dev,
 			       struct rte_eth_fc_conf *fc_conf)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	struct link_config *lc = &pi->link_cfg;
 
@@ -810,7 +810,7 @@ cxgbe_dev_supported_ptypes_get(struct rte_eth_dev *eth_dev)
 static int cxgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
 				     struct rte_eth_rss_conf *rss_conf)
 {
-	struct port_info *pi = (struct port_info *)(dev->data->dev_private);
+	struct port_info *pi = dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	int err;
 
@@ -840,7 +840,7 @@ static int cxgbe_dev_rss_hash_update(struct rte_eth_dev *dev,
 static int cxgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
 				       struct rte_eth_rss_conf *rss_conf)
 {
-	struct port_info *pi = (struct port_info *)(dev->data->dev_private);
+	struct port_info *pi = dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	u64 rss_hf = 0;
 	u64 flags = 0;
@@ -949,7 +949,7 @@ static int eeprom_wr_phys(struct adapter *adap, unsigned int phys_addr, u32 v)
 static int cxgbe_get_eeprom(struct rte_eth_dev *dev,
 			    struct rte_dev_eeprom_info *e)
 {
-	struct port_info *pi = (struct port_info *)(dev->data->dev_private);
+	struct port_info *pi = dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	u32 i, err = 0;
 	u8 *buf = rte_zmalloc(NULL, EEPROMSIZE, 0);
@@ -970,7 +970,7 @@ static int cxgbe_get_eeprom(struct rte_eth_dev *dev,
 static int cxgbe_set_eeprom(struct rte_eth_dev *dev,
 			    struct rte_dev_eeprom_info *eeprom)
 {
-	struct port_info *pi = (struct port_info *)(dev->data->dev_private);
+	struct port_info *pi = dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	u8 *buf;
 	int err = 0;
@@ -1028,7 +1028,7 @@ static int cxgbe_set_eeprom(struct rte_eth_dev *dev,
 
 static int cxgbe_get_regs_len(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
 	return t4_get_regs_len(adapter) / sizeof(uint32_t);
@@ -1037,7 +1037,7 @@ static int cxgbe_get_regs_len(struct rte_eth_dev *eth_dev)
 static int cxgbe_get_regs(struct rte_eth_dev *eth_dev,
 			  struct rte_dev_reg_info *regs)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 
 	regs->version = CHELSIO_CHIP_VERSION(adapter->params.chip) |
@@ -1058,7 +1058,7 @@ static int cxgbe_get_regs(struct rte_eth_dev *eth_dev,
 
 int cxgbe_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *addr)
 {
-	struct port_info *pi = (struct port_info *)(dev->data->dev_private);
+	struct port_info *pi = dev->data->dev_private;
 	int ret;
 
 	ret = cxgbe_mpstcam_modify(pi, (int)pi->xact_addr_filt, (u8 *)addr);
@@ -1115,7 +1115,7 @@ static const struct eth_dev_ops cxgbe_eth_dev_ops = {
 static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev)
 {
 	struct rte_pci_device *pci_dev;
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = NULL;
 	char name[RTE_ETH_NAME_MAX_LEN];
 	int err = 0;
@@ -1186,7 +1186,7 @@ static int eth_cxgbe_dev_init(struct rte_eth_dev *eth_dev)
 
 static int eth_cxgbe_dev_uninit(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adap = pi->adapter;
 
 	/* Free up other ports and all resources */
diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c
index a77935a65732..7fcee5c0ad26 100644
--- a/drivers/net/cxgbe/cxgbe_filter.c
+++ b/drivers/net/cxgbe/cxgbe_filter.c
@@ -854,7 +854,7 @@ int cxgbe_del_filter(struct rte_eth_dev *dev, unsigned int filter_id,
 		     struct ch_filter_specification *fs,
 		     struct filter_ctx *ctx)
 {
-	struct port_info *pi = (struct port_info *)(dev->data->dev_private);
+	struct port_info *pi = dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	struct filter_entry *f;
 	unsigned int chip_ver;
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index b5d5cd081ace..4e24fedc735b 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -477,7 +477,7 @@ static inline void init_rspq(struct adapter *adap, struct sge_rspq *q,
 
 int cxgbe_cfg_queue_count(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adap = pi->adapter;
 	struct sge *s = &adap->sge;
 	unsigned int max_queues = s->max_ethqsets / adap->params.nports;
@@ -505,7 +505,7 @@ int cxgbe_cfg_queue_count(struct rte_eth_dev *eth_dev)
 void cxgbe_cfg_queues(struct rte_eth_dev *eth_dev)
 {
 	struct rte_config *config = rte_eal_get_configuration();
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adap = pi->adapter;
 	struct sge *s = &adap->sge;
 	unsigned int i, nb_ports = 0, qidx = 0;
@@ -1825,7 +1825,7 @@ int cxgbe_probe(struct adapter *adapter)
 			goto out_free;
 
 allocate_mac:
-		pi = (struct port_info *)eth_dev->data->dev_private;
+		pi = eth_dev->data->dev_private;
 		adapter->port[i] = pi;
 		pi->eth_dev = eth_dev;
 		pi->adapter = adapter;
diff --git a/drivers/net/cxgbe/cxgbevf_ethdev.c b/drivers/net/cxgbe/cxgbevf_ethdev.c
index 0e93d99e6e4d..c5f03434ee44 100644
--- a/drivers/net/cxgbe/cxgbevf_ethdev.c
+++ b/drivers/net/cxgbe/cxgbevf_ethdev.c
@@ -36,7 +36,7 @@
 static int cxgbevf_dev_stats_get(struct rte_eth_dev *eth_dev,
 				 struct rte_eth_stats *eth_stats)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adapter = pi->adapter;
 	struct sge *s = &adapter->sge;
 	struct port_stats ps;
@@ -107,7 +107,7 @@ static const struct eth_dev_ops cxgbevf_eth_dev_ops = {
  */
 static int eth_cxgbevf_dev_init(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct rte_pci_device *pci_dev;
 	char name[RTE_ETH_NAME_MAX_LEN];
 	struct adapter *adapter = NULL;
@@ -179,7 +179,7 @@ static int eth_cxgbevf_dev_init(struct rte_eth_dev *eth_dev)
 
 static int eth_cxgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
 {
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	struct adapter *adap = pi->adapter;
 
 	/* Free up other ports and all resources */
diff --git a/drivers/net/cxgbe/cxgbevf_main.c b/drivers/net/cxgbe/cxgbevf_main.c
index d3345508f491..82f40f358096 100644
--- a/drivers/net/cxgbe/cxgbevf_main.c
+++ b/drivers/net/cxgbe/cxgbevf_main.c
@@ -230,7 +230,7 @@ int cxgbevf_probe(struct adapter *adapter)
 			goto out_free;
 
 allocate_mac:
-		pi = (struct port_info *)eth_dev->data->dev_private;
+		pi = eth_dev->data->dev_private;
 		adapter->port[i] = pi;
 		pi->eth_dev = eth_dev;
 		pi->adapter = adapter;
diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c
index b3c4ec2ebf9f..641be96578d9 100644
--- a/drivers/net/cxgbe/sge.c
+++ b/drivers/net/cxgbe/sge.c
@@ -1138,7 +1138,7 @@ int t4_eth_xmit(struct sge_eth_txq *txq, struct rte_mbuf *mbuf,
 	    (unlikely(m->pkt_len > max_pkt_len)))
 		goto out_free;
 
-	pi = (struct port_info *)txq->data->dev_private;
+	pi = txq->data->dev_private;
 	adap = pi->adapter;
 
 	cntrl = F_TXPKT_L4CSUM_DIS | F_TXPKT_IPCSUM_DIS;
@@ -1792,7 +1792,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
 	int ret, flsz = 0;
 	struct fw_iq_cmd c;
 	struct sge *s = &adap->sge;
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	char z_name[RTE_MEMZONE_NAMESIZE];
 	char z_name_sw[RTE_MEMZONE_NAMESIZE];
 	unsigned int nb_refill;
@@ -2062,7 +2062,7 @@ int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
 	int ret, nentries;
 	struct fw_eq_eth_cmd c;
 	struct sge *s = &adap->sge;
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	char z_name[RTE_MEMZONE_NAMESIZE];
 	char z_name_sw[RTE_MEMZONE_NAMESIZE];
 	u8 pciechan;
@@ -2141,7 +2141,7 @@ int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
 	int ret, nentries;
 	struct fw_eq_ctrl_cmd c;
 	struct sge *s = &adap->sge;
-	struct port_info *pi = (struct port_info *)(eth_dev->data->dev_private);
+	struct port_info *pi = eth_dev->data->dev_private;
 	char z_name[RTE_MEMZONE_NAMESIZE];
 	char z_name_sw[RTE_MEMZONE_NAMESIZE];
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH 07/12] net/e1000: remove unnecessary cast of void *
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
                   ` (5 preceding siblings ...)
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 06/12] net/cxgbe: " Stephen Hemminger
@ 2019-05-29 19:14 ` Stephen Hemminger
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 08/12] net/ena: remove unnecessary cast Stephen Hemminger
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:14 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

dev_private is void * so cast is unnecessary in C.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/e1000/igb_ethdev.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index bd1c64c0367d..2e9fee6a3674 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -5029,8 +5029,7 @@ static void
 igb_start_timecounters(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct e1000_adapter *adapter =
-		(struct e1000_adapter *)dev->data->dev_private;
+	struct e1000_adapter *adapter = dev->data->dev_private;
 	uint32_t incval = 1;
 	uint32_t shift = 0;
 	uint64_t mask = E1000_CYCLECOUNTER_MASK;
@@ -5081,8 +5080,7 @@ igb_start_timecounters(struct rte_eth_dev *dev)
 static int
 igb_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta)
 {
-	struct e1000_adapter *adapter =
-			(struct e1000_adapter *)dev->data->dev_private;
+	struct e1000_adapter *adapter = dev->data->dev_private;
 
 	adapter->systime_tc.nsec += delta;
 	adapter->rx_tstamp_tc.nsec += delta;
@@ -5095,8 +5093,7 @@ static int
 igb_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *ts)
 {
 	uint64_t ns;
-	struct e1000_adapter *adapter =
-			(struct e1000_adapter *)dev->data->dev_private;
+	struct e1000_adapter *adapter = dev->data->dev_private;
 
 	ns = rte_timespec_to_ns(ts);
 
@@ -5112,8 +5109,7 @@ static int
 igb_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts)
 {
 	uint64_t ns, systime_cycles;
-	struct e1000_adapter *adapter =
-			(struct e1000_adapter *)dev->data->dev_private;
+	struct e1000_adapter *adapter = dev->data->dev_private;
 
 	systime_cycles = igb_read_systime_cyclecounter(dev);
 	ns = rte_timecounter_update(&adapter->systime_tc, systime_cycles);
@@ -5206,8 +5202,7 @@ igb_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
 			       uint32_t flags __rte_unused)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct e1000_adapter *adapter =
-			(struct e1000_adapter *)dev->data->dev_private;
+	struct e1000_adapter *adapter = dev->data->dev_private;
 	uint32_t tsync_rxctl;
 	uint64_t rx_tstamp_cycles;
 	uint64_t ns;
@@ -5228,8 +5223,7 @@ igb_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 			       struct timespec *timestamp)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct e1000_adapter *adapter =
-			(struct e1000_adapter *)dev->data->dev_private;
+	struct e1000_adapter *adapter = dev->data->dev_private;
 	uint32_t tsync_txctl;
 	uint64_t tx_tstamp_cycles;
 	uint64_t ns;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH 08/12] net/ena: remove unnecessary cast
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
                   ` (6 preceding siblings ...)
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 07/12] net/e1000: remove unnecessary cast of void * Stephen Hemminger
@ 2019-05-29 19:14 ` Stephen Hemminger
  2019-06-05 14:28   ` Ferruh Yigit
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 09/12] net/enic: " Stephen Hemminger
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:14 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The device private pointer (dev_private) is of type void *
therefore no cast is necessary in C.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/ena/ena_ethdev.c | 66 +++++++++++++-----------------------
 1 file changed, 24 insertions(+), 42 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index b6651fc0fddb..ff88b178afa4 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -493,8 +493,7 @@ static void ena_close(struct rte_eth_dev *dev)
 {
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 
 	if (adapter->state == ENA_ADAPTER_STATE_RUNNING)
 		ena_stop(dev);
@@ -535,8 +534,7 @@ static int ena_rss_reta_update(struct rte_eth_dev *dev,
 			       struct rte_eth_rss_reta_entry64 *reta_conf,
 			       uint16_t reta_size)
 {
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 	struct ena_com_dev *ena_dev = &adapter->ena_dev;
 	int rc, i;
 	u16 entry_value;
@@ -591,8 +589,7 @@ static int ena_rss_reta_query(struct rte_eth_dev *dev,
 			      struct rte_eth_rss_reta_entry64 *reta_conf,
 			      uint16_t reta_size)
 {
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 	struct ena_com_dev *ena_dev = &adapter->ena_dev;
 	int rc;
 	int i;
@@ -768,9 +765,7 @@ static int ena_link_update(struct rte_eth_dev *dev,
 			   __rte_unused int wait_to_complete)
 {
 	struct rte_eth_link *link = &dev->data->dev_link;
-	struct ena_adapter *adapter;
-
-	adapter = (struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter =dev->data->dev_private;
 
 	link->link_status = adapter->link_status ? ETH_LINK_UP : ETH_LINK_DOWN;
 	link->link_speed = ETH_SPEED_NUM_NONE;
@@ -782,8 +777,7 @@ static int ena_link_update(struct rte_eth_dev *dev,
 static int ena_queue_start_all(struct rte_eth_dev *dev,
 			       enum ena_ring_type ring_type)
 {
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 	struct ena_ring *queues = NULL;
 	int nb_queues;
 	int i = 0;
@@ -928,8 +922,7 @@ ena_calc_queue_size(struct ena_calc_queue_size_ctx *ctx)
 
 static void ena_stats_restart(struct rte_eth_dev *dev)
 {
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 
 	rte_atomic64_init(&adapter->drv_stats->ierrors);
 	rte_atomic64_init(&adapter->drv_stats->oerrors);
@@ -941,8 +934,7 @@ static int ena_stats_get(struct rte_eth_dev *dev,
 			  struct rte_eth_stats *stats)
 {
 	struct ena_admin_basic_stats ena_stats;
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 	struct ena_com_dev *ena_dev = &adapter->ena_dev;
 	int rc;
 	int i;
@@ -1005,7 +997,7 @@ static int ena_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 
 	ena_assert_msg(dev->data != NULL, "Uninitialized device\n");
 	ena_assert_msg(dev->data->dev_private != NULL, "Uninitialized device\n");
-	adapter = (struct ena_adapter *)(dev->data->dev_private);
+	adapter = dev->data->dev_private;
 
 	ena_dev = &adapter->ena_dev;
 	ena_assert_msg(ena_dev != NULL, "Uninitialized device\n");
@@ -1029,8 +1021,7 @@ static int ena_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 
 static int ena_start(struct rte_eth_dev *dev)
 {
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 	uint64_t ticks;
 	int rc = 0;
 
@@ -1076,8 +1067,7 @@ static int ena_start(struct rte_eth_dev *dev)
 
 static void ena_stop(struct rte_eth_dev *dev)
 {
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 	struct ena_com_dev *ena_dev = &adapter->ena_dev;
 	int rc;
 
@@ -1169,8 +1159,7 @@ static void ena_queue_stop(struct ena_ring *ring)
 static void ena_queue_stop_all(struct rte_eth_dev *dev,
 			      enum ena_ring_type ring_type)
 {
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 	struct ena_ring *queues = NULL;
 	uint16_t nb_queues, i;
 
@@ -1228,8 +1217,7 @@ static int ena_tx_queue_setup(struct rte_eth_dev *dev,
 			      const struct rte_eth_txconf *tx_conf)
 {
 	struct ena_ring *txq = NULL;
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 	unsigned int i;
 
 	txq = &adapter->tx_ring[queue_idx];
@@ -1313,8 +1301,7 @@ static int ena_rx_queue_setup(struct rte_eth_dev *dev,
 			      __rte_unused const struct rte_eth_rxconf *rx_conf,
 			      struct rte_mempool *mp)
 {
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 	struct ena_ring *rxq = NULL;
 	int i;
 
@@ -1558,7 +1545,7 @@ static int ena_device_init(struct ena_com_dev *ena_dev,
 
 static void ena_interrupt_handler_rte(void *cb_arg)
 {
-	struct ena_adapter *adapter = (struct ena_adapter *)cb_arg;
+	struct ena_adapter *adapter = cb_arg;
 	struct ena_com_dev *ena_dev = &adapter->ena_dev;
 
 	ena_com_admin_q_comp_intr_handler(ena_dev);
@@ -1596,7 +1583,7 @@ static void check_for_admin_com_state(struct ena_adapter *adapter)
 static void ena_timer_wd_callback(__rte_unused struct rte_timer *timer,
 				  void *arg)
 {
-	struct ena_adapter *adapter = (struct ena_adapter *)arg;
+	struct ena_adapter *adapter = arg;
 	struct rte_eth_dev *dev = adapter->rte_dev;
 
 	check_for_missing_keep_alive(adapter);
@@ -1703,8 +1690,7 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
 	struct ena_calc_queue_size_ctx calc_queue_ctx = { 0 };
 	struct rte_pci_device *pci_dev;
 	struct rte_intr_handle *intr_handle;
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(eth_dev->data->dev_private);
+	struct ena_adapter *adapter = eth_dev->data->dev_private;
 	struct ena_com_dev *ena_dev = &adapter->ena_dev;
 	struct ena_com_dev_get_features_ctx get_feat_ctx;
 	struct ena_llq_configurations llq_config;
@@ -1862,8 +1848,7 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
 
 static void ena_destroy_device(struct rte_eth_dev *eth_dev)
 {
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(eth_dev->data->dev_private);
+	struct ena_adapter *adapter = eth_dev->data->dev_private;
 	struct ena_com_dev *ena_dev = &adapter->ena_dev;
 
 	if (adapter->state == ENA_ADAPTER_STATE_FREE)
@@ -1902,8 +1887,7 @@ static int eth_ena_dev_uninit(struct rte_eth_dev *eth_dev)
 
 static int ena_dev_configure(struct rte_eth_dev *dev)
 {
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 
 	adapter->state = ENA_ADAPTER_STATE_CONFIG;
 
@@ -1948,7 +1932,7 @@ static void ena_infos_get(struct rte_eth_dev *dev,
 
 	ena_assert_msg(dev->data != NULL, "Uninitialized device\n");
 	ena_assert_msg(dev->data->dev_private != NULL, "Uninitialized device\n");
-	adapter = (struct ena_adapter *)(dev->data->dev_private);
+	adapter = dev->data->dev_private;
 
 	ena_dev = &adapter->ena_dev;
 	ena_assert_msg(ena_dev != NULL, "Uninitialized device\n");
@@ -2506,8 +2490,7 @@ static int ena_xstats_get(struct rte_eth_dev *dev,
 			  struct rte_eth_xstat *xstats,
 			  unsigned int n)
 {
-	struct ena_adapter *adapter =
-			(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter =dev->data->dev_private;
 	unsigned int xstats_count = ena_xstats_calc_num(dev);
 	unsigned int stat, i, count = 0;
 	int stat_offset;
@@ -2558,8 +2541,7 @@ static int ena_xstats_get_by_id(struct rte_eth_dev *dev,
 				uint64_t *values,
 				unsigned int n)
 {
-	struct ena_adapter *adapter =
-		(struct ena_adapter *)(dev->data->dev_private);
+	struct ena_adapter *adapter = dev->data->dev_private;
 	uint64_t id;
 	uint64_t rx_entries, tx_entries;
 	unsigned int i;
@@ -2649,7 +2631,7 @@ static void ena_update_on_link_change(void *adapter_data,
 	struct ena_admin_aenq_link_change_desc *aenq_link_desc;
 	uint32_t status;
 
-	adapter = (struct ena_adapter *)adapter_data;
+	adapter = adapter_data;
 	aenq_link_desc = (struct ena_admin_aenq_link_change_desc *)aenq_e;
 	eth_dev = adapter->rte_dev;
 
@@ -2663,7 +2645,7 @@ static void ena_update_on_link_change(void *adapter_data,
 static void ena_notification(void *data,
 			     struct ena_admin_aenq_entry *aenq_e)
 {
-	struct ena_adapter *adapter = (struct ena_adapter *)data;
+	struct ena_adapter *adapter = data;
 	struct ena_admin_ena_hw_hints *hints;
 
 	if (aenq_e->aenq_common_desc.group != ENA_ADMIN_NOTIFICATION)
@@ -2686,7 +2668,7 @@ static void ena_notification(void *data,
 static void ena_keep_alive(void *adapter_data,
 			   __rte_unused struct ena_admin_aenq_entry *aenq_e)
 {
-	struct ena_adapter *adapter = (struct ena_adapter *)adapter_data;
+	struct ena_adapter *adapter = adapter_data;
 	struct ena_admin_aenq_keep_alive_desc *desc;
 	uint64_t rx_drops;
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH 09/12] net/enic: remove unnecessary cast
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
                   ` (7 preceding siblings ...)
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 08/12] net/ena: remove unnecessary cast Stephen Hemminger
@ 2019-05-29 19:14 ` Stephen Hemminger
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 10/12] net/i40e: " Stephen Hemminger
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:14 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The device private pointer (dev_private) is of type void *
therefore no cast is necessary in C.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/enic/enic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h
index bd2783430c08..beb439ee7137 100644
--- a/drivers/net/enic/enic.h
+++ b/drivers/net/enic/enic.h
@@ -252,7 +252,7 @@ static inline unsigned int enic_cq_wq(struct enic *enic, unsigned int wq)
 
 static inline struct enic *pmd_priv(struct rte_eth_dev *eth_dev)
 {
-	return (struct enic *)eth_dev->data->dev_private;
+	return eth_dev->data->dev_private;
 }
 
 static inline uint32_t
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH 10/12] net/i40e: remove unnecessary cast
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
                   ` (8 preceding siblings ...)
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 09/12] net/enic: " Stephen Hemminger
@ 2019-05-29 19:14 ` Stephen Hemminger
  2019-05-29 19:15 ` [dpdk-dev] [PATCH 11/12] net/ixgbe: " Stephen Hemminger
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:14 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The device private pointer (dev_private) is of type void *
therefore no cast is necessary in C.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/i40e/i40e_ethdev.c | 24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index f4d778ea2df7..24b2ce245557 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1211,11 +1211,9 @@ i40e_parse_latest_vec_handler(__rte_unused const char *key,
 				const char *value,
 				void *opaque)
 {
-	struct i40e_adapter *ad;
+	struct i40e_adapter *ad = opaque;
 	int use_latest_vec;
 
-	ad = (struct i40e_adapter *)opaque;
-
 	use_latest_vec = atoi(value);
 
 	if (use_latest_vec != 0 && use_latest_vec != 1)
@@ -10843,8 +10841,7 @@ static void
 i40e_start_timecounters(struct rte_eth_dev *dev)
 {
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct i40e_adapter *adapter =
-			(struct i40e_adapter *)dev->data->dev_private;
+	struct i40e_adapter *adapter = dev->data->dev_private;
 	struct rte_eth_link link;
 	uint32_t tsync_inc_l;
 	uint32_t tsync_inc_h;
@@ -10896,8 +10893,7 @@ i40e_start_timecounters(struct rte_eth_dev *dev)
 static int
 i40e_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta)
 {
-	struct i40e_adapter *adapter =
-			(struct i40e_adapter *)dev->data->dev_private;
+	struct i40e_adapter *adapter = dev->data->dev_private;
 
 	adapter->systime_tc.nsec += delta;
 	adapter->rx_tstamp_tc.nsec += delta;
@@ -10910,8 +10906,7 @@ static int
 i40e_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *ts)
 {
 	uint64_t ns;
-	struct i40e_adapter *adapter =
-			(struct i40e_adapter *)dev->data->dev_private;
+	struct i40e_adapter *adapter = dev->data->dev_private;
 
 	ns = rte_timespec_to_ns(ts);
 
@@ -10927,8 +10922,7 @@ static int
 i40e_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts)
 {
 	uint64_t ns, systime_cycles;
-	struct i40e_adapter *adapter =
-			(struct i40e_adapter *)dev->data->dev_private;
+	struct i40e_adapter *adapter = dev->data->dev_private;
 
 	systime_cycles = i40e_read_systime_cyclecounter(dev);
 	ns = rte_timecounter_update(&adapter->systime_tc, systime_cycles);
@@ -11004,9 +10998,7 @@ i40e_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
 				struct timespec *timestamp, uint32_t flags)
 {
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct i40e_adapter *adapter =
-		(struct i40e_adapter *)dev->data->dev_private;
-
+	struct i40e_adapter *adapter = dev->data->dev_private;
 	uint32_t sync_status;
 	uint32_t index = flags & 0x03;
 	uint64_t rx_tstamp_cycles;
@@ -11028,9 +11020,7 @@ i40e_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 				struct timespec *timestamp)
 {
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct i40e_adapter *adapter =
-		(struct i40e_adapter *)dev->data->dev_private;
-
+	struct i40e_adapter *adapter = dev->data->dev_private;
 	uint32_t sync_status;
 	uint64_t tx_tstamp_cycles;
 	uint64_t ns;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH 11/12] net/ixgbe: remove unnecessary cast
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
                   ` (9 preceding siblings ...)
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 10/12] net/i40e: " Stephen Hemminger
@ 2019-05-29 19:15 ` Stephen Hemminger
  2019-06-05 14:28   ` Ferruh Yigit
  2019-05-29 19:15 ` [dpdk-dev] [PATCH 12/12] net/mlx5: " Stephen Hemminger
  2019-06-05 14:28 ` [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Ferruh Yigit
  12 siblings, 1 reply; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:15 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The device private pointer (dev_private) is of type void *
therefore no cast is necessary in C.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 33 +++++++++++---------------------
 drivers/net/ixgbe/ixgbe_rxtx.c   | 14 +++++---------
 2 files changed, 16 insertions(+), 31 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fae93bb29ffd..1d78085a9159 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -2408,8 +2408,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
 {
 	struct ixgbe_interrupt *intr =
 		IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
-	struct ixgbe_adapter *adapter =
-		(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter =dev->data->dev_private;
 	int ret;
 
 	PMD_INIT_FUNC_TRACE();
@@ -2817,8 +2816,7 @@ static void
 ixgbe_dev_stop(struct rte_eth_dev *dev)
 {
 	struct rte_eth_link link;
-	struct ixgbe_adapter *adapter =
-		(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter =dev->data->dev_private;
 	struct ixgbe_hw *hw =
 		IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct ixgbe_vf_info *vfinfo =
@@ -4815,8 +4813,7 @@ ixgbe_dev_rss_reta_update(struct rte_eth_dev *dev,
 	uint8_t j, mask;
 	uint32_t reta, r;
 	uint16_t idx, shift;
-	struct ixgbe_adapter *adapter =
-		(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter =dev->data->dev_private;
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint32_t reta_reg;
 
@@ -5049,8 +5046,7 @@ static int
 ixgbevf_dev_configure(struct rte_eth_dev *dev)
 {
 	struct rte_eth_conf *conf = &dev->data->dev_conf;
-	struct ixgbe_adapter *adapter =
-			(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 
 	PMD_INIT_LOG(DEBUG, "Configured Virtual Function port id: %d",
 		     dev->data->port_id);
@@ -5182,8 +5178,7 @@ static void
 ixgbevf_dev_stop(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct ixgbe_adapter *adapter =
-		(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter =dev->data->dev_private;
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 
@@ -6945,8 +6940,7 @@ static void
 ixgbe_start_timecounters(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct ixgbe_adapter *adapter =
-		(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter =dev->data->dev_private;
 	struct rte_eth_link link;
 	uint32_t incval = 0;
 	uint32_t shift = 0;
@@ -7014,8 +7008,7 @@ ixgbe_start_timecounters(struct rte_eth_dev *dev)
 static int
 ixgbe_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta)
 {
-	struct ixgbe_adapter *adapter =
-			(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 
 	adapter->systime_tc.nsec += delta;
 	adapter->rx_tstamp_tc.nsec += delta;
@@ -7028,8 +7021,7 @@ static int
 ixgbe_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *ts)
 {
 	uint64_t ns;
-	struct ixgbe_adapter *adapter =
-			(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 
 	ns = rte_timespec_to_ns(ts);
 	/* Set the timecounters to a new value. */
@@ -7044,8 +7036,7 @@ static int
 ixgbe_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts)
 {
 	uint64_t ns, systime_cycles;
-	struct ixgbe_adapter *adapter =
-			(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 
 	systime_cycles = ixgbe_read_systime_cyclecounter(dev);
 	ns = rte_timecounter_update(&adapter->systime_tc, systime_cycles);
@@ -7126,8 +7117,7 @@ ixgbe_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
 				 uint32_t flags __rte_unused)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct ixgbe_adapter *adapter =
-		(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter =dev->data->dev_private;
 	uint32_t tsync_rxctl;
 	uint64_t rx_tstamp_cycles;
 	uint64_t ns;
@@ -7148,8 +7138,7 @@ ixgbe_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
 				 struct timespec *timestamp)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct ixgbe_adapter *adapter =
-		(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter =dev->data->dev_private;
 	uint32_t tsync_txctl;
 	uint64_t tx_tstamp_cycles;
 	uint64_t ns;
diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c
index 4be7f72ab838..a8ce561e239a 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -2919,8 +2919,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 	struct ixgbe_rx_queue *rxq;
 	struct ixgbe_hw     *hw;
 	uint16_t len;
-	struct ixgbe_adapter *adapter =
-		(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	uint64_t offloads;
 
 	PMD_INIT_FUNC_TRACE();
@@ -3221,8 +3220,7 @@ void __attribute__((cold))
 ixgbe_dev_clear_queues(struct rte_eth_dev *dev)
 {
 	unsigned i;
-	struct ixgbe_adapter *adapter =
-		(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	PMD_INIT_FUNC_TRACE();
@@ -3485,7 +3483,7 @@ ixgbe_rss_configure(struct rte_eth_dev *dev)
 	uint32_t reta_reg;
 
 	PMD_INIT_FUNC_TRACE();
-	adapter = (struct ixgbe_adapter *)dev->data->dev_private;
+	adapter = dev->data->dev_private;
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	sp_reta_size = ixgbe_reta_size_get(hw->mac.type);
@@ -4630,8 +4628,7 @@ void __attribute__((cold))
 ixgbe_set_rx_function(struct rte_eth_dev *dev)
 {
 	uint16_t i, rx_using_sse;
-	struct ixgbe_adapter *adapter =
-		(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 
 	/*
 	 * In order to allow Vector Rx there are a few configuration
@@ -5309,8 +5306,7 @@ int __attribute__((cold))
 ixgbe_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
 	struct ixgbe_hw     *hw;
-	struct ixgbe_adapter *adapter =
-		(struct ixgbe_adapter *)dev->data->dev_private;
+	struct ixgbe_adapter *adapter = dev->data->dev_private;
 	struct ixgbe_rx_queue *rxq;
 	uint32_t rxdctl;
 	int poll_ms;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-dev] [PATCH 12/12] net/mlx5: remove unnecessary cast
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
                   ` (10 preceding siblings ...)
  2019-05-29 19:15 ` [dpdk-dev] [PATCH 11/12] net/ixgbe: " Stephen Hemminger
@ 2019-05-29 19:15 ` Stephen Hemminger
  2019-06-05 14:28 ` [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Ferruh Yigit
  12 siblings, 0 replies; 17+ messages in thread
From: Stephen Hemminger @ 2019-05-29 19:15 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

The device private pointer (dev_private) is of type void *
therefore no cast is necessary in C.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/mlx5/mlx5_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 98870184d06c..c03eb4c37606 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2156,7 +2156,7 @@ mlx5_flow_create(struct rte_eth_dev *dev,
 		 const struct rte_flow_action actions[],
 		 struct rte_flow_error *error)
 {
-	struct mlx5_priv *priv = (struct mlx5_priv *)dev->data->dev_private;
+	struct mlx5_priv *priv = dev->data->dev_private;
 
 	return flow_list_create(dev, &priv->flows,
 				attr, items, actions, error);
-- 
2.20.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH 04/12] net/bnxt: remove unnecessary cast
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 04/12] net/bnxt: " Stephen Hemminger
@ 2019-06-04 13:27   ` Lance Richardson
  0 siblings, 0 replies; 17+ messages in thread
From: Lance Richardson @ 2019-06-04 13:27 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

On Wed, May 29, 2019 at 3:15 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> The device private pointer (dev_private) is of type void *
> therefore no cast is necessary in C.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  drivers/net/bnxt/bnxt_ethdev.c  | 86 ++++++++++++++++-----------------
>  drivers/net/bnxt/bnxt_flow.c    | 10 ++--
>  drivers/net/bnxt/bnxt_irq.c     |  2 +-
>  drivers/net/bnxt/bnxt_rxq.c     |  6 +--
>  drivers/net/bnxt/bnxt_stats.c   |  6 +--
>  drivers/net/bnxt/bnxt_txq.c     |  2 +-
>  drivers/net/bnxt/bnxt_txr.c     |  4 +-
>  drivers/net/bnxt/rte_pmd_bnxt.c | 32 ++++++------
>  8 files changed, 74 insertions(+), 74 deletions(-)
>

Acked-by: Lance Richardson <lance.richardson@broadcom.com>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH 08/12] net/ena: remove unnecessary cast
  2019-05-29 19:14 ` [dpdk-dev] [PATCH 08/12] net/ena: remove unnecessary cast Stephen Hemminger
@ 2019-06-05 14:28   ` Ferruh Yigit
  0 siblings, 0 replies; 17+ messages in thread
From: Ferruh Yigit @ 2019-06-05 14:28 UTC (permalink / raw)
  To: Stephen Hemminger, dev

On 5/29/2019 8:14 PM, Stephen Hemminger wrote:
> The device private pointer (dev_private) is of type void *
> therefore no cast is necessary in C.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

<...>

> @@ -768,9 +765,7 @@ static int ena_link_update(struct rte_eth_dev *dev,
>  			   __rte_unused int wait_to_complete)
>  {
>  	struct rte_eth_link *link = &dev->data->dev_link;
> -	struct ena_adapter *adapter;
> -
> -	adapter = (struct ena_adapter *)(dev->data->dev_private);
> +	struct ena_adapter *adapter =dev->data->dev_private;

Needs space around "=", fixing while merging.

<...>

> @@ -2506,8 +2490,7 @@ static int ena_xstats_get(struct rte_eth_dev *dev,
>  			  struct rte_eth_xstat *xstats,
>  			  unsigned int n)
>  {
> -	struct ena_adapter *adapter =
> -			(struct ena_adapter *)(dev->data->dev_private);
> +	struct ena_adapter *adapter =dev->data->dev_private;

Needs space around "=", fixing while merging.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH 11/12] net/ixgbe: remove unnecessary cast
  2019-05-29 19:15 ` [dpdk-dev] [PATCH 11/12] net/ixgbe: " Stephen Hemminger
@ 2019-06-05 14:28   ` Ferruh Yigit
  0 siblings, 0 replies; 17+ messages in thread
From: Ferruh Yigit @ 2019-06-05 14:28 UTC (permalink / raw)
  To: Stephen Hemminger, dev

On 5/29/2019 8:15 PM, Stephen Hemminger wrote:
> The device private pointer (dev_private) is of type void *
> therefore no cast is necessary in C.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 33 +++++++++++---------------------
>  drivers/net/ixgbe/ixgbe_rxtx.c   | 14 +++++---------
>  2 files changed, 16 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index fae93bb29ffd..1d78085a9159 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -2408,8 +2408,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev)
>  {
>  	struct ixgbe_interrupt *intr =
>  		IXGBE_DEV_PRIVATE_TO_INTR(dev->data->dev_private);
> -	struct ixgbe_adapter *adapter =
> -		(struct ixgbe_adapter *)dev->data->dev_private;
> +	struct ixgbe_adapter *adapter =dev->data->dev_private;

Needs space around "=", fixing while merging, same for all occurrences below.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-dev] [PATCH 00/12] cleanup useless casts of void *
  2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
                   ` (11 preceding siblings ...)
  2019-05-29 19:15 ` [dpdk-dev] [PATCH 12/12] net/mlx5: " Stephen Hemminger
@ 2019-06-05 14:28 ` Ferruh Yigit
  12 siblings, 0 replies; 17+ messages in thread
From: Ferruh Yigit @ 2019-06-05 14:28 UTC (permalink / raw)
  To: Stephen Hemminger, dev

On 5/29/2019 8:14 PM, Stephen Hemminger wrote:
> Many DPDK drivers have unnecessary cast of the void * pointer
> dev->data->dev_private.
> 
> Stephen Hemminger (12):
>   net/atlantic: remove unnecessary cast
>   net/ark: remove unnecessary cast
>   net/axgbe: remove unnecessary cast
>   net/bnxt: remove unnecessary cast
>   net/bonding: remove unnecessary cast
>   net/cxgbe: remove unnecessary cast
>   net/e1000: remove unnecessary cast of void *
>   net/ena: remove unnecessary cast
>   net/enic: remove unnecessary cast
>   net/i40e: remove unnecessary cast
>   net/ixgbe: remove unnecessary cast
>   net/mlx5: remove unnecessary cast

For series
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Adding "Cc: stable@dpdk.org" to all, I think getting them into LTS reduces
conflicts later on those lines.

Series applied to dpdk-next-net/master, thanks.	


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-06-05 14:28 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 19:14 [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Stephen Hemminger
2019-05-29 19:14 ` [dpdk-dev] [PATCH 01/12] net/atlantic: remove unnecessary cast Stephen Hemminger
2019-05-29 19:14 ` [dpdk-dev] [PATCH 02/12] net/ark: " Stephen Hemminger
2019-05-29 19:14 ` [dpdk-dev] [PATCH 03/12] net/axgbe: " Stephen Hemminger
2019-05-29 19:14 ` [dpdk-dev] [PATCH 04/12] net/bnxt: " Stephen Hemminger
2019-06-04 13:27   ` Lance Richardson
2019-05-29 19:14 ` [dpdk-dev] [PATCH 05/12] net/bonding: " Stephen Hemminger
2019-05-29 19:14 ` [dpdk-dev] [PATCH 06/12] net/cxgbe: " Stephen Hemminger
2019-05-29 19:14 ` [dpdk-dev] [PATCH 07/12] net/e1000: remove unnecessary cast of void * Stephen Hemminger
2019-05-29 19:14 ` [dpdk-dev] [PATCH 08/12] net/ena: remove unnecessary cast Stephen Hemminger
2019-06-05 14:28   ` Ferruh Yigit
2019-05-29 19:14 ` [dpdk-dev] [PATCH 09/12] net/enic: " Stephen Hemminger
2019-05-29 19:14 ` [dpdk-dev] [PATCH 10/12] net/i40e: " Stephen Hemminger
2019-05-29 19:15 ` [dpdk-dev] [PATCH 11/12] net/ixgbe: " Stephen Hemminger
2019-06-05 14:28   ` Ferruh Yigit
2019-05-29 19:15 ` [dpdk-dev] [PATCH 12/12] net/mlx5: " Stephen Hemminger
2019-06-05 14:28 ` [dpdk-dev] [PATCH 00/12] cleanup useless casts of void * Ferruh Yigit

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).