linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Detlev Casanova <detlev.casanova@collabora.com>,
	linux-kernel@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, kernel@collabora.com
Subject: Re: [PATCH v2 05/12] media: rkvdec: Add per variant configuration
Date: Mon, 11 Aug 2025 08:13:04 +0200	[thread overview]
Message-ID: <9fbc63d4-a12b-420e-8c99-f2f5fca5a9eb@kernel.org> (raw)
In-Reply-To: <20250808200340.156393-6-detlev.casanova@collabora.com>

On 08/08/2025 22:03, Detlev Casanova wrote:
> This is to prepare for adding different variants of the decoder and

Prepare for...

> support specific formats and ops.
> 
> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
> ---


...


>  static int rkvdec_init_ctrls(struct rkvdec_ctx *ctx)
>  {
> +	struct rkvdec_config *cfg = ctx->dev->config;
>  	unsigned int i, nctrls = 0;
>  	int ret;
>  
> -	for (i = 0; i < ARRAY_SIZE(rkvdec_coded_fmts); i++)
> -		nctrls += rkvdec_coded_fmts[i].ctrls->num_ctrls;
> +	for (i = 0; i < cfg->coded_fmts_num; i++)
> +		nctrls += cfg->coded_fmts[i].ctrls->num_ctrls;
>  
>  	v4l2_ctrl_handler_init(&ctx->ctrl_hdl, nctrls);
>  
> -	for (i = 0; i < ARRAY_SIZE(rkvdec_coded_fmts); i++) {
> -		ret = rkvdec_add_ctrls(ctx, rkvdec_coded_fmts[i].ctrls);
> +	for (i = 0; i < cfg->coded_fmts_num; i++) {
> +		ret = rkvdec_add_ctrls(ctx, cfg->coded_fmts[i].ctrls);
>  		if (ret)
>  			goto err_free_handler;
>  	}
> @@ -1119,8 +1127,13 @@ static void rkvdec_watchdog_func(struct work_struct *work)
>  	}
>  }
>  
> +const struct rkvdec_config config_rkvdec = {

Why isn't this static?

> +	.coded_fmts = (struct rkvdec_coded_fmt_desc *)rkvdec_coded_fmts,
> +	.coded_fmts_num = ARRAY_SIZE(rkvdec_coded_fmts),
> +};
> +
>  static const struct of_device_id of_rkvdec_match[] = {
> -	{ .compatible = "rockchip,rk3399-vdec" },
> +	{ .compatible = "rockchip,rk3399-vdec", .data = &config_rkvdec },
>  	{ /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, of_rkvdec_match);
> @@ -1144,6 +1157,9 @@ static int rkvdec_probe(struct platform_device *pdev)
>  	mutex_init(&rkvdec->vdev_lock);
>  	INIT_DELAYED_WORK(&rkvdec->watchdog_work, rkvdec_watchdog_func);
>  
> +	rkvdec->config =
> +		(struct rkvdec_config *)of_device_get_match_data(rkvdec->dev);

If you need a cast, your code is wrong.


Best regards,
Krzysztof


  reply	other threads:[~2025-08-11  6:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-08 20:03 [PATCH v2 00/12] media: rkvdec: Add support for VDPU381 and VDPU383 Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 01/12] media: rkvdec: Switch to using structs instead of writel Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 02/12] media: rkvdec: Move cabac table to its own source file Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 03/12] media: rkvdec: Use structs to represent the HW RPS Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 04/12] media: rkvdec: Move h264 functions to common file Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 05/12] media: rkvdec: Add per variant configuration Detlev Casanova
2025-08-11  6:13   ` Krzysztof Kozlowski [this message]
2025-08-11 13:52     ` Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 06/12] media: rkvdec: Add RCB and SRAM support Detlev Casanova
2025-08-11  6:13   ` Krzysztof Kozlowski
2025-08-11 13:54     ` Detlev Casanova
2025-08-11 14:01       ` Krzysztof Kozlowski
2025-08-11 18:44         ` Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 07/12] media: rkvdec: Support per-variant interrupt handler Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 08/12] media: rkvdec: Enable all clocks without naming them Detlev Casanova
2025-08-08 20:03 ` [PATCH v2 09/12] media: rkvdec: Add H264 support for the VDPU381 variant Detlev Casanova
2025-08-12 17:07   ` Dmitry Osipenko
2025-08-08 20:03 ` [PATCH v2 10/12] media: rkvdec: Add H264 support for the VDPU383 variant Detlev Casanova
2025-08-09 11:53   ` kernel test robot
2025-08-11 18:28   ` Nicolas Dufresne
2025-08-08 20:03 ` [PATCH v2 12/12] media: rkvdec: Add HEVC " Detlev Casanova
2025-08-11  9:56 ` [PATCH v2 00/12] media: rkvdec: Add support for VDPU381 and VDPU383 Heiko Stübner
2025-08-11 16:33   ` Detlev Casanova
2025-08-12  7:20 ` Piotr Oniszczuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9fbc63d4-a12b-420e-8c99-f2f5fca5a9eb@kernel.org \
    --to=krzk@kernel.org \
    --cc=detlev.casanova@collabora.com \
    --cc=heiko@sntech.de \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).