[PATCH v1 7/7] media: verisilicon: mpeg4: Use alloc/free helpers for auxiliary buffers

Nicolas Dufresne nicolas.dufresne at collabora.com
Thu Nov 19 14:01:53 PST 2026


Le mercredi 16 septembre 2026 à 14:54 +0200, Benjamin Gaignard a écrit :
> Simplify and clean up the code by using the helpers.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard at collabora.com>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>

> ---
>  .../media/platform/verisilicon/hantro_mpeg2.c   | 17 ++---------------
>  1 file changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/media/platform/verisilicon/hantro_mpeg2.c b/drivers/media/platform/verisilicon/hantro_mpeg2.c
> index 04e545eb0a83..f21115e6bdbe 100644
> --- a/drivers/media/platform/verisilicon/hantro_mpeg2.c
> +++ b/drivers/media/platform/verisilicon/hantro_mpeg2.c
> @@ -37,25 +37,12 @@ void hantro_mpeg2_dec_copy_qtable(u8 *qtable,
>  
>  int hantro_mpeg2_dec_init(struct hantro_ctx *ctx)
>  {
> -	struct hantro_dev *vpu = ctx->dev;
> -
> -	ctx->mpeg2_dec.qtable.size = ARRAY_SIZE(zigzag) * 4;
> -	ctx->mpeg2_dec.qtable.cpu =
> -		dma_alloc_coherent(vpu->dev,
> -				   ctx->mpeg2_dec.qtable.size,
> -				   &ctx->mpeg2_dec.qtable.dma,
> -				   GFP_KERNEL);
> -	if (!ctx->mpeg2_dec.qtable.cpu)
> +	if (hantro_allocate_aux_buf(ctx, &ctx->mpeg2_dec.qtable, ARRAY_SIZE(zigzag) * 4))
>  		return -ENOMEM;
>  	return 0;
>  }
>  
>  void hantro_mpeg2_dec_exit(struct hantro_ctx *ctx)
>  {
> -	struct hantro_dev *vpu = ctx->dev;
> -
> -	dma_free_coherent(vpu->dev,
> -			  ctx->mpeg2_dec.qtable.size,
> -			  ctx->mpeg2_dec.qtable.cpu,
> -			  ctx->mpeg2_dec.qtable.dma);
> +	hantro_free_aux_buf(ctx, &ctx->mpeg2_dec.qtable);
>  }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-rockchip/attachments/20261119/abc98e96/attachment.sig>


More information about the Linux-rockchip mailing list