From patchwork Sun Feb 14 13:22:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 79281 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1EDKpFM005982 for ; Sun, 14 Feb 2010 13:20:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753870Ab0BNNUm (ORCPT ); Sun, 14 Feb 2010 08:20:42 -0500 Received: from smtp-vbr5.xs4all.nl ([194.109.24.25]:1449 "EHLO smtp-vbr5.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752822Ab0BNNUl (ORCPT ); Sun, 14 Feb 2010 08:20:41 -0500 Received: from tschai.localnet (cm-84.208.87.21.getinternet.no [84.208.87.21]) (authenticated bits=0) by smtp-vbr5.xs4all.nl (8.13.8/8.13.8) with ESMTP id o1EDKTNL064861 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 14 Feb 2010 14:20:30 +0100 (CET) (envelope-from hverkuil@xs4all.nl) From: Hans Verkuil To: linux-media@vger.kernel.org Subject: videobuf and streaming I/O questions Date: Sun, 14 Feb 2010 14:22:48 +0100 User-Agent: KMail/1.12.2 (Linux/2.6.31.8-0.1-desktop; KDE/4.3.1; x86_64; ; ) Cc: Mauro Carvalho Chehab MIME-Version: 1.0 Message-Id: <201002141422.48362.hverkuil@xs4all.nl> X-Virus-Scanned: by XS4ALL Virus Scanner 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.3 (demeter.kernel.org [140.211.167.41]); Sun, 14 Feb 2010 13:20:51 +0000 (UTC) diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index bb0a1c8..10cb0ec 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -40,6 +40,8 @@ MODULE_LICENSE("GPL"); if (debug >= level) \ printk(KERN_DEBUG "vbuf: " fmt , ## arg); } while (0) +static int __videobuf_streamoff(struct videobuf_queue *q); + /* --------------------------------------------------------------------- */ #define CALL(q, f, arg...) \ @@ -395,11 +397,6 @@ int videobuf_reqbufs(struct videobuf_queue *q, unsigned int size, count; int retval; - if (req->count < 1) { - dprintk(1, "reqbufs: count invalid (%d)\n", req->count); - return -EINVAL; - } - if (req->memory != V4L2_MEMORY_MMAP && req->memory != V4L2_MEMORY_USERPTR && req->memory != V4L2_MEMORY_OVERLAY) { @@ -414,6 +411,12 @@ int videobuf_reqbufs(struct videobuf_queue *q, goto done; } + if (req->count == 0) { + __videobuf_streamoff(q); + retval = 0; + goto done; + } + if (q->streaming) { dprintk(1, "reqbufs: streaming already exists\n"); retval = -EBUSY;