mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] media: m2m-deinterlace: replace direct ->device_prep*() calls with standard DMA engine API
@ 2026-09-17 19:04 Frank.Li
  2026-09-17 20:29 ` Laurent Pinchart
  0 siblings, 1 reply; 5+ messages in thread
From: Frank.Li @ 2026-09-17 19:04 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Hans Verkuil, Jacopo Mondi, Frank Li,
	Xu Rao, Kees Cook, Laurent Pinchart,
	open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB),
	open list
  Cc: imx, vkoul

From: Frank Li <Frank.Li@nxp.com>

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 <Frank.Li@nxp.com>
---
 drivers/media/platform/m2m-deinterlace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c
index 9dcc4bd6cbdd5..57a91ff2269f2 100644
--- a/drivers/media/platform/m2m-deinterlace.c
+++ b/drivers/media/platform/m2m-deinterlace.c
@@ -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;
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] media: m2m-deinterlace: replace direct ->device_prep*() calls with standard DMA engine API
  2026-09-17 19:04 [PATCH 1/1] media: m2m-deinterlace: replace direct ->device_prep*() calls with standard DMA engine API Frank.Li
@ 2026-09-17 20:29 ` Laurent Pinchart
  2026-09-17 20:33   ` Frank Li
  0 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2026-09-17 20:29 UTC (permalink / raw)
  To: Frank.Li
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Jacopo Mondi, Frank Li,
	Xu Rao, Kees Cook, open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB),
	open list, imx, vkoul

On Thu, Sep 17, 2026 at 03:04:16PM -0400, Frank.Li@oss.nxp.com wrote:
> From: Frank Li <Frank.Li@nxp.com>
> 
> 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 <Frank.Li@nxp.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

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 ? :-)

> ---
>  drivers/media/platform/m2m-deinterlace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c
> index 9dcc4bd6cbdd5..57a91ff2269f2 100644
> --- a/drivers/media/platform/m2m-deinterlace.c
> +++ b/drivers/media/platform/m2m-deinterlace.c
> @@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] media: m2m-deinterlace: replace direct ->device_prep*() calls with standard DMA engine API
  2026-09-17 20:29 ` Laurent Pinchart
@ 2026-09-17 20:33   ` Frank Li
  2026-09-17 20:37     ` Laurent Pinchart
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Li @ 2026-09-17 20:33 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Jacopo Mondi, Frank Li,
	Xu Rao, Kees Cook, open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB),
	open list, imx, vkoul

On Thu, Sep 17, 2026 at 11:29:31PM +0300, Laurent Pinchart wrote:
> On Thu, Sep 17, 2026 at 03:04:16PM -0400, Frank.Li@oss.nxp.com wrote:
> > From: Frank Li <Frank.Li@nxp.com>
> >
> > 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 <Frank.Li@nxp.com>
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> 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

>
> > ---
> >  drivers/media/platform/m2m-deinterlace.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c
> > index 9dcc4bd6cbdd5..57a91ff2269f2 100644
> > --- a/drivers/media/platform/m2m-deinterlace.c
> > +++ b/drivers/media/platform/m2m-deinterlace.c
> > @@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] media: m2m-deinterlace: replace direct ->device_prep*() calls with standard DMA engine API
  2026-09-17 20:33   ` Frank Li
@ 2026-09-17 20:37     ` Laurent Pinchart
  2026-09-17 21:19       ` Frank Li
  0 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2026-09-17 20:37 UTC (permalink / raw)
  To: Frank Li
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Jacopo Mondi, Frank Li,
	Xu Rao, Kees Cook, open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB),
	open list, imx, vkoul

On Thu, Sep 17, 2026 at 03:33:57PM -0500, Frank Li wrote:
> On Thu, Sep 17, 2026 at 11:29:31PM +0300, Laurent Pinchart wrote:
> > On Thu, Sep 17, 2026 at 03:04:16PM -0400, Frank.Li@oss.nxp.com wrote:
> > > From: Frank Li <Frank.Li@nxp.com>
> > >
> > > 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 <Frank.Li@nxp.com>
> >
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >
> > 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.

Thank you. A patch for checkpatch.pl to warn about new callers may also
be interesting.

> > > ---
> > >  drivers/media/platform/m2m-deinterlace.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c
> > > index 9dcc4bd6cbdd5..57a91ff2269f2 100644
> > > --- a/drivers/media/platform/m2m-deinterlace.c
> > > +++ b/drivers/media/platform/m2m-deinterlace.c
> > > @@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] media: m2m-deinterlace: replace direct ->device_prep*() calls with standard DMA engine API
  2026-09-17 20:37     ` Laurent Pinchart
@ 2026-09-17 21:19       ` Frank Li
  0 siblings, 0 replies; 5+ messages in thread
From: Frank Li @ 2026-09-17 21:19 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Jacopo Mondi, Frank Li,
	Xu Rao, Kees Cook, open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB),
	open list, imx, vkoul

On Thu, Sep 17, 2026 at 11:37:25PM +0300, Laurent Pinchart wrote:
> On Thu, Sep 17, 2026 at 03:33:57PM -0500, Frank Li wrote:
> > On Thu, Sep 17, 2026 at 11:29:31PM +0300, Laurent Pinchart wrote:
> > > On Thu, Sep 17, 2026 at 03:04:16PM -0400, Frank.Li@oss.nxp.com wrote:
> > > > From: Frank Li <Frank.Li@nxp.com>
> > > >
> > > > 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 <Frank.Li@nxp.com>
> > >
> > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > >
> > > 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.
>
> 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

>
> > > > ---
> > > >  drivers/media/platform/m2m-deinterlace.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c
> > > > index 9dcc4bd6cbdd5..57a91ff2269f2 100644
> > > > --- a/drivers/media/platform/m2m-deinterlace.c
> > > > +++ b/drivers/media/platform/m2m-deinterlace.c
> > > > @@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-17 21:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 19:04 [PATCH 1/1] media: m2m-deinterlace: replace direct ->device_prep*() calls with standard DMA engine API Frank.Li
2026-09-17 20:29 ` Laurent Pinchart
2026-09-17 20:33   ` Frank Li
2026-09-17 20:37     ` Laurent Pinchart
2026-09-17 21:19       ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®