Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp248556rdg; Thu, 12 Oct 2023 04:49:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHeUTI7E5cYxjvf/sB6/rH7YcA9LuJ9DfZ9IEnCuOzBFaplBqbLrqE8YVsdsaBgNBUzjQ9q X-Received: by 2002:a05:6a00:188a:b0:693:3d55:2bb3 with SMTP id x10-20020a056a00188a00b006933d552bb3mr23450975pfh.26.1697111394561; Thu, 12 Oct 2023 04:49:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697111394; cv=none; d=google.com; s=arc-20160816; b=JnLTt22QCLryZsIVujshF4MMjCosABG4c2WDXBnjwBmjFnZafa2xzUqXzBiqUU8xEa /fsP8DusNgUeMaNIIYj23Pg9QSyQxmBfzrqaA54eLkwejopGVyXR8UhdlR90CZTJPn3L F/NfibNHvJrD7UmnlWIf3hdLF2WHPiRDlN70YLt4qW+vWhr0QCyNM5Py368VocU2yNbF RaDIeKVUCEltlvWgHhJxDGb8rEi1+5HrSPNgqVE1+AMnvPR35ohwjwJ0Ylf9BKEMKkTC nFFkHLt5rfzQYQiA65rJ52bWmIna98ESc2HVr/PAS1MV7/XI+LSS64Lkx80YwYgOKJWW 4x6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ziV2hb4ohbfnjPJz2x4Pd4VE/hmi7lg5RaQe5DPV4Io=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=KrcM1SaP34NjtQZxSBGkEIDOEicLxrDOhe6ObP/YMHQasLxP4rYTtZlFuZs0hyrTHS g0yKya5faWM+lg6JhioVPY09EMxQ0uX60j+jNBNXyoEEDV9XErJdHlxD/NjJ0HnPzVhO 5OmXhn0aKyxTx4wiHzZSGyJEjkz9VNodBWGxm0A89vWrFf0/uAhO8j5VERCmOv4+IpTF O0sPTE7P07zikmiCeNA8BS92Yk3VOd8bm9iMr4Tmq0J41PsiU+jjR+2qokmopyNvJojy PboUYLW3mmQcHNVhXy96lnNNmK7xETDpgMsU85PL3M3mJIDcQYM1W10hAzmukSVBpPEc s+ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=LjSTgXHJ; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id y70-20020a638a49000000b00578a91ac520si2118857pgd.326.2023.10.12.04.49.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 04:49:54 -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; dkim=pass header.i=@collabora.com header.s=mail header.b=LjSTgXHJ; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 70C2681A8A8A; Thu, 12 Oct 2023 04:49:41 -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 S1379213AbjJLLsE (ORCPT + 99 others); Thu, 12 Oct 2023 07:48:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378613AbjJLLrN (ORCPT ); Thu, 12 Oct 2023 07:47:13 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1EC9DA; Thu, 12 Oct 2023 04:47:04 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:7ae7:b86d:c19a:877e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id B3A04660734D; Thu, 12 Oct 2023 12:47:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697111223; bh=zysh0fIOtYpsYqIRMileMUIIdpZZkRuacJmXooFftR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LjSTgXHJlxgyZ+bvIf6sMbUqVS/2vBIxqlUtcMc0jxVNsA2FpOa+Ek9Ek0PJTHjUT 901g/0zx77kLJ9lQ+xak0DJ8TojxT/k8YoYuoUUmBEuQm7kq92MVUWdMC1BIwO/MdO Kezi2LxtDCibe9m4J39eVUYQ228tscXbqmirgSvmALVKm3rX4KSiYKf3HHu0/uKUWr SdzhvuD+0vpARnkQvPWoe1JDyk6cUpzrIKEDep8cMXLKv8SN0Mk7m1685XvNjRK1Tf QRaoKH+VBZK+v20t2p8zaoyx7rXQzwdm2W6yv17zqA8B6VHOAGN9OdeFkDo6R8M6uw OAjzhRNHy7jEQ== From: Benjamin Gaignard To: 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, hverkuil-cisco@xs4all.nl, 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, Benjamin Gaignard Subject: [PATCH v11 25/56] media: pci: tw68: Stop direct calls to queue num_buffers field Date: Thu, 12 Oct 2023 13:46:11 +0200 Message-Id: <20231012114642.19040-26-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231012114642.19040-1-benjamin.gaignard@collabora.com> References: <20231012114642.19040-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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]); Thu, 12 Oct 2023 04:49:41 -0700 (PDT) Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. Remove tot_bufs < 2 test because min_buffers_needed is already set to 2. Signed-off-by: Benjamin Gaignard --- drivers/media/pci/tw68/tw68-video.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c index 773a18702d36..c0a8257b02ca 100644 --- a/drivers/media/pci/tw68/tw68-video.c +++ b/drivers/media/pci/tw68/tw68-video.c @@ -360,13 +360,11 @@ static int tw68_queue_setup(struct vb2_queue *q, unsigned int sizes[], struct device *alloc_devs[]) { struct tw68_dev *dev = vb2_get_drv_priv(q); - unsigned tot_bufs = q->num_buffers + *num_buffers; + unsigned tot_bufs = vb2_get_num_buffers(q) + *num_buffers; unsigned size = (dev->fmt->depth * dev->width * dev->height) >> 3; - if (tot_bufs < 2) - tot_bufs = 2; tot_bufs = tw68_buffer_count(size, tot_bufs); - *num_buffers = tot_bufs - q->num_buffers; + *num_buffers = tot_bufs - vb2_get_num_buffers(q); /* * We allow create_bufs, but only if the sizeimage is >= as the * current sizeimage. The tw68_buffer_count calculation becomes quite -- 2.39.2