All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jiaqi Shi" <shijiaqi_develop@163.com>, imx@lists.linux.dev
Cc: Frank.Li@kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH v3 2/2] media: v4l2-core: add frame interval monitor helper
Date: Sat, 21 Nov 2026 18:16:44 +0000	[thread overview]
Message-ID: <sashiko-outbox-227242@kernel.org> (raw)
In-Reply-To: <20261121180044.424315-3-shijiaqi_develop@163.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] media: v4l2-core: missing kernel-doc for new v4l2-fim public API
--

commit 70fa26e77e3e68f76d9d83df7734532469e6749d
Author: Jiaqi Shi <shijiaqi_develop@163.com>

media: v4l2-core: add frame interval monitor helper

This commit moves the generic frame interval monitoring implementation from
the i.MX staging media driver to v4l2-core as a reusable helper module.

> diff --git a/include/media/v4l2-fim.h b/include/media/v4l2-fim.h
> new file mode 100644
> index 0000000000000..e44dd4ac90105
> --- /dev/null
> +++ b/include/media/v4l2-fim.h
> @@ -0,0 +1,41 @@

[ ... ]

> +#define V4L2_FIM_NUM_CONTROLS	5
> +
> +struct v4l2_fim_config {
> +	u32 ctrl_base;
> +	u32 event_type;
> +	void *priv;
> +	bool (*external_timestamp)(void *priv, bool curval, bool use_val);
> +	void (*wait_first_timestamp)(void *priv);
> +};
> +
> +struct v4l2_fim *v4l2_fim_init(struct v4l2_subdev *sd,
> +			       struct v4l2_ctrl_handler *hdlr,
> +			       const struct v4l2_fim_config *config);
> +void v4l2_fim_reset(struct v4l2_fim *fim, bool curval, struct v4l2_ctrl *ctrl);
> +void v4l2_fim_set_stream(struct v4l2_fim *fim,
> +			 const struct v4l2_fract *frame_interval, bool on);
> +void v4l2_fim_eof_monitor(struct v4l2_fim *fim, ktime_t timestamp);
> +void v4l2_fim_monitor_timestamp(struct v4l2_fim *fim, ktime_t timestamp);
> +bool v4l2_fim_is_streaming(struct v4l2_fim *fim);
> +
> +#endif

[Severity: Low]
This isn't a bug, but the new public v4l2-core helper API has no kernel-doc
comments describing allocation, cleanup, or locking expectations:

- v4l2_fim_init() allocates struct v4l2_fim with devm_kzalloc(sd->dev, ...)
  and adds V4L2_FIM_NUM_CONTROLS controls starting at config->ctrl_base to
  hdlr, which the caller remains responsible for freeing with
  v4l2_ctrl_handler_free().
- config->external_timestamp() is called under spin_lock_irqsave(&fim->lock)
  with the control handler lock held, while config->wait_first_timestamp()
  is called from process context in v4l2_fim_set_stream() with
  v4l2_ctrl_lock() held.
- v4l2_fim_set_stream() acquires v4l2_ctrl_lock(), v4l2_fim_reset() and
  v4l2_fim_is_streaming() expect the caller to hold the control handler
  lock, and v4l2_fim_eof_monitor() / v4l2_fim_monitor_timestamp() acquire
  spin_lock_irqsave(&fim->lock) and may be called from interrupt context.

Also, reset_fim() invokes config->external_timestamp(fim->config.priv,
curval, !curval && !core_active); passing both curval and use_val is
redundant since the callback only needs a single boolean indicating whether
to read uncommitted control->val or committed control->cur.val.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261121180044.424315-1-shijiaqi_develop@163.com?part=2

      reply	other threads:[~2026-11-21 18:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21 18:00 [PATCH v3 0/2] media: imx: staging cleanup and FIM export to v4l2-core Jiaqi Shi
2026-11-21 18:00 ` [PATCH v3 1/2] media: imx: remove legacy video node control and format handling Jiaqi Shi
2026-11-21 18:21   ` sashiko-bot
2026-11-21 18:00 ` [PATCH v3 2/2] media: v4l2-core: add frame interval monitor helper Jiaqi Shi
2026-11-21 18:16   ` sashiko-bot [this message]

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=sashiko-outbox-227242@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=media-ci@linuxtv.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shijiaqi_develop@163.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.