[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PN3P287MB1829D71FB3C2B41FF28D6A198B5FA@PN3P287MB1829.INDP287.PROD.OUTLOOK.COM>
Date: Wed, 23 Jul 2025 14:08:03 +0000
From: Tarang Raval <tarang.raval@...iconsignals.io>
To: Laurent Pinchart <laurent.pinchart@...asonboard.com>
CC: "sakari.ailus@...ux.intel.com" <sakari.ailus@...ux.intel.com>,
"hverkuil@...all.nl" <hverkuil@...all.nl>, Mauro Carvalho Chehab
<mchehab@...nel.org>, Ricardo Ribalda <ribalda@...omium.org>, Hans de Goede
<hansg@...nel.org>, James Cowgill <james.cowgill@...ize.com>, Yunke Cao
<yunkec@...gle.com>, Tomi Valkeinen <tomi.valkeinen@...asonboard.com>, Lad
Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>, Tommaso Merciai
<tomm.merciai@...il.com>, "linux-media@...r.kernel.org"
<linux-media@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 0/4] media: Add devm-managed helper functions for media
and V4L2 subsystems
Hi Laurent,
> On Wed, Jul 23, 2025 at 03:55:04PM +0530, Tarang Raval wrote:
> > This patch series introduces devm-managed versions of several commonly used
> > media and V4L2 initialization functions. These helpers simplify resource
> > management by leveraging the devres infrastructure, ensuring automatic
> > cleanup when the associated device is detached or the driver is unloaded.
>
> I'll let Sakari review this, but overall, I don't think we want to take
> this direction. Objects need to be refcounted instead of freed at remove
> time.
I agree that refcounting could provide more robust lifetime management,
especially for shared resources. I will think in this direction, explore
implementing refcounting for these objects, and share an RFC for your
feedback.
> This patch series doesn't necessarily cause a regression as such,
> but it will make it more difficult to fix life time management issues in
> V4L2.
Could you clarify how devm-managed helpers might complicate lifetime
management in V4L2? Understanding specific issues will help me design
a solution that aligns with the subsystem’s needs while keeping cleanup
simple.
Best Regards,
Tarang
> > Tested with IMX219 and OV2735 camera sensors on an i.MX8MP-based platform.
> >
> > Tarang Raval (4):
> > media: mc: Add devm_media_entity_pads_init() helper
> > media: v4l: async: Add devm_v4l2_async_register_subdev_sensor() helper
> > media: v4l2: subdev: Add devm_v4l2_subdev_init_finalize() helper
> > media: v4l2-ctrls: Add devm_v4l2_ctrl_handler_init() helper
> >
> > drivers/media/mc/mc-entity.c | 19 +++++++++++++++++++
> > drivers/media/v4l2-core/v4l2-async.c | 19 +++++++++++++++++++
> > drivers/media/v4l2-core/v4l2-ctrls-core.c | 20 ++++++++++++++++++++
> > drivers/media/v4l2-core/v4l2-subdev.c | 18 ++++++++++++++++++
> > include/media/media-entity.h | 20 ++++++++++++++++++++
> > include/media/v4l2-async.h | 18 ++++++++++++++++++
> > include/media/v4l2-ctrls.h | 19 +++++++++++++++++++
> > include/media/v4l2-subdev.h | 17 +++++++++++++++++
> > 8 files changed, 150 insertions(+)
> >
>
> --
> Regards,
>
> Laurent Pinchart
Powered by blists - more mailing lists