From 57cb848f004820a88279f91ca108af33554cd38e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 14 Jun 2022 20:10:48 +0100 Subject: media: v4l2-async: Add notifier operation to destroy asd instances Drivers typically extend the v4l2_async_subdev structure by embedding it in a driver-specific structure, to store per-subdev custom data. The v4l2_async_subdev instances are freed by the v4l2-async framework, which makes this mechanism cumbersome to use safely when custom data needs special treatment to be destroyed (such as freeing additional memory, or releasing references to kernel objects). To ease this, add a .destroy() operation to the v4l2_async_notifier_operations structure. The operation is called right before the v4l2_async_subdev is freed, giving drivers a chance to destroy data if needed. Signed-off-by: Laurent Pinchart Reviewed-by: Hans Verkuil Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-async.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/media/v4l2-async.h') diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h index 13ff3ad948f4..25eb1d138c06 100644 --- a/include/media/v4l2-async.h +++ b/include/media/v4l2-async.h @@ -81,6 +81,7 @@ struct v4l2_async_subdev { * @complete: All subdevices have been probed successfully. The complete * callback is only executed for the root notifier. * @unbind: a subdevice is leaving + * @destroy: the asd is about to be freed */ struct v4l2_async_notifier_operations { int (*bound)(struct v4l2_async_notifier *notifier, @@ -90,6 +91,7 @@ struct v4l2_async_notifier_operations { void (*unbind)(struct v4l2_async_notifier *notifier, struct v4l2_subdev *subdev, struct v4l2_async_subdev *asd); + void (*destroy)(struct v4l2_async_subdev *asd); }; /** -- cgit v1.2.3-59-g8ed1b