[PATCH v3 3/3] media: verisilicon: Remove useless internal fields

Frank Li Frank.li at oss.nxp.com
Thu Sep 24 07:19:12 PDT 2026


On Thu, Sep 24, 2026 at 03:04:53PM +0200, Benjamin Gaignard wrote:
> No more variants are using multiple registers regions.
> Remove the useless fields and simplify driver code.
>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard at collabora.com>
> ---
>  drivers/media/platform/verisilicon/hantro.h   |  9 ++-------
>  .../media/platform/verisilicon/hantro_drv.c   | 20 +++++--------------
>  2 files changed, 7 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/platform/verisilicon/hantro.h
> index 0353de154a1e..ca03bc690fbf 100644
> --- a/drivers/media/platform/verisilicon/hantro.h
> +++ b/drivers/media/platform/verisilicon/hantro.h
> @@ -72,8 +72,6 @@ struct hantro_irq {
>   * @num_irqs:			number of irqs in the array
>   * @clk_names:			array of clock names
>   * @num_clocks:			number of clocks in the array
> - * @reg_names:			array of register range names
> - * @num_regs:			number of register range names in the array
>   * @double_buffer:		core needs double buffering
>   * @legacy_regs:		core uses legacy register set
>   * @late_postproc:		postproc must be set up at the end of the job
> @@ -97,8 +95,6 @@ struct hantro_variant {
>  	int num_irqs;
>  	const char * const *clk_names;
>  	int num_clocks;
> -	const char * const *reg_names;
> -	int num_regs;
>  	unsigned int double_buffer : 1;
>  	unsigned int legacy_regs : 1;
>  	unsigned int late_postproc : 1;
> @@ -184,7 +180,7 @@ hantro_vdev_to_func(struct video_device *vdev)
>   *			dev_ macros.
>   * @clocks:		Array of clock handles.
>   * @resets:		Array of reset handles.
> - * @reg_bases:		Mapped addresses of VPU registers.
> + * @reg_base:		Mapped address of VPU registers.
>   * @enc_base:		Mapped address of VPU encoder register for convenience.
>   * @dec_base:		Mapped address of VPU decoder register for convenience.
>   * @ctrl_base:		Mapped address of VPU control block.
> @@ -204,10 +200,9 @@ struct hantro_dev {
>  	struct device *dev;
>  	struct clk_bulk_data *clocks;
>  	struct reset_control *resets;
> -	void __iomem **reg_bases;
> +	void __iomem *reg_base;
>  	void __iomem *enc_base;
>  	void __iomem *dec_base;
> -	void __iomem *ctrl_base;
>
>  	struct mutex vpu_mutex;	/* video_device lock */
>  	spinlock_t irqlock;
> diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
> index 12c804dcc669..6e3a24156a69 100644
> --- a/drivers/media/platform/verisilicon/hantro_drv.c
> +++ b/drivers/media/platform/verisilicon/hantro_drv.c
> @@ -1080,7 +1080,6 @@ static int hantro_probe(struct platform_device *pdev)
>  {
>  	const struct of_device_id *match;
>  	struct hantro_dev *vpu;
> -	int num_bases;
>  	int i, ret;
>
>  	vpu = devm_kzalloc(&pdev->dev, sizeof(*vpu), GFP_KERNEL);
> @@ -1128,21 +1127,12 @@ static int hantro_probe(struct platform_device *pdev)
>  	if (IS_ERR(vpu->resets))
>  		return PTR_ERR(vpu->resets);
>
> -	num_bases = vpu->variant->num_regs ?: 1;
> -	vpu->reg_bases = devm_kcalloc(&pdev->dev, num_bases,
> -				      sizeof(*vpu->reg_bases), GFP_KERNEL);
> -	if (!vpu->reg_bases)
> -		return -ENOMEM;
> +	vpu->reg_base = devm_platform_ioremap_resource(pdev, 0);

Please descript reg_bases -> reg_base change in commit message, it is not
simpile remove.

Frank

> +	if (IS_ERR(vpu->reg_base))
> +		return PTR_ERR(vpu->reg_base);
>
> -	for (i = 0; i < num_bases; i++) {
> -		vpu->reg_bases[i] = vpu->variant->reg_names ?
> -		      devm_platform_ioremap_resource_byname(pdev, vpu->variant->reg_names[i]) :
> -		      devm_platform_ioremap_resource(pdev, 0);
> -		if (IS_ERR(vpu->reg_bases[i]))
> -			return PTR_ERR(vpu->reg_bases[i]);
> -	}
> -	vpu->enc_base = vpu->reg_bases[0] + vpu->variant->enc_offset;
> -	vpu->dec_base = vpu->reg_bases[0] + vpu->variant->dec_offset;
> +	vpu->enc_base = vpu->reg_base + vpu->variant->enc_offset;
> +	vpu->dec_base = vpu->reg_base + vpu->variant->dec_offset;
>
>  	/**
>  	 * TODO: Eventually allow taking advantage of full 64-bit address space.
> --
> 2.53.0
>
>



More information about the linux-arm-kernel mailing list