Re: [PATCH v1 7/7] media: verisilicon: mpeg4: Use alloc/free helpers for auxiliary buffers
From: Nicolas Dufresne
Date: Thu Nov 19 2026 - 17:02:12 EST
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@xxxxxxxxxxxxx>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@xxxxxxxxxxxxx>
> ---
> .../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);
> }
Attachment:
signature.asc
Description: This is a digitally signed message part