Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2354421rdg; Mon, 16 Oct 2023 01:24:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwI47p6ypwn8w1kQPuPgej7hiH1JMYlBQgME9Rfp1oX01FRsHJtNXdG3bn5re9bOigWUoq X-Received: by 2002:a17:903:605:b0:1c9:d61a:f4a4 with SMTP id kg5-20020a170903060500b001c9d61af4a4mr9306282plb.60.1697444661000; Mon, 16 Oct 2023 01:24:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697444660; cv=none; d=google.com; s=arc-20160816; b=au33J2tV9ALpsNTlPWrmybFJUU5qzIcEhs6zOm2+VUSEZCJ/u0hVQxzcFoGeaQs5lr qpXb+00LHZN7c/frpZoZ3VVK8jdi0UyXMKoLTifmQp/1aOynGn8VmF5Lcat/sIcGCjPe GNXYai1uzqv5X85I08AtdBmFEL1WIFlfmRnApGZi8Z3fqMvJMxr+tOlLQOoHLEXzg3Xi R2rZPKMoKO1IpsOf1Eu4wqrnUialUUH+9vfFw74Oq2j9jSOQa+wAj7svCIRV8aGuqVTv 3uyx/OoOHqFoAW5BSZlSIO8+9xHhbiC2MBqt9zP+/nXBk54q2Tb2t9OCwkE3OsgRl49J Rx9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=N7KuXciT+TKgU3jFRehm1yHYqkxge9gpRQplshmOUWk=; fh=rvfjkWKWQ7H3dxwU/Mrzlf1SBsZ3Tuo/EBElQFetDNM=; b=MqgL0e9j0VjaNIAaxv0WYve8vtN2M+e5qEJVOIrD3YAfEKmHdiM0Pb9qPGRMliVHXj VaqIriNQssvMrvrZ/kBPpIVAMIT+F2uhIcFXI39v1Fe9plDqE4mvvlm2/h4axmlFWeO5 LPtbxaUM0okzpiPI28Ftg6qtzpg9sYTsKLtr+NhaETwsVCFXa1hBo2XDy7YW49mTu2JM T7xBb1vO5Bl80vlg/U62qyZkaSUOuFs64CljUE1Tt/bFZiAAYQ+p+2uOOsbEpV2crixu b+37gbxiYZKCw3sIaCOO8MkMPdMOXAwvUYCrzIwhFat6wd5GXGv5GEz4zGDbqaqiSDdU kVlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id b7-20020a170902d50700b001bb9375b349si6075357plg.536.2023.10.16.01.24.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 01:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 9A5E180990F3; Mon, 16 Oct 2023 01:24:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230154AbjJPIXq (ORCPT + 99 others); Mon, 16 Oct 2023 04:23:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229636AbjJPIXp (ORCPT ); Mon, 16 Oct 2023 04:23:45 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73744A1; Mon, 16 Oct 2023 01:23:43 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3440CC433C8; Mon, 16 Oct 2023 08:23:40 +0000 (UTC) Message-ID: <21864437-bfdd-4d39-91fa-f24fc1c7cf97@xs4all.nl> Date: Mon, 16 Oct 2023 10:23:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v11 40/56] sample: v4l: Stop direct calls to queue num_buffers field Content-Language: en-US, nl To: Benjamin Gaignard , mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, nicolas.dufresne@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, kernel@collabora.com References: <20231012114642.19040-1-benjamin.gaignard@collabora.com> <20231012114642.19040-41-benjamin.gaignard@collabora.com> From: Hans Verkuil In-Reply-To: <20231012114642.19040-41-benjamin.gaignard@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 16 Oct 2023 01:24:18 -0700 (PDT) On 12/10/2023 13:46, Benjamin Gaignard wrote: > Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. > > Signed-off-by: Benjamin Gaignard > --- > samples/v4l/v4l2-pci-skeleton.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/samples/v4l/v4l2-pci-skeleton.c b/samples/v4l/v4l2-pci-skeleton.c > index a61f94db18d9..a65aa9d1e9da 100644 > --- a/samples/v4l/v4l2-pci-skeleton.c > +++ b/samples/v4l/v4l2-pci-skeleton.c > @@ -155,6 +155,7 @@ static int queue_setup(struct vb2_queue *vq, > unsigned int sizes[], struct device *alloc_devs[]) > { > struct skeleton *skel = vb2_get_drv_priv(vq); > + unsigned int q_num_bufs = vb2_get_num_buffers(vq); > > skel->field = skel->format.field; > if (skel->field == V4L2_FIELD_ALTERNATE) { > @@ -167,8 +168,8 @@ static int queue_setup(struct vb2_queue *vq, > skel->field = V4L2_FIELD_TOP; > } > > - if (vq->num_buffers + *nbuffers < 3) > - *nbuffers = 3 - vq->num_buffers; > + if (q_num_bufs + *nbuffers < 3) > + *nbuffers = 3 - q_num_bufs; This should be dropped, and instead update q->min_buffers_needed from 2 to 3. Regards, Hans > > if (*nplanes) > return sizes[0] < skel->format.sizeimage ? -EINVAL : 0;