History

media: vb2: remove vb2_ops_wait_prepare/finish helpers

Since vb2 now relies on the presence of the vb2_queue lock field and there are no more drivers that use these helpers, it is safe to drop them.

Hans Verkuil committed 1 year ago

Commit d0730001 parent cbb5cd43 files · +4 −36Browse files

Unified · Split

3 files
  1. Documentation/driver-api/media/v4l2-dev.rst +4 −4
  2. drivers/media/common/videobuf2/videobuf2-v4l2.c +0 −14
  3. include/media/videobuf2-v4l2.h +0 −18
Documentation/driver-api/media/v4l2-dev.rst+4−4
@@ -157,10 +157,10 @@ changing the e.g. exposure of the webcam. · 156 unmodified lines
157157 Of course, you can always do all the locking yourself by leaving both lock
158158 pointers at ``NULL``.
159159
160−In the case of :ref:`videobuf2 <vb2_framework>` you will need to implement the
161−``wait_prepare()`` and ``wait_finish()`` callbacks to unlock/lock if applicable.
162−If you use the ``queue->lock`` pointer, then you can use the helper functions
163−:c:func:`vb2_ops_wait_prepare` and :c:func:`vb2_ops_wait_finish`.
160+In the case of :ref:`videobuf2 <vb2_framework>` you must set the ``queue->lock``
161+pointer to the lock you use to serialize the queuing ioctls. This ensures that
162+that lock is released while waiting in ``VIDIOC_DQBUF`` for a buffer to arrive,
163+and it is retaken afterwards.
164164
165165 The implementation of a hotplug disconnect should also take the lock from
166166 :c:type:`video_device` before calling v4l2_device_disconnect. If you are also
drivers/media/common/videobuf2/videobuf2-v4l2.c+0−14
@@ -1302,20 +1302,6 @@ void vb2_video_unregister_device(struct video_device *vdev) · 1301 unmodified lines
13021302 }
13031303 EXPORT_SYMBOL_GPL(vb2_video_unregister_device);
13041304
1305−/* vb2_ops helpers. Only use if vq->lock is non-NULL. */
1306−
1307−void vb2_ops_wait_prepare(struct vb2_queue *vq)
1308−{
1309− mutex_unlock(vq->lock);
1310−}
1311−EXPORT_SYMBOL_GPL(vb2_ops_wait_prepare);
1312−
1313−void vb2_ops_wait_finish(struct vb2_queue *vq)
1314−{
1315− mutex_lock(vq->lock);
1316−}
1317−EXPORT_SYMBOL_GPL(vb2_ops_wait_finish);
1318−
13191305 /*
13201306 * Note that this function is called during validation time and
13211307 * thus the req_queue_mutex is held to ensure no request objects
include/media/videobuf2-v4l2.h+0−18
@@ -367,24 +367,6 @@ unsigned long vb2_fop_get_unmapped_area(struct file *file, unsigned long addr, · 366 unmodified lines
367367 */
368368 void vb2_video_unregister_device(struct video_device *vdev);
369369
370−/**
371− * vb2_ops_wait_prepare - helper function to lock a struct &vb2_queue
372− *
373− * @vq: pointer to &struct vb2_queue
374− *
375− * ..note:: only use if vq->lock is non-NULL.
376− */
377−void vb2_ops_wait_prepare(struct vb2_queue *vq);
378−
379−/**
380− * vb2_ops_wait_finish - helper function to unlock a struct &vb2_queue
381− *
382− * @vq: pointer to &struct vb2_queue
383− *
384− * ..note:: only use if vq->lock is non-NULL.
385− */
386−void vb2_ops_wait_finish(struct vb2_queue *vq);
387−
388370 struct media_request;
389371 int vb2_request_validate(struct media_request *req);
390372 void vb2_request_queue(struct media_request *req);