diff mbox series

[1/2] media: v4l: async: Add v4l2_async_nf_unregister_cleanup

Message ID 20240502-master-v1-1-8bd109c6a3ba@collabora.com
State New
Headers show
Series Introduce v4l2_async_nf_unregister_cleanup | expand

Commit Message

Julien Massot May 2, 2024, 3:22 p.m. UTC
Many drivers are calling v4l2_async_nf_unregister, and
v4l2_async_nf_cleanup, add a function to do it.

Suggested-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Julien Massot <julien.massot@collabora.com>
---
 include/media/v4l2-async.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff mbox series

Patch

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