Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] media: marvell-ccic: use vb2_ops_wait_prepare/finish helper

This patch drops driver specific wait_prepare() and
wait_finish() callbacks from vb2_ops and instead uses
the the helpers vb2_ops_wait_prepare/finish() provided
by the vb2 core, the lock member of the queue needs
to be initalized to a mutex so that vb2 helpers
vb2_ops_wait_prepare/finish() can make use of it.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Prabhakar Lad and committed by
Mauro Carvalho Chehab
519694f9 7c57529b

+5 -24
+5 -24
drivers/media/platform/marvell-ccic/mcam-core.c
··· 1102 1102 mcam_read_setup(cam); 1103 1103 } 1104 1104 1105 - 1106 - /* 1107 - * vb2 uses these to release the mutex when waiting in dqbuf. I'm 1108 - * not actually sure we need to do this (I'm not sure that vb2_dqbuf() needs 1109 - * to be called with the mutex held), but better safe than sorry. 1110 - */ 1111 - static void mcam_vb_wait_prepare(struct vb2_queue *vq) 1112 - { 1113 - struct mcam_camera *cam = vb2_get_drv_priv(vq); 1114 - 1115 - mutex_unlock(&cam->s_mutex); 1116 - } 1117 - 1118 - static void mcam_vb_wait_finish(struct vb2_queue *vq) 1119 - { 1120 - struct mcam_camera *cam = vb2_get_drv_priv(vq); 1121 - 1122 - mutex_lock(&cam->s_mutex); 1123 - } 1124 - 1125 1105 /* 1126 1106 * These need to be called with the mutex held from vb2 1127 1107 */ ··· 1171 1191 .buf_queue = mcam_vb_buf_queue, 1172 1192 .start_streaming = mcam_vb_start_streaming, 1173 1193 .stop_streaming = mcam_vb_stop_streaming, 1174 - .wait_prepare = mcam_vb_wait_prepare, 1175 - .wait_finish = mcam_vb_wait_finish, 1194 + .wait_prepare = vb2_ops_wait_prepare, 1195 + .wait_finish = vb2_ops_wait_finish, 1176 1196 }; 1177 1197 1178 1198 ··· 1232 1252 .buf_cleanup = mcam_vb_sg_buf_cleanup, 1233 1253 .start_streaming = mcam_vb_start_streaming, 1234 1254 .stop_streaming = mcam_vb_stop_streaming, 1235 - .wait_prepare = mcam_vb_wait_prepare, 1236 - .wait_finish = mcam_vb_wait_finish, 1255 + .wait_prepare = vb2_ops_wait_prepare, 1256 + .wait_finish = vb2_ops_wait_finish, 1237 1257 }; 1238 1258 1239 1259 #endif /* MCAM_MODE_DMA_SG */ ··· 1245 1265 memset(vq, 0, sizeof(*vq)); 1246 1266 vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1247 1267 vq->drv_priv = cam; 1268 + vq->lock = &cam->s_mutex; 1248 1269 INIT_LIST_HEAD(&cam->buffers); 1249 1270 switch (cam->buffer_mode) { 1250 1271 case B_DMA_contig: