media: m2m-deinterlace: replace direct ->device_prep*() calls with standard DMA engine API
Subsystems (2)
PATCH 1/1 media: m2m-deinterlace: replace direct ->device_prep*() calls with standard DMA engine API
From: Frank Li <[email protected]>
DMA engine consumers must not call the channel's device_prep_*() function pointers directly. Use the standard dmaengine wrapper APIs instead.
--- drivers/media/platform/m2m-deinterlace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/m2m-deinterlace.c +1 -1
@@ -330,7 +330,7 @@ static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op, ctx->xt->dst_sgl = true; flags =DMA_CTRL_ACK |DMA_PREP_INTERRUPT ; - tx = dmadev->device_prep_interleaved_dma (chan, ctx->xt, flags); + tx =dmaengine_prep_interleaved_dma (chan, ctx->xt, flags);if (tx ==NULL ) {v4l2_warn (&pcdev->v4l2_dev,"DMA interleaved prep error\n" );return ;
Signature · 1 line
2.43.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] media: m2m-deinterlace: unused variable dmadev --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] media: m2m-deinterlace: unused variable dmadev
--
commit e18b2f587554971f1ebf19a1e3732c9502cf2d48
Author: Frank Li <[email protected]>
media: m2m-deinterlace: replace direct ->device_prep*() calls with standard DMA engine API
This commit replaces direct invocations of the DMA engine channel's device_prep_*() function pointers with the standard dmaengine wrapper APIs.
drivers/media/platform/m2m-deinterlace.c static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op, · line 333
Quoted 10 lines
drivers/media/platform/m2m-deinterlace.c +1
-1@@ -330,7 +330,7 @@ static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op, ctx->xt->dst_sgl = true; flags =DMA_CTRL_ACK |DMA_PREP_INTERRUPT ; - tx = dmadev->device_prep_interleaved_dma (chan, ctx->xt, flags); + tx =dmaengine_prep_interleaved_dma (chan, ctx->xt, flags);
[Severity: Low]
Does this change leave dmadev as an unused variable?
Looking at deinterlace_issue_dma(), dmadev is declared and initialized earlier in the function:
struct dma_device *dmadev = chan->device;
With this change replacing the direct device_prep_interleaved_dma() invocation, it appears dmadev is no longer referenced anywhere else in the function, which could result in a build warning.
Quoted 3 lines
drivers/media/platform/m2m-deinterlace.c +0
-0if (tx ==NULL ) {v4l2_warn (&pcdev->v4l2_dev,"DMA interleaved prep error\n" );return ;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 6 lines · On Thu, Sep 17, 2026 at 03:04:16PM -0400, [email protected] wrote:
From: Frank Li <[email protected]>
DMA engine consumers must not call the channel's device_prep_*() function pointers directly. Use the standard dmaengine wrapper APIs instead.
Signed-off-by Frank Li <[email protected]>
I've checked the other DMA operations, and there are a few direct callers of .device_prep_dma_memcpy() and .device_prep_slave_sg(). The former should be easy to address, as the dmaengine_prep_dma_memcpy() wrapper is a drop-in replacement. The latter may be a bit more complicated.
Any volunteer to send patches ? :-)
Quoted 17 lines
--- drivers/media/platform/m2m-deinterlace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/m2m-deinterlace.c +1
-1@@ -330,7 +330,7 @@ static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op, ctx->xt->dst_sgl = true; flags =DMA_CTRL_ACK |DMA_PREP_INTERRUPT ; - tx = dmadev->device_prep_interleaved_dma (chan, ctx->xt, flags); + tx =dmaengine_prep_interleaved_dma (chan, ctx->xt, flags);if (tx ==NULL ) {v4l2_warn (&pcdev->v4l2_dev,"DMA interleaved prep error\n" );return ;
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 10 lines · Laurent Pinchart
Quoted 6 lines · On Thu, Sep 17, 2026 at 03:04:16PM -0400, [email protected] wrote:
From: Frank Li <[email protected]>
DMA engine consumers must not call the channel's device_prep_*() function pointers directly. Use the standard dmaengine wrapper APIs instead.
Signed-off-by Frank Li <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>
Quoted 7 lines
I've checked the other DMA operations, and there are a few direct callers of .device_prep_dma_memcpy() and .device_prep_slave_sg(). The former should be easy to address, as the
dmaengine_prep_dma_memcpy()wrapper is a drop-in replacement. The latter may be a bit more complicated.Any volunteer to send patches ? :-)
I already sent out and try to cleanup all.
Frank
Quoted 23 lines
Quoted 10 lines
--- drivers/media/platform/m2m-deinterlace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/m2m-deinterlace.c +0
-0drivers/media/platform/m2m-deinterlace.c static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op, · line 336
Quoted 8 lines
drivers/media/platform/m2m-deinterlace.c +1
-1@@ -330,7 +330,7 @@ static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op, ctx->xt->dst_sgl = true; flags =DMA_CTRL_ACK |DMA_PREP_INTERRUPT ; - tx = dmadev->device_prep_interleaved_dma (chan, ctx->xt, flags); + tx =dmaengine_prep_interleaved_dma (chan, ctx->xt, flags);if (tx ==NULL ) {v4l2_warn (&pcdev->v4l2_dev,"DMA interleaved prep error\n" );return ;--
Regards,Laurent Pinchart
Quoted 17 lines · Frank Li
Quoted 16 lines · Laurent Pinchart
Quoted 6 lines · On Thu, Sep 17, 2026 at 03:04:16PM -0400, [email protected] wrote:
From: Frank Li <[email protected]>
DMA engine consumers must not call the channel's device_prep_*() function pointers directly. Use the standard dmaengine wrapper APIs instead.
Signed-off-by Frank Li <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>I've checked the other DMA operations, and there are a few direct callers of .device_prep_dma_memcpy() and .device_prep_slave_sg(). The former should be easy to address, as the
dmaengine_prep_dma_memcpy()wrapper is a drop-in replacement. The latter may be a bit more complicated.
Quoted 3 lines
Quoted 1 line
Any volunteer to send patches ? :-)
I already sent out and try to cleanup all.
Thank you. A patch for checkpatch.pl to warn about new callers may also be interesting.
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
--- drivers/media/platform/m2m-deinterlace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/m2m-deinterlace.c +1
-1@@ -330,7 +330,7 @@ static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op, ctx->xt->dst_sgl = true; flags =DMA_CTRL_ACK |DMA_PREP_INTERRUPT ; - tx = dmadev->device_prep_interleaved_dma (chan, ctx->xt, flags); + tx =dmaengine_prep_interleaved_dma (chan, ctx->xt, flags);if (tx ==NULL ) {v4l2_warn (&pcdev->v4l2_dev,"DMA interleaved prep error\n" );return ;
Signature · 3 lines
Regards, Laurent Pinchart
Quoted 18 lines · Laurent Pinchart
Quoted 17 lines · Frank Li
Quoted 16 lines · Laurent Pinchart
Quoted 6 lines · On Thu, Sep 17, 2026 at 03:04:16PM -0400, [email protected] wrote:
From: Frank Li <[email protected]>
DMA engine consumers must not call the channel's device_prep_*() function pointers directly. Use the standard dmaengine wrapper APIs instead.
Signed-off-by Frank Li <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>I've checked the other DMA operations, and there are a few direct callers of .device_prep_dma_memcpy() and .device_prep_slave_sg(). The former should be easy to address, as the
dmaengine_prep_dma_memcpy()wrapper is a drop-in replacement. The latter may be a bit more complicated.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Any volunteer to send patches ? :-)
I already sent out and try to cleanup all.
Thank you. A patch for checkpatch.pl to warn about new callers may also be interesting.
Long term plan to move dmaengine callback to private header, build will failure if consumer try to access dmaengine device.
Frank
Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
--- drivers/media/platform/m2m-deinterlace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/m2m-deinterlace.c +0
-0@@ -330,7 +330,7 @@ static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op, ctx->xt->dst_sgl = true; flags =DMA_CTRL_ACK |DMA_PREP_INTERRUPT ;Quoted 5 lines
Quoted 5 lines
drivers/media/platform/m2m-deinterlace.c static void deinterlace_issue_dma(struct deinterlace_ctx *ctx, int op, · line 336
Quoted 5 lines
drivers/media/platform/m2m-deinterlace.c +1
-1- tx = dmadev->device_prep_interleaved_dma (chan, ctx->xt, flags); + tx =dmaengine_prep_interleaved_dma (chan, ctx->xt, flags);if (tx ==NULL ) {v4l2_warn (&pcdev->v4l2_dev,"DMA interleaved prep error\n" );return ;--
Regards,Laurent Pinchart