From patchwork Thu Sep 14 13:32:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 140033 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp762483vqi; Thu, 14 Sep 2023 19:44:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8qWzk0ifFD3d3jGv3keDf0XNo/HQ1jPw0iwbrSxrdM4vtC4Y192cYJH5PoSNM0zHDOoEZ X-Received: by 2002:a17:90b:3b4b:b0:26d:355a:47e3 with SMTP id ot11-20020a17090b3b4b00b0026d355a47e3mr298163pjb.38.1694745846117; Thu, 14 Sep 2023 19:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694745846; cv=none; d=google.com; s=arc-20160816; b=Nrge4loTjT/qW9FZTE+zZyxrTRxjaJQEMMXP1H0LGngSKiKRRL25J6wIBAu/dSbEqY CFSoy12To9KHjRhlogxqZ1Y1C1QNj8uisJpS34FMRaq18A3J5Uoz/txw6ZbppZawubXC IFkEKxXuFp5MSz4WPMhndlVlco6fo8I6GM+YDWTtK0BGxbGN2gYGG01EgmLAKtSWGvDU nJ6+SnGQ1b+35bquhKuQjrm3Qbn+hzE7G9vrrQaOaB0iDb2ZYeGET/rApq8PpGI5u0oM xhtPPhZnL5tTBEypYxjraLjLxQZBH4SoaUzpY0hLqd/7eZO0Vp4DIOEwHDNI21Nej9no 9U4w== 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=lQ9dXAKW0tlc7bFOMFkmzr0Ker99sDGq/isfBpik07I=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=wGeLiSWqLDwL8qNiwoHPNK+Vw+1vffIa0i/RQ5SBdS0vZgzXeYOh3oiLOx9PHaS+lr nUzpUDbb4LeNBCW5GZCnHvZ29y64R50uPMU5Ggf1VW4jUCVU3rprwGNmRqd0r7g7/nBB MuXid2dYG3oU+1NFGx7nE+6maAQ2TpZcrYLR8cqHq+4jHECW4vQzXvloWO4wVJwW4MFP vfPDEUTDkm8v7qYffgyLNgC/teRTYfjdy5CrjrPAFGM6yZ1j+JSriVKGSlYQx5ny2fSQ J44ZfYXMwQkZZVT8+LsdGAy97CkEoyT5sDJ1031Lzp2IBBdpmzSzkdtcKlMHiL2uFy5d BoLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=oFsDgzTc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id mr1-20020a17090b238100b0026d15dd670dsi172310pjb.0.2023.09.14.19.44.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 19:44:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=oFsDgzTc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id CC4D48076E57; Thu, 14 Sep 2023 06:34:58 -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 S239636AbjINNec (ORCPT + 35 others); Thu, 14 Sep 2023 09:34:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239277AbjINNd7 (ORCPT ); Thu, 14 Sep 2023 09:33:59 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C3401FFD; Thu, 14 Sep 2023 06:33:44 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:36f2:37bd:ccbb:373f]) (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 9577B6607377; Thu, 14 Sep 2023 14:33:42 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694698423; bh=N8F0TVW71sKqYIUdg2i7jHGXNNiGuYTWU5qjY+j8Vz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oFsDgzTcyrpxAlQlpxQ/2P4j2Ix+qcXNOxuNIVTdX9cEOU+1AnhgoyFAZ0JP9REkC Q/fUx+vRTrNK0B5SGzPHltRe+aGb05x/P1VLmP196NpE4zMd5ivunjMB3JiKPIfpA7 ic1mCSv88L0jXh2UPG+oa497ijOIHDnmES/OdCKiI1Zasm7r4Zp2XQaJyY9MOXxpwO Zh24HgChuFlwTu+pHvKEEtFlJOx8adD7d+6aB3ueY4OTlpLgP/R+QqSXsHtpYDeTgc pIWUvnhR1K3jSDqGfAsdOaAiZJyqksjDbycmJPq0yYAWHWMloYhfbkZDkhHGgbvqet nD03lIDSkdM0g== 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 v7 22/49] media: i2c: Stop direct calls to queue num_buffers field Date: Thu, 14 Sep 2023 15:32:56 +0200 Message-Id: <20230914133323.198857-23-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230914133323.198857-1-benjamin.gaignard@collabora.com> References: <20230914133323.198857-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 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]); Thu, 14 Sep 2023 06:34:58 -0700 (PDT) X-Spam-Status: No, score=-0.9 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 groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777069820434862234 X-GMAIL-MSGID: 1777069820434862234 Use vb2_get_num_buffers() to avoid using queue num_buffer field directly. Signed-off-by: Benjamin Gaignard --- drivers/media/i2c/video-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c index 537ebd9fa8d7..60d3e2f35afe 100644 --- a/drivers/media/i2c/video-i2c.c +++ b/drivers/media/i2c/video-i2c.c @@ -406,7 +406,7 @@ static int queue_setup(struct vb2_queue *vq, struct video_i2c_data *data = vb2_get_drv_priv(vq); unsigned int size = data->chip->buffer_size; - if (vq->num_buffers + *nbuffers < 2) + if (vb2_get_num_buffers(vq) + *nbuffers < 2) *nbuffers = 2; if (*nplanes)