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

Nicolas Dufresne nicolas.dufresne at collabora.com
Thu Nov 19 13:59:42 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>

> ---
>  drivers/media/platform/verisilicon/hantro_h264.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/platform/verisilicon/hantro_h264.c b/drivers/media/platform/verisilicon/hantro_h264.c
> index 2414782f1eb6..68dde1cd1ac2 100644
> --- a/drivers/media/platform/verisilicon/hantro_h264.c
> +++ b/drivers/media/platform/verisilicon/hantro_h264.c
> @@ -494,26 +494,21 @@ int hantro_h264_dec_prepare_run(struct hantro_ctx *ctx)
>  
>  void hantro_h264_dec_exit(struct hantro_ctx *ctx)
>  {
> -	struct hantro_dev *vpu = ctx->dev;
>  	struct hantro_h264_dec_hw_ctx *h264_dec = &ctx->h264_dec;
>  	struct hantro_aux_buf *priv = &h264_dec->priv;
>  
> -	dma_free_coherent(vpu->dev, priv->size, priv->cpu, priv->dma);
> +	hantro_free_aux_buf(ctx, priv);
>  }
>  
>  int hantro_h264_dec_init(struct hantro_ctx *ctx)
>  {
> -	struct hantro_dev *vpu = ctx->dev;
>  	struct hantro_h264_dec_hw_ctx *h264_dec = &ctx->h264_dec;
>  	struct hantro_aux_buf *priv = &h264_dec->priv;
>  	struct hantro_h264_dec_priv_tbl *tbl;
>  
> -	priv->cpu = dma_alloc_coherent(vpu->dev, sizeof(*tbl), &priv->dma,
> -				       GFP_KERNEL);
> -	if (!priv->cpu)
> +	if (hantro_allocate_aux_buf(ctx, priv, sizeof(*tbl)))
>  		return -ENOMEM;
>  
> -	priv->size = sizeof(*tbl);
>  	tbl = priv->cpu;
>  	memcpy(tbl->cabac_table, h264_cabac_table, sizeof(tbl->cabac_table));
>  
-------------- 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/642f1e6a/attachment.sig>


More information about the Linux-rockchip mailing list