From patchwork Tue Nov 27 11:22:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hans Verkuil (hansverk)" X-Patchwork-Id: 10700263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8322514BD for ; Tue, 27 Nov 2018 11:22:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F6032ADD7 for ; Tue, 27 Nov 2018 11:22:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 614D42ADE0; Tue, 27 Nov 2018 11:22:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB97C2ADD4 for ; Tue, 27 Nov 2018 11:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729484AbeK0WU3 (ORCPT ); Tue, 27 Nov 2018 17:20:29 -0500 Received: from aer-iport-1.cisco.com ([173.38.203.51]:58897 "EHLO aer-iport-1.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726450AbeK0WU3 (ORCPT ); Tue, 27 Nov 2018 17:20:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2063; q=dns/txt; s=iport; t=1543317774; x=1544527374; h=to:cc:from:subject:message-id:date:mime-version: content-transfer-encoding; bh=T01QKWpgyo1YTseWa8hdsp+hnDz7mMKMU8cKZFVk4Sg=; b=J/SzMhC5Qh8AHbgFYr1yqFN2c/s0TUCnvziwxEIrQ/1rUhTCYoXnbOsd 3+fG0ivirlnS6sNQaL1456AYqkNTev2UiuzgTbKmRNkZ5X53Uw31K66hN CiqEuM8cmYgyQYHYWmdJYblbtN7b61JUENY1eSe0/d+pN5pYJouakCYnJ A=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AFAADGKP1b/xbLJq1kGgEBAQEBAgEBAQEHAgEBAQGBUQUBAQEBCwGDWRIng3mIGF+ND5JuhHeBegsBAYRshFQ0CQ0BAwEBAgEBAm0ohWYEUjUCJgJfDQYCAQGDHYICpTh8M4VAhG+BC4sZgUA/gREnDIQHGQGGQ4JXAo9jkCkJgiCFYokoBhiBWYgJhyksl2QCBAsCFIFGOIFVMxoIGxWDJ4Izjik+AzCOcQEB X-IronPort-AV: E=Sophos;i="5.56,286,1539648000"; d="scan'208";a="8420051" Received: from aer-iport-nat.cisco.com (HELO aer-core-1.cisco.com) ([173.38.203.22]) by aer-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2018 11:22:39 +0000 Received: from [10.47.79.81] ([10.47.79.81]) (authenticated bits=0) by aer-core-1.cisco.com (8.15.2/8.15.2) with ESMTPSA id wARBMbae014210 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 Nov 2018 11:22:38 GMT To: Linux Media Mailing List Cc: Sakari Ailus From: Hans Verkuil Subject: [PATCH for v4.20] vb2: skip request checks for VIDIOC_PREPARE_BUF Message-ID: Date: Tue, 27 Nov 2018 12:22:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Language: en-US X-Authenticated-User: hansverk X-Outbound-SMTP-Client: 10.47.79.81, [10.47.79.81] X-Outbound-Node: aer-core-1.cisco.com Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP VIDIOC_PREPARE_BUF should ignore V4L2_BUF_FLAG_REQUEST_FD since it isn't doing anything with requests. So inform vb2_queue_or_prepare_buf whether it is called from vb2_prepare_buf or vb2_qbuf and just return 0 in the first case. This was found when adding new v4l2-compliance checks. Signed-off-by: Hans Verkuil diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c index 1244c246d0c4..1ac1b3f334f6 100644 --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c @@ -332,10 +332,10 @@ static int vb2_fill_vb2_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b } static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *mdev, - struct v4l2_buffer *b, - const char *opname, + struct v4l2_buffer *b, bool is_prepare, struct media_request **p_req) { + const char *opname = is_prepare ? "prepare_buf" : "qbuf"; struct media_request *req; struct vb2_v4l2_buffer *vbuf; struct vb2_buffer *vb; @@ -377,6 +377,9 @@ static int vb2_queue_or_prepare_buf(struct vb2_queue *q, struct media_device *md return ret; } + if (is_prepare) + return 0; + if (!(b->flags & V4L2_BUF_FLAG_REQUEST_FD)) { if (q->uses_requests) { dprintk(1, "%s: queue uses requests\n", opname); @@ -656,7 +659,7 @@ int vb2_prepare_buf(struct vb2_queue *q, struct media_device *mdev, if (b->flags & V4L2_BUF_FLAG_REQUEST_FD) return -EINVAL; - ret = vb2_queue_or_prepare_buf(q, mdev, b, "prepare_buf", NULL); + ret = vb2_queue_or_prepare_buf(q, mdev, b, true, NULL); return ret ? ret : vb2_core_prepare_buf(q, b->index, b); } @@ -728,7 +731,7 @@ int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev, return -EBUSY; } - ret = vb2_queue_or_prepare_buf(q, mdev, b, "qbuf", &req); + ret = vb2_queue_or_prepare_buf(q, mdev, b, false, &req); if (ret) return ret; ret = vb2_core_qbuf(q, b->index, b, req);