DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: hemant.agrawal@nxp.com, Sachin Saxena <sachin.saxena@nxp.com>,
	Gagandeep Singh <g.singh@nxp.com>
Subject: [PATCH 2/3] dma/dpaa: remove dmadev pointer from bus device
Date: Thu, 11 Jun 2026 15:07:36 +0200	[thread overview]
Message-ID: <20260611130738.1720628-3-david.marchand@redhat.com> (raw)
In-Reply-To: <20260611130738.1720628-1-david.marchand@redhat.com>

A driver .dev_close op is automatically called when releasing a dma
device.
Move device specific unitialisation in this driver .dev_close op.

This leaves no user of the dmadev field in the dpaa device object.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/dpaa/bus_dpaa_driver.h |  1 -
 drivers/dma/dpaa/dpaa_qdma.c       | 39 +++++++++++++++---------------
 2 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/bus/dpaa/bus_dpaa_driver.h b/drivers/bus/dpaa/bus_dpaa_driver.h
index 6759792eea..0642aee14a 100644
--- a/drivers/bus/dpaa/bus_dpaa_driver.h
+++ b/drivers/bus/dpaa/bus_dpaa_driver.h
@@ -82,7 +82,6 @@ struct rte_dpaa_device {
 	struct rte_device device;
 	union {
 		struct rte_eth_dev *eth_dev;
-		struct rte_dma_dev *dmadev;
 	};
 	struct dpaa_device_id id;
 	struct rte_intr_handle *intr_handle;
diff --git a/drivers/dma/dpaa/dpaa_qdma.c b/drivers/dma/dpaa/dpaa_qdma.c
index 74e23d2ee5..a695f58bc5 100644
--- a/drivers/dma/dpaa/dpaa_qdma.c
+++ b/drivers/dma/dpaa/dpaa_qdma.c
@@ -965,8 +965,24 @@ dpaa_qdma_start(__rte_unused struct rte_dma_dev *dev)
 }
 
 static int
-dpaa_qdma_close(__rte_unused struct rte_dma_dev *dev)
+dpaa_qdma_close(struct rte_dma_dev *dmadev)
 {
+	struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private;
+	uint32_t i, j, regs_size;
+
+	regs_size = fsl_qdma->block_offset * fsl_qdma->num_blocks;
+	regs_size += (QDMA_CTRL_REGION_SIZE + QDMA_STATUS_REGION_SIZE);
+
+	for (i = 0; i < QDMA_BLOCKS; i++)
+		fsl_qdma_free_stq_res(&fsl_qdma->stat_queues[i]);
+
+	for (i = 0; i < QDMA_BLOCKS; i++) {
+		for (j = 0; j < QDMA_QUEUES; j++)
+			fsl_qdma_free_cmdq_res(&fsl_qdma->cmd_queues[i][j]);
+	}
+
+	munmap(fsl_qdma->ctrl_base, regs_size);
+
 	return 0;
 }
 
@@ -1420,7 +1436,6 @@ dpaa_qdma_probe(__rte_unused struct rte_dpaa_driver *dpaa_drv,
 		return -EINVAL;
 	}
 
-	dpaa_dev->dmadev = dmadev;
 	dmadev->dev_ops = &dpaa_qdma_ops;
 	dmadev->device = &dpaa_dev->device;
 	dmadev->fp_obj->dev_private = dmadev->data->dev_private;
@@ -1445,24 +1460,8 @@ dpaa_qdma_probe(__rte_unused struct rte_dpaa_driver *dpaa_drv,
 static int
 dpaa_qdma_remove(struct rte_dpaa_device *dpaa_dev)
 {
-	struct rte_dma_dev *dmadev = dpaa_dev->dmadev;
-	struct fsl_qdma_engine *fsl_qdma = dmadev->data->dev_private;
-	uint32_t i, j, regs_size;
-
-	regs_size = fsl_qdma->block_offset * fsl_qdma->num_blocks;
-	regs_size += (QDMA_CTRL_REGION_SIZE + QDMA_STATUS_REGION_SIZE);
-
-	for (i = 0; i < QDMA_BLOCKS; i++)
-		fsl_qdma_free_stq_res(&fsl_qdma->stat_queues[i]);
-
-	for (i = 0; i < QDMA_BLOCKS; i++) {
-		for (j = 0; j < QDMA_QUEUES; j++)
-			fsl_qdma_free_cmdq_res(&fsl_qdma->cmd_queues[i][j]);
-	}
-
-	munmap(fsl_qdma->ctrl_base, regs_size);
-
-	(void)rte_dma_pmd_release(dpaa_dev->device.name);
+	if (rte_dma_pmd_release(dpaa_dev->device.name))
+		DPAA_QDMA_ERR("Device cleanup failed");
 
 	return 0;
 }
-- 
2.53.0


  parent reply	other threads:[~2026-06-11 13:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 13:07 [PATCH 0/3] Cleanup rte_dpaa_device David Marchand
2026-06-11 13:07 ` [PATCH 1/3] crypto/dpaa_sec: remove cryptodev pointer from bus device David Marchand
2026-06-11 13:07 ` David Marchand [this message]
2026-06-11 13:07 ` [PATCH 3/3] net/dpaa: remove ethdev " David Marchand
2026-06-25 11:23 ` [PATCH 0/3] Cleanup rte_dpaa_device David Marchand

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20260611130738.1720628-3-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=g.singh@nxp.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=sachin.saxena@nxp.com \
    /path/to/YOUR_REPLY

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

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