[PATCH 1/3] dmaengine/rio: rename dmaengine_prep_rio_sg() to dmaengine_prep_slave_sg_context()

From: Frank . Li

Date: Fri Nov 06 2026 - 17:43:44 EST


From: Frank Li <Frank.Li@xxxxxxx>

Generalize dmaengine_prep_rio_sg() by renaming it to
dmaengine_prep_slave_sg_context() and changing the context parameter type
from 'struct rio_dma_ext *' to 'void *', making it suitable for
any DMA engine user that needs to pass context to device_prep_slave_sg().

Remove the CONFIG_RAPIDIO_DMA_ENGINE guard so the helper is
unconditionally available.

Update drivers/rapidio/rio.c to use the new API.

No functional change. Prepare to make struct dma_device private to the DMA
engine.

Signed-off-by: Frank Li <Frank.Li@xxxxxxx>
---
Need go through DMA engineer tree to avoid build break.
---
drivers/rapidio/rio.c | 15 ++++++++-------
include/linux/dmaengine.h | 9 +++------
2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index f45e58b0971f5..9bba811f75da7 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -1804,20 +1804,21 @@ struct dma_async_tx_descriptor *rio_dma_prep_xfer(struct dma_chan *dchan,
u16 destid, struct rio_dma_data *data,
enum dma_transfer_direction direction, unsigned long flags)
{
+ struct dma_async_tx_descriptor *tx;
struct rio_dma_ext rio_ext;

- if (!dchan->device->device_prep_slave_sg) {
- pr_err("%s: prep_rio_sg == NULL\n", __func__);
- return NULL;
- }
-
rio_ext.destid = destid;
rio_ext.rio_addr_u = data->rio_addr_u;
rio_ext.rio_addr = data->rio_addr;
rio_ext.wr_type = data->wr_type;

- return dmaengine_prep_rio_sg(dchan, data->sg, data->sg_len,
- direction, flags, &rio_ext);
+ tx = dmaengine_prep_slave_sg_context(dchan, data->sg, data->sg_len,
+ direction, flags, &rio_ext);
+
+ if (!tx)
+ pr_err("%s: prep_rio_sg == NULL\n", __func__);
+
+ return tx;
}
EXPORT_SYMBOL_GPL(rio_dma_prep_xfer);

diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 9452bb2c04af7..d0906bcdabd6c 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1070,20 +1070,17 @@ dmaengine_prep_config_single_safe(struct dma_chan *chan, dma_addr_t buf,
return dmaengine_prep_config_sg_safe(chan, &sg, 1, dir, flags, config);
}

-#ifdef CONFIG_RAPIDIO_DMA_ENGINE
-struct rio_dma_ext;
-static inline struct dma_async_tx_descriptor *dmaengine_prep_rio_sg(
+static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_sg_context(
struct dma_chan *chan, struct scatterlist *sgl, unsigned int sg_len,
enum dma_transfer_direction dir, unsigned long flags,
- struct rio_dma_ext *rio_ext)
+ void *context)
{
if (!chan || !chan->device || !chan->device->device_prep_slave_sg)
return NULL;

return chan->device->device_prep_slave_sg(chan, sgl, sg_len,
- dir, flags, rio_ext);
+ dir, flags, context);
}
-#endif

static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,

--
2.43.0