Message ID | 1406174011-13600-1-git-send-email-scott.jiang.linux@gmail.com (mailing list archive) |
---|---|
State | Rejected, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) id 1X9nfz-0006yh-FE; Wed, 23 Jul 2014 05:57:11 +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 1X9nfw-0005lZ-4c; Wed, 23 Jul 2014 05:57:10 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755875AbaGWD5G (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Tue, 22 Jul 2014 23:57:06 -0400 Received: from mail-by2lp0239.outbound.protection.outlook.com ([207.46.163.239]:21571 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754861AbaGWD5E (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 22 Jul 2014 23:57:04 -0400 Received: from BY2PR03CA029.namprd03.prod.outlook.com (10.242.234.150) by BL2PR03MB356.namprd03.prod.outlook.com (10.141.89.27) with Microsoft SMTP Server (TLS) id 15.0.990.7; Wed, 23 Jul 2014 03:57:01 +0000 Received: from BN1AFFO11FD060.protection.gbl (2a01:111:f400:7c10::132) by BY2PR03CA029.outlook.office365.com (2a01:111:e400:2c2c::22) with Microsoft SMTP Server (TLS) id 15.0.995.14 via Frontend Transport; Wed, 23 Jul 2014 03:57:00 +0000 Received: from nwd2mta1.analog.com (137.71.25.55) by BN1AFFO11FD060.mail.protection.outlook.com (10.58.53.75) with Microsoft SMTP Server (TLS) id 15.0.980.11 via Frontend Transport; Wed, 23 Jul 2014 03:57:00 +0000 Received: from NWD2HUBCAS8.ad.analog.com (nwd2hubcas8.ad.analog.com [10.64.72.141]) by nwd2mta1.analog.com (8.13.8/8.13.8) with ESMTP id s6N3uOcw016960 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Tue, 22 Jul 2014 20:56:24 -0700 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS8.ad.analog.com (10.64.72.141) with Microsoft SMTP Server id 14.3.158.1; Tue, 22 Jul 2014 23:56:00 -0400 Received: from linux.site ([10.99.22.20]) by zeus.spd.analog.com (8.14.6/8.14.6) with ESMTP id s6N3tw8o029615; Tue, 22 Jul 2014 23:55:59 -0400 Received: from localhost.localdomain (unknown [10.99.24.124]) by linux.site (Postfix) with ESMTP id 9011B3AEB62D; Tue, 22 Jul 2014 13:54:02 -0600 (MDT) From: Scott Jiang <scott.jiang.linux@gmail.com> To: Hans Verkuil <hans.verkuil@cisco.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com> CC: <linux-media@vger.kernel.org>, Scott Jiang <scott.jiang.linux@gmail.com> Subject: [PATCH] v4l2: don't warn before we release buffer Date: Thu, 24 Jul 2014 11:53:31 +0800 Message-ID: <1406174011-13600-1-git-send-email-scott.jiang.linux@gmail.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Matching-Connectors: 130505614202061635; (52f37747-95c3-483a-bd05-08d153b03fac); () X-Forefront-Antispam-Report: CIP:137.71.25.55; CTRY:US; IPV:NLI; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(979002)(6009001)(199002)(189002)(229853001)(74502001)(73392001)(106466001)(64706001)(89996001)(74662001)(61266001)(105596002)(85852003)(92726001)(4396001)(87286001)(21056001)(82202001)(92566001)(104166001)(81542001)(77982001)(87572001)(81442001)(36756003)(81342001)(6806004)(87936001)(50466002)(50986999)(107046002)(50226001)(19580405001)(79102001)(33646002)(99396002)(19580395003)(31966008)(88136002)(44976005)(46102001)(80022001)(55446002)(20776003)(83072002)(48376002)(85306003)(77156001)(102836001)(95666004)(49486002)(86362001)(73972005)(47776003)(62966002)(93916002)(49496006)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:; SCL:1; SRVR:BL2PR03MB356; H:nwd2mta1.analog.com; FPR:; MLV:ovrnspm; PTR:nwd2mail10.analog.com; A:1; MX:1; LANG:en; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 028166BF91 Received-SPF: SoftFail (: domain of transitioning gmail.com discourages use of 137.71.25.55 as permitted sender) Authentication-Results: spf=softfail (sender IP is 137.71.25.55) smtp.mailfrom=scott.jiang.linux@gmail.com; Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.7.23.34519 X-PMX-Spam: Gauge=XIIIIII, Probability=16%, Report=' DATE_IN_FUTURE_12_24 1.3, FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_1099 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __DATE_TZ_HK 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __URI_NO_WWW 0, __URI_NS ' |
Commit Message
Scott Jiang
July 24, 2014, 3:53 a.m. UTC
In fact we only need to give a warning if the driver still use the
buffer after we release all queued buffers.
Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com>
---
drivers/media/v4l2-core/videobuf2-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 07/24/2014 05:53 AM, Scott Jiang wrote: > In fact we only need to give a warning if the driver still use the > buffer after we release all queued buffers. > > Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com> Nacked-by: Hans Verkuil <hans.verkuil@cisco.com> You're removing the warning telling you that your driver has a bug instead of fixing the driver bug itself. In stop_streaming the driver must hand over any buffers it owns to vb2 (vb2_buffer_done(..., STATE_ERROR)). If it doesn't you'll get this warning and vb2 will forcefully reclaim them, quite possibly leaving the driver with a corrupt buffer list. The same should occur in start_streaming if an error occurs. In that case start_streaming must return the buffers to STATE_DEQUEUED. So fix your driver instead :-) Regards, Hans > --- > drivers/media/v4l2-core/videobuf2-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c > index 7c4489c..fa5dd73 100644 > --- a/drivers/media/v4l2-core/videobuf2-core.c > +++ b/drivers/media/v4l2-core/videobuf2-core.c > @@ -2112,7 +2112,7 @@ static void __vb2_queue_cancel(struct vb2_queue *q) > if (q->start_streaming_called) > call_void_qop(q, stop_streaming, q); > > - if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { > + if (atomic_read(&q->owned_by_drv_count)) { > for (i = 0; i < q->num_buffers; ++i) > if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE) > vb2_buffer_done(q->bufs[i], VB2_BUF_STATE_ERROR); > -- 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 7c4489c..fa5dd73 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -2112,7 +2112,7 @@ static void __vb2_queue_cancel(struct vb2_queue *q) if (q->start_streaming_called) call_void_qop(q, stop_streaming, q); - if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { + if (atomic_read(&q->owned_by_drv_count)) { for (i = 0; i < q->num_buffers; ++i) if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE) vb2_buffer_done(q->bufs[i], VB2_BUF_STATE_ERROR);