From patchwork Tue Jul 12 13:46:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Olbrich X-Patchwork-Id: 968422 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6CDlUbi020000 for ; Tue, 12 Jul 2011 13:47:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753256Ab1GLNrA (ORCPT ); Tue, 12 Jul 2011 09:47:00 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:55673 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753096Ab1GLNrA (ORCPT ); Tue, 12 Jul 2011 09:47:00 -0400 Received: from octopus.hi.pengutronix.de ([2001:6f8:1178:2:215:17ff:fe12:23b0]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1QgdIf-0007YH-SN; Tue, 12 Jul 2011 15:46:57 +0200 Received: from mol by octopus.hi.pengutronix.de with local (Exim 4.76) (envelope-from ) id 1QgdIf-0002Qh-6N; Tue, 12 Jul 2011 15:46:57 +0200 From: Michael Olbrich To: linux-media@vger.kernel.org Cc: kernel@pengutronix.de, Michael Olbrich , Mauro Carvalho Chehab , Pawel Osciak Subject: [PATCH] v4l: mem2mem: add wait_{prepare,finish} ops to m2m_testdev Date: Tue, 12 Jul 2011 15:46:44 +0200 Message-Id: <1310478404-9279-1-git-send-email-m.olbrich@pengutronix.de> X-Mailer: git-send-email 1.7.5.4 X-SA-Exim-Connect-IP: 2001:6f8:1178:2:215:17ff:fe12:23b0 X-SA-Exim-Mail-From: mol@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 12 Jul 2011 13:47:46 +0000 (UTC) These are necessary to prevent dead-locks e.g. if one thread waits in dqbuf at one end and another tries to queue a buffer at the other end. Signed-off-by: Michael Olbrich Cc: Mauro Carvalho Chehab Cc: Pawel Osciak Acked-by: Pawel Osciak --- drivers/media/video/mem2mem_testdev.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c index b03d74e..effefa0 100644 --- a/drivers/media/video/mem2mem_testdev.c +++ b/drivers/media/video/mem2mem_testdev.c @@ -795,10 +795,24 @@ static void m2mtest_buf_queue(struct vb2_buffer *vb) v4l2_m2m_buf_queue(ctx->m2m_ctx, vb); } +static void m2mtest_wait_prepare(struct vb2_queue *q) +{ + struct m2mtest_ctx *ctx = vb2_get_drv_priv(q); + m2mtest_unlock(ctx); +} + +static void m2mtest_wait_finish(struct vb2_queue *q) +{ + struct m2mtest_ctx *ctx = vb2_get_drv_priv(q); + m2mtest_lock(ctx); +} + static struct vb2_ops m2mtest_qops = { .queue_setup = m2mtest_queue_setup, .buf_prepare = m2mtest_buf_prepare, .buf_queue = m2mtest_buf_queue, + .wait_prepare = m2mtest_wait_prepare, + .wait_finish = m2mtest_wait_finish, }; static int queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)