Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp672810rdb; Tue, 19 Sep 2023 07:06:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHOqM0XQaFScobb2J9lMENPBhl59ECW4I/tDydtVqkP3zHQCOen1Km2oTmDn+3scE7u/aG X-Received: by 2002:a05:6a20:429c:b0:158:1e6d:23c8 with SMTP id o28-20020a056a20429c00b001581e6d23c8mr3443762pzj.3.1695132407342; Tue, 19 Sep 2023 07:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695132407; cv=none; d=google.com; s=arc-20160816; b=GR8d8nL+rji76qXBDkhJ+ZKrt3Wh/qvFkV3DXIuz7NUVp+owGB3kd4dUCC/bPQT7iz J4rgpsoCw15lCEsD8XuDhV2hLmWAuvcgsj/4WgDCujaOerpymRy17dcTgYBy/kfHKK3B uPHQF12/Z5Lefw/mTtNkUMilhoRVx2qwpymVkz+Wz8E4E7HH7TlgumT2UtMXA7OscMdl RNHgzbHKwzhTmsxPOKLp3CRBoKM32hwrtiq0qhwOEokUsjNBGKHWKFjhpdC8TOOFFb1x MvIJ/uqRVMnmmzW6OS6MeKS8HJDTM5ofQSBVgLmp1DZ4vnFB3vQvSbho/nLHphK6xVDG 3zUQ== 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=i3TgOuzxRicWShkZcujiok/yy4aLw7s3mwkVasmIlEU=; fh=rvfjkWKWQ7H3dxwU/Mrzlf1SBsZ3Tuo/EBElQFetDNM=; b=Qw76+RNV9OigbERir24CKUj2ruta0egstBsGeI9on8uJmMOSH0n4QBNrLHvxAc9U0h XpegsarI+IFub4zCJdhc+OE9e3OmreOuZb0tUss31lCXxl6X9PHju16/zEUvwZXC1HMv krIrIHa5roTL25BOeVTNv8t8eQVPifDVKQEYPPNClXYsjrZAwtruiwiPZrQwV7uCRncU 8nUC5jYa9zKUGfUUCNu0gsDKfyAjTU8BF3usV3ug9fzx/5qy/EN9pW6DWOFr4136edNk EDhxXdjUBYNADp+vzAg9Cy//EwlDVcnM17LWrG9eMqLQOhvfSOzlO36Oyx4utusF0ysL LYfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id 201-20020a6300d2000000b0057400b568aesi9901778pga.620.2023.09.19.07.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 07:06:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 0AF71802A33A; Tue, 19 Sep 2023 06:58:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232730AbjISN6N (ORCPT + 99 others); Tue, 19 Sep 2023 09:58:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232756AbjISN57 (ORCPT ); Tue, 19 Sep 2023 09:57:59 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC53719B; Tue, 19 Sep 2023 06:57:34 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D95BDC433C9; Tue, 19 Sep 2023 13:57:30 +0000 (UTC) Message-ID: Date: Tue, 19 Sep 2023 15:57:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 27/49] media: pci: tw686x: 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: <20230914133323.198857-1-benjamin.gaignard@collabora.com> <20230914133323.198857-28-benjamin.gaignard@collabora.com> From: Hans Verkuil In-Reply-To: <20230914133323.198857-28-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 pete.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 (pete.vger.email [0.0.0.0]); Tue, 19 Sep 2023 06:58:56 -0700 (PDT) On 14/09/2023 15:33, Benjamin Gaignard wrote: > Use vb2_get_num_buffers() to avoid using queue num_buffer field directly. > > Signed-off-by: Benjamin Gaignard > --- > drivers/media/pci/tw686x/tw686x-video.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c > index 3ebf7a2c95f0..6bc6d143d18c 100644 > --- a/drivers/media/pci/tw686x/tw686x-video.c > +++ b/drivers/media/pci/tw686x/tw686x-video.c > @@ -423,6 +423,7 @@ static int tw686x_queue_setup(struct vb2_queue *vq, > unsigned int sizes[], struct device *alloc_devs[]) > { > struct tw686x_video_channel *vc = vb2_get_drv_priv(vq); > + unsigned int q_num_bufs = vb2_get_num_buffers(vq); > unsigned int szimage = > (vc->width * vc->height * vc->format->depth) >> 3; > > @@ -430,8 +431,8 @@ static int tw686x_queue_setup(struct vb2_queue *vq, > * Let's request at least three buffers: two for the > * DMA engine and one for userspace. > */ > - if (vq->num_buffers + *nbuffers < 3) > - *nbuffers = 3 - vq->num_buffers; > + if (q_num_bufs + *nbuffers < 3) > + *nbuffers = 3 - q_num_bufs; Drop this check, and instead update min_buffers_needed from 2 to 3. Regards, Hans > > if (*nplanes) { > if (*nplanes != 1 || sizes[0] < szimage)