From patchwork Wed Sep 27 15:35:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 145576 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2880019vqu; Wed, 27 Sep 2023 13:20:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbfjZs6tUD7iNyK52NXS7pRN+z3waZiggn8MRcf/T74smFLjC7LppMreynRAljLOwPchVP X-Received: by 2002:a17:903:110d:b0:1bb:d59d:8c57 with SMTP id n13-20020a170903110d00b001bbd59d8c57mr3551615plh.18.1695846025095; Wed, 27 Sep 2023 13:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695846025; cv=none; d=google.com; s=arc-20160816; b=c/UhvEiYZmyVnnqhIzfj6MlrjAflLoN/kWnDu/eZqpGKcgj5HcHJ7myUwvYnkMmqNg rXozwvbiKzR24hqQ2R70GHcSPg62vlM/TtSYR/MnQ16e3YzAKmCVNcoOD5t2V/WVnFag Y/es7uji73GExq85nRHXetEGFnsEkn5GZDu02vTjWt+UayM7aPEVgcumj3c+lG3wVzSj jV2QKxEFttRQMZPrEWc97fLn6t0jDWEmWAM0Glm79p7ys+X0p+gdlLiOPQCDzNqv7ky4 0R8En9YwyfwlgNgeLAhhLsgb7X12W2h5QLpUSj/kxZnctbMLNZr/5Nl3VBbYBrEvMbTd vqRQ== 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=NHwNkhr5QFK9GIbxnuRVaaAZiMba2Wdss9SCt91KwfI=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=nvqauulAWb10b9yGt2XYNEHJc2TrbBxBhKxeNFZ/eWPPxV+GTzo8cYSkicYmk5NmB8 cMx9cRO2Uxvqp7GkIgEEUSQHdqYpugwvbYv/cB+eO4vjwQHDajnrDWI0LyNbu7yLg4xe 6KQ1ezUBUCPQcgON2vBAvbMSguT6S0BtO9J/7VrH6j4QYQPh5HhdecONLIha+BTVwcy9 0ATcdJdi7SpjaD5TrelMhdvZCTa2M09Xwb0QVVBQMxt903ZNbChwIxWGMHgmu8yJsA8C 5oJh2hVB/hCGCDH69yy1zGjk6PK2+8f4UoBeKispDtfUxSS5D6Ad6TG3WoOdtZ64C2N5 zeQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="TUGJ/6nj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l11-20020a170903120b00b001b5589848absi17449062plh.234.2023.09.27.13.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 13:20:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="TUGJ/6nj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 43F4E81BDF19; Wed, 27 Sep 2023 08:38:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232573AbjI0Pie (ORCPT + 19 others); Wed, 27 Sep 2023 11:38:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232735AbjI0Pge (ORCPT ); Wed, 27 Sep 2023 11:36:34 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B351FCC7; Wed, 27 Sep 2023 08:36:31 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:672:46bd:3ec7:6cdf]) (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 15D256607342; Wed, 27 Sep 2023 16:36:30 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695828990; bh=/cndzbQG0EfdVraDFE6iiWONWcwO1/xN2meedcRh5A0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TUGJ/6njYheEyRBcrcxVhaOeEcM1pEN+WH5MDCkOlOULZKJUl+oOvWpkW7vq9dWa/ wEWHQK6BR0F3pUnhnDZEtvx7vUnE+3WCTFnVjW0H1+/QbrdS+2u0dM2uAFhnLxQF0q n8+N8tteqDcaGUASkIPoDXtxy1Oopytsx04d/YGrS3Hw0sD1jJSTlozBnD8UKQR3BQ xe5fyhLA+M6/LfBmkJrDcfAzmZ9LudXFIgA7MSrarwHgqz1CBc7CrxCbV5zX0X3L0B VrIIGcHlxkaPxNUmEB8T8/GXhfQLy13Ajw9f5mn12L+J8cLdf5EfGQGN4k10MPwtfN ehDf7W0/j4bLQ== 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 v8 46/53] sample: v4l: Stop direct calls to queue num_buffers field Date: Wed, 27 Sep 2023 17:35:51 +0200 Message-Id: <20230927153558.159278-47-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230927153558.159278-1-benjamin.gaignard@collabora.com> References: <20230927153558.159278-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 27 Sep 2023 08:38:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778223441647813722 X-GMAIL-MSGID: 1778223441647813722 Use vb2_get_num_buffers() to avoid using queue num_buffer 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; if (*nplanes) return sizes[0] < skel->format.sizeimage ? -EINVAL : 0;