2024-05-02 15:33:46

by Julien Massot

[permalink] [raw]
Subject: [PATCH 1/2] media: v4l: async: Add v4l2_async_nf_unregister_cleanup

Many drivers are calling v4l2_async_nf_unregister, and
v4l2_async_nf_cleanup, add a function to do it.

Suggested-by: Sakari Ailus <[email protected]>
Signed-off-by: Julien Massot <[email protected]>
---
include/media/v4l2-async.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
index f26c323e9c96..cdbe63c26779 100644
--- a/include/media/v4l2-async.h
+++ b/include/media/v4l2-async.h
@@ -304,6 +304,23 @@ void v4l2_async_nf_unregister(struct v4l2_async_notifier *notifier);
*/
void v4l2_async_nf_cleanup(struct v4l2_async_notifier *notifier);

+/**
+ * v4l2_async_nf_unregister_cleanup - unregister and clean up notifier resources
+ * @notifier: the notifier the notifier to unregister and for which
+ * the resources are to be cleaned up
+ *
+ * Unregister a subdevice asynchronous device and release memory resources
+ * related to a notifier.
+ * Convenient function to call v4l2_async_nf_unregister() and
+ * v4l2_async_nf_cleanup().
+ */
+static inline void
+v4l2_async_nf_unregister_cleanup(struct v4l2_async_notifier *notifier)
+{
+ v4l2_async_nf_unregister(notifier);
+ v4l2_async_nf_cleanup(notifier);
+};
+
/**
* v4l2_async_register_subdev - registers a sub-device to the asynchronous
* subdevice framework

--
2.44.0