Skip to contentSkip to conversation

drivers: dma: refactor: rename dma_ops to dma_device_ops.

PATCH Applied [email protected] 3 participants 4 messages Sep 14, 2025 – Sep 16, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: dma: refactor: rename dma_ops to dma_device_ops.

From: Chali Anis <[email protected]>

This patch is an esthetic cleanup, rename the dma_ops to dma_device_ops to be sure that the struct in drivers/dma is different from one used in arch/riscv/cpu. I accidentally faced the issue telling that the struct is defined in the two places but it is not supposed to happen since the the driver is never selected from riscv.

---
 drivers/dma/dma-devices.c      | 18 +++++++++---------
 drivers/dma/ti/k3-udma-am62l.c |  2 +-
 drivers/dma/ti/k3-udma.c       |  2 +-
 include/dma-devices.h          |  4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)
drivers/dma/dma-devices.c +9 -9
index a8b8086d5f86..43e585175a94 100644
@@ -35,7 +35,7 @@ static int dma_of_xlate_default(struct dma *dma,
 
 static int dma_request(struct device *dev, struct dma *dma)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_dbg(dma->dev, "%s(dev=%p, dma=%p)\n", __func__, dev, dma);
 
@@ -61,7 +61,7 @@ struct dma *dma_get_by_index(struct device *dev, int index)
 {
 	int ret;
 	struct of_phandle_args args;
-	const struct dma_ops *ops;
+	const struct dma_device_ops *ops;
 	struct dma *dma;
 	struct dma_device *dmad;
 
@@ -120,7 +120,7 @@ struct dma *dma_get_by_name(struct device *dev, const char *name)
 
 int dma_release(struct dma *dma)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_dbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
@@ -132,7 +132,7 @@ int dma_release(struct dma *dma)
 
 int dma_enable(struct dma *dma)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_dbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
@@ -144,7 +144,7 @@ int dma_enable(struct dma *dma)
 
 int dma_disable(struct dma *dma)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_dbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
@@ -156,7 +156,7 @@ int dma_disable(struct dma *dma)
 
 int dma_prepare_rcv_buf(struct dma *dma, dma_addr_t dst, size_t size)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_vdbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
@@ -168,7 +168,7 @@ int dma_prepare_rcv_buf(struct dma *dma, dma_addr_t dst, size_t size)
 
 int dma_receive(struct dma *dma, dma_addr_t *dst, void *metadata)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_vdbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
@@ -180,7 +180,7 @@ int dma_receive(struct dma *dma, dma_addr_t *dst, void *metadata)
 
 int dma_send(struct dma *dma, dma_addr_t src, size_t len, void *metadata)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_vdbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
@@ -192,7 +192,7 @@ int dma_send(struct dma *dma, dma_addr_t src, size_t len, void *metadata)
 
 int dma_get_cfg(struct dma *dma, u32 cfg_id, void **cfg_data)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_dbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
drivers/dma/ti/k3-udma-am62l.c +1 -1
index cd4a4cdf032f..ba54ba53e6d4 100644
@@ -408,7 +408,7 @@ static int am62l_udma_rfree(struct dma *dma)
 	return 0;
 }
 
-static const struct dma_ops am62l_udma_ops = {
+static const struct dma_device_ops am62l_udma_ops = {
 	.transfer	= udma_transfer,
 	.of_xlate	= udma_of_xlate,
 	.request	= am62l_udma_request,
drivers/dma/ti/k3-udma.c +1 -1
index fb0fe62c53a9..1f0594749549 100644
@@ -1190,7 +1190,7 @@ static int udma_rfree(struct dma *dma)
 	return 0;
 }
 
-static const struct dma_ops udma_ops = {
+static const struct dma_device_ops udma_ops = {
 	.transfer	= udma_transfer,
 	.of_xlate	= udma_of_xlate,
 	.request	= udma_request,
include/dma-devices.h +2 -2
index bbb25770f86b..bb081311dd72 100644
@@ -40,7 +40,7 @@ struct of_phandle_args;
  * The uclass interface is implemented by all DMA devices which use
  * driver model.
  */
-struct dma_ops {
+struct dma_device_ops {
 	/**
 	 * of_xlate - Translate a client's device-tree (OF) DMA specifier.
 	 *
@@ -155,7 +155,7 @@ struct dma_ops {
 
 struct dma_device {
 	struct device *dev;
-	const struct dma_ops *ops;
+	const struct dma_device_ops *ops;
 	struct list_head list;
 };
 
Signature · 1 line
2.34.1
Applied
#1 lore raw
Quoted 8 lines · On Sun, 14 Sep 2025 15:32:49 -0400, [email protected] wrote:

This patch is an esthetic cleanup, rename the dma_ops to dma_device_ops to be sure that the struct in drivers/dma is different from one used in arch/riscv/cpu. I accidentally faced the issue telling that the struct is defined in the two places but it is not supposed to happen since the the driver is never selected from riscv.

[...]

Applied, thanks!

[1/1] drivers: dma: refactor: rename dma_ops to dma_device_ops.
https://git.pengutronix.de/cgit/barebox/commit/?id=3226a3af468a (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>
#2 lore raw
In reply to [email protected]

Hi,

Quoted 7 lines · On 9/14/25 9:32 PM, [email protected] wrote:

From: Chali Anis <[email protected]>

This patch is an esthetic cleanup, rename the dma_ops to dma_device_ops to be sure that the struct in drivers/dma is different from one used in arch/riscv/cpu. I accidentally faced the issue telling that the struct is defined in the two places but it is not supposed to happen since the the driver is never selected from riscv.

If it's only about resolving the conflicting names, I'd rather rename dma_ops for RISC-V to dma_map_ops instead.

Cheers,
Ahmad

Quoted 142 lines
---
 drivers/dma/dma-devices.c      | 18 +++++++++---------
 drivers/dma/ti/k3-udma-am62l.c |  2 +-
 drivers/dma/ti/k3-udma.c       |  2 +-
 include/dma-devices.h          |  4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)
drivers/dma/dma-devices.c +9 -9
index a8b8086d5f86..43e585175a94 100644
@@ -35,7 +35,7 @@ static int dma_of_xlate_default(struct dma *dma,
 
 static int dma_request(struct device *dev, struct dma *dma)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_dbg(dma->dev, "%s(dev=%p, dma=%p)\n", __func__, dev, dma);
 
@@ -61,7 +61,7 @@ struct dma *dma_get_by_index(struct device *dev, int index)
 {
 	int ret;
 	struct of_phandle_args args;
-	const struct dma_ops *ops;
+	const struct dma_device_ops *ops;
 	struct dma *dma;
 	struct dma_device *dmad;
 
@@ -120,7 +120,7 @@ struct dma *dma_get_by_name(struct device *dev, const char *name)
 
 int dma_release(struct dma *dma)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_dbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
@@ -132,7 +132,7 @@ int dma_release(struct dma *dma)
 
 int dma_enable(struct dma *dma)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_dbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
@@ -144,7 +144,7 @@ int dma_enable(struct dma *dma)
 
 int dma_disable(struct dma *dma)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_dbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
@@ -156,7 +156,7 @@ int dma_disable(struct dma *dma)
 
 int dma_prepare_rcv_buf(struct dma *dma, dma_addr_t dst, size_t size)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_vdbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
@@ -168,7 +168,7 @@ int dma_prepare_rcv_buf(struct dma *dma, dma_addr_t dst, size_t size)
 
 int dma_receive(struct dma *dma, dma_addr_t *dst, void *metadata)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_vdbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
@@ -180,7 +180,7 @@ int dma_receive(struct dma *dma, dma_addr_t *dst, void *metadata)
 
 int dma_send(struct dma *dma, dma_addr_t src, size_t len, void *metadata)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_vdbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
@@ -192,7 +192,7 @@ int dma_send(struct dma *dma, dma_addr_t src, size_t len, void *metadata)
 
 int dma_get_cfg(struct dma *dma, u32 cfg_id, void **cfg_data)
 {
-	const struct dma_ops *ops = dma->dmad->ops;
+	const struct dma_device_ops *ops = dma->dmad->ops;
 
 	dev_dbg(dma->dev, "%s(dma=%p)\n", __func__, dma);
 
drivers/dma/ti/k3-udma-am62l.c +1 -1
index cd4a4cdf032f..ba54ba53e6d4 100644
@@ -408,7 +408,7 @@ static int am62l_udma_rfree(struct dma *dma)
 	return 0;
 }
 
-static const struct dma_ops am62l_udma_ops = {
+static const struct dma_device_ops am62l_udma_ops = {
 	.transfer	= udma_transfer,
 	.of_xlate	= udma_of_xlate,
 	.request	= am62l_udma_request,
drivers/dma/ti/k3-udma.c +1 -1
index fb0fe62c53a9..1f0594749549 100644
@@ -1190,7 +1190,7 @@ static int udma_rfree(struct dma *dma)
 	return 0;
 }
 
-static const struct dma_ops udma_ops = {
+static const struct dma_device_ops udma_ops = {
 	.transfer	= udma_transfer,
 	.of_xlate	= udma_of_xlate,
 	.request	= udma_request,
include/dma-devices.h +2 -2
index bbb25770f86b..bb081311dd72 100644
@@ -40,7 +40,7 @@ struct of_phandle_args;
  * The uclass interface is implemented by all DMA devices which use
  * driver model.
  */
-struct dma_ops {
+struct dma_device_ops {
 	/**
 	 * of_xlate - Translate a client's device-tree (OF) DMA specifier.
 	 *
@@ -155,7 +155,7 @@ struct dma_ops {
 
 struct dma_device {
 	struct device *dev;
-	const struct dma_ops *ops;
+	const struct dma_device_ops *ops;
 	struct list_head list;
 };
 
Signature · 4 lines
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |
#3 lore raw
Quoted 5 lines · Ahmad Fatoum

Hi,

Quoted 2 lines · On 9/14/25 9:32 PM, [email protected] wrote:

From: Chali Anis <[email protected]>

Quoted 8 lines
Quoted 5 lines

This patch is an esthetic cleanup, rename the dma_ops to dma_device_ops to be sure that the struct in drivers/dma is different from one used in arch/riscv/cpu. I accidentally faced the issue telling that the struct is defined in the two places but it is not supposed to happen since the the driver is never selected from riscv.

If it's only about resolving the conflicting names, I'd rather rename dma_ops for RISC-V to dma_map_ops instead.

I thought about this as well, but I actually like using dma_device_ops. We have a struct dma_device, so it's consistent to use a struct dma_device_ops * in there.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |