Re: [PATCH v4 1/3] media: v4l2-mem2mem: Add a kref to the v4l2_m2m_dev structure
From: Ulf Hansson <hidden>
Date: 2026-01-06 13:28:58
Also in:
imx, linux-media, linux-pm, lkml
On Mon, 5 Jan 2026 at 19:08, Nicolas Dufresne [off-list ref] wrote:
Hi, Le mardi 30 décembre 2025 à 14:39 +0100, Ulf Hansson a écrit :quoted
On Fri, 5 Dec 2025 at 02:55, [off-list ref] wrote:quoted
From: Nicolas Dufresne <nicolas.dufresne@collabora.com> Adding a reference count to the v4l2_m2m_dev structure allow safely sharing it across multiple hardware nodes. This can be used to prevent running jobs concurrently on m2m cores that have some internal resource sharing. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Ming Qian <redacted>I certainly don't have the complete picture for how this needs to work. However, I was thinking that rather than using a kref and having to share two specific functions to update it (v4l2_m2m_get|put), couldn't we just use a device-link instead?The device link seems to be intended for power management, I'm effectively not familiar with it, so thanks for the information. However, my impression is that this is indented to describe power management dependencies on siblings, but this was done differently on this SoC (way before my time here), the DT seems to describe a block controller which is common to the two (defective) cores. So power management wise, its already handled. Be aware that my intent is to rename v4l2_m2m_dev into v4l2_m2m_sched. Its not a dev wrapper, but a helper object that will schedule work coming from N v4l2_m2m_ctx (per open() calls). Making this helper object ref counted makes the live-time management a lot simpler, and since its not a dev wrapper, this patch is not creating a second refcount for the same object.
Okay, fair enough. No objections from my side, [...] Kind regards Uffe