[dpdk-dev] [PATCH 02/12] net/ark: remove unnecessary cast

Stephen Hemminger stephen at networkplumber.org
Wed May 29 21:14:51 CEST 2019


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

Signed-off-by: Stephen Hemminger <stephen at 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



More information about the dev mailing list