From patchwork Tue Sep 16 10:28:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hans Verkuil (hansverk)" X-Patchwork-Id: 25947 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1XTq0N-0000y5-LQ; Tue, 16 Sep 2014 12:29:03 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-6) with esmtp id 1XTq0L-0000Wy-3p; Tue, 16 Sep 2014 12:29:03 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753000AbaIPK2z (ORCPT + 1 other); Tue, 16 Sep 2014 06:28:55 -0400 Received: from aer-iport-1.cisco.com ([173.38.203.51]:17571 "EHLO aer-iport-1.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752825AbaIPK2y (ORCPT ); Tue, 16 Sep 2014 06:28:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1329; q=dns/txt; s=iport; t=1410863334; x=1412072934; h=message-id:date:from:mime-version:to:subject: content-transfer-encoding; bh=jnp1z6KLhqVtCYvY94LuZXH29pAlD30c2iRzPUV8Z/I=; b=FUaI9nILiHpcITQpiHJe57rOgiw6OhRGLHNzR/Q0BDFzJ+VRBOtvS1Td uv+bFc5DGjNe2n71lRwTm5RnDpYXgN2k6zmTmKUBa7Z20eaixm6M//fZF zu6QstwBdDuIUdgkEFh83hnv8FY0lYx4ah43QqNorq4sf19cBMkI7NKUf 8=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUHAMkPGFStJssW/2dsb2JhbABghDfSXgOBKwF5hDFRPRYYAwIBAgFLAQwGAgKIOrtCAReMHQGHfwEEnQqHR419g2A7L4JKAQEB X-IronPort-AV: E=Sophos;i="5.04,534,1406592000"; d="scan'208";a="179955085" Received: from aer-iport-nat.cisco.com (HELO aer-core-4.cisco.com) ([173.38.203.22]) by aer-iport-1.cisco.com with ESMTP; 16 Sep 2014 10:28:52 +0000 Received: from [10.54.92.107] (dhcp-10-54-92-107.cisco.com [10.54.92.107]) (authenticated bits=0) by aer-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id s8GASoM6006500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 16 Sep 2014 10:28:52 GMT Message-ID: <541810E2.4040509@cisco.com> Date: Tue, 16 Sep 2014 12:28:50 +0200 From: Hans Verkuil User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: linux-media , Mauro Carvalho Chehab , Laurent Pinchart , Pawel Osciak , Nicolas Dufresne Subject: [RFC PATCH] vb2: regression fix for vbi capture & poll X-Authenticated-User: hansverk Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.9.16.102419 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1400_1499 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __MOZILLA_USER_AGENT 0, __MULTIPLE_RCPTS_TO_X5 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __URI_NO_WWW 0, __URI_NS , __USER_AGENT 0' (My proposal to fix this. Note that it is untested, I plan to do that this evening) Commit 9241650d62f7 broke vbi capture applications that expect POLLERR to be returned if STREAMON wasn't called. Rather than checking whether buffers were queued AND vb2 was not yet streaming, just check whether streaming is in progress and return POLLERR if not. This change makes it impossible to poll in one thread and call STREAMON in another, but doing that breaks existing applications and is also not according to the spec. So be it. Signed-off-by: Hans Verkuil --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 7e6aff6..0452fb2 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -2583,10 +2583,10 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) } /* - * There is nothing to wait for if no buffer has been queued and the - * queue isn't streaming, or if the error flag is set. + * There is nothing to wait for if the queue isn't streaming, or if + * the error flag is set. */ - if ((list_empty(&q->queued_list) && !vb2_is_streaming(q)) || q->error) + if (!vb2_is_streaming(q) || q->error) return res | POLLERR; /*