diff mbox series

[CATERPILLAR,v4,1/3] linux-gen: pktio: coding style fixup

Message ID 1516867212-18991-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [CATERPILLAR,v4,1/3] linux-gen: pktio: coding style fixup | expand

Commit Message

Github ODP bot Jan. 25, 2018, 8 a.m. UTC
From: Mykyta Iziumtsev <mykyta.iziumtsev@linaro.org>


Declare iterator variable used in "for" loop in containing scope
instead of "for" scope itself. Although it's valid C99 syntax and
"for" loop defines own scope it is still preferred to not use it in
OpenDataPlane code.

Signed-off-by: Mykyta Iziumtsev <mykyta.iziumtsev@linaro.org>

---
/** Email created from pull request 408 (MykytaI:caterpillar_mdev_e1000e)
 ** https://github.com/Linaro/odp/pull/408
 ** Patch: https://github.com/Linaro/odp/pull/408.patch
 ** Base sha: f87bb5146fb25f7cd62246500cb4f7e625375654
 ** Merge commit sha: 9ab7ecd5f9b053b699caa643dd1de3bbe19c850d
 **/
 platform/linux-generic/pktio/mdev/cxgb4.c | 6 ++++--
 platform/linux-generic/pktio/mdev/i40e.c  | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/pktio/mdev/cxgb4.c b/platform/linux-generic/pktio/mdev/cxgb4.c
index f09835d9f..5c55d87a4 100644
--- a/platform/linux-generic/pktio/mdev/cxgb4.c
+++ b/platform/linux-generic/pktio/mdev/cxgb4.c
@@ -509,20 +509,22 @@  static int cxgb4_open(odp_pktio_t id ODP_UNUSED,
 
 static int cxgb4_close(pktio_entry_t *pktio_entry)
 {
+	uint16_t i;
+
 	pktio_ops_cxgb4_data_t *pkt_cxgb4 = pktio_entry->s.ops_data;
 
 	ODP_DBG("%s: close %s\n", MODULE_NAME, pkt_cxgb4->mdev.if_name);
 
 	mdev_device_destroy(&pkt_cxgb4->mdev);
 
-	for (uint16_t i = 0; i < pkt_cxgb4->capa.max_input_queues; i++) {
+	for (i = 0; i < pkt_cxgb4->capa.max_input_queues; i++) {
 		cxgb4_rx_queue_t *rxq = &pkt_cxgb4->rx_queues[i];
 
 		if (rxq->rx_data.size)
 			mdev_dma_area_free(&pkt_cxgb4->mdev, &rxq->rx_data);
 	}
 
-	for (uint16_t i = 0; i < pkt_cxgb4->capa.max_output_queues; i++) {
+	for (i = 0; i < pkt_cxgb4->capa.max_output_queues; i++) {
 		cxgb4_tx_queue_t *txq = &pkt_cxgb4->tx_queues[i];
 
 		if (txq->tx_data.size)
diff --git a/platform/linux-generic/pktio/mdev/i40e.c b/platform/linux-generic/pktio/mdev/i40e.c
index 6f3b71712..f2be2bcf3 100644
--- a/platform/linux-generic/pktio/mdev/i40e.c
+++ b/platform/linux-generic/pktio/mdev/i40e.c
@@ -344,20 +344,22 @@  static int i40e_open(odp_pktio_t id ODP_UNUSED,
 
 static int i40e_close(pktio_entry_t *pktio_entry)
 {
+	uint16_t i;
+
 	pktio_ops_i40e_data_t *pkt_i40e = pktio_entry->s.ops_data;
 
 	ODP_DBG("%s: close %s\n", MODULE_NAME, pkt_i40e->mdev.if_name);
 
 	mdev_device_destroy(&pkt_i40e->mdev);
 
-	for (uint16_t i = 0; i < pkt_i40e->capa.max_input_queues; i++) {
+	for (i = 0; i < pkt_i40e->capa.max_input_queues; i++) {
 		i40e_rx_queue_t *rxq = &pkt_i40e->rx_queues[i];
 
 		if (rxq->rx_data.size)
 			mdev_dma_area_free(&pkt_i40e->mdev, &rxq->rx_data);
 	}
 
-	for (uint16_t i = 0; i < pkt_i40e->capa.max_output_queues; i++) {
+	for (i = 0; i < pkt_i40e->capa.max_output_queues; i++) {
 		i40e_tx_queue_t *txq = &pkt_i40e->tx_queues[i];
 
 		if (txq->tx_data.size)