From: Stephen Hemminger Date: Wed, 29 May 2019 19:14:57 +0000 (-0700) Subject: net/ena: remove unnecessary cast X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=890728ff21d47960925bbee6b30ff6c50e6a8f46;p=dpdk.git net/ena: remove unnecessary cast The device private pointer (dev_private) is of type void * therefore no cast is necessary in C. Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger Reviewed-by: Ferruh Yigit --- diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index b6651fc0fd..ad9b131894 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 @@ err_start_tx: 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 @@ err_mmio_read_less: 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 @@ err: 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;