From patchwork Thu Nov 9 16:34:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 163502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp560716vqs; Thu, 9 Nov 2023 08:42:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdDG61mjwzSwKuLviq0CHew2Aaot8incIde8XVNQ1ukLxNiTwvuXfWJ3l7tAX6hoZ0JWO9 X-Received: by 2002:a05:6870:14ce:b0:1e9:beae:9481 with SMTP id l14-20020a05687014ce00b001e9beae9481mr6101510oab.23.1699548122161; Thu, 09 Nov 2023 08:42:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699548122; cv=none; d=google.com; s=arc-20160816; b=yGqdbzA3YJuv6zvh+X6ftxtw9zLYEJrltDIIt4KDvkSruqPqY8iWtmhhEl8WikJZFA vSu5R2kYD1XSF1JAgEA3hlyWkBF21BJh4Ov4ldRmt/8dbmmuXdzS4PmdHt/JfN8x7AvF mh/aEczCADzD05Vx/bfz62dzDGg9rOmkyjGDmHsUMgPRfBUzpuhJzKzmDIBgY9jerDx9 LbYmR37aBtlARswEZQLtXSzbpwIJEBtAoP3yI0bNmloLl15PwV6uI1Op2nCibEw3GD1L n7HA5NzJmiMfjmst4CC/91AtFZDhY4/LV3q5b4EDTbn0PAOxVRjJo3GxL8i1R4BnbbSu 5X7A== 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=Pvs4QKgjt42qnLRw2GurbkfXViAWQs5u2SUkVh4xhtc=; fh=O6aRB12iLfQPcoaBoN6ND3UiYcgSMHP3FYKR6EKS/0Q=; b=y/APxrfdf3CaAT6E0ZAIi/CXH6saAX3MT7853mu2uVmM3UMj8fEw44edUp+5hnLA8n GKxa3i61uuul5NpFtnKb4i2LlqwhOIa7oAgv0mx85inN2q2CgN/uBvHs9FPT185H8YER WHvosm6SRhhUV7Qlbv3nQKT9KpgvsP17Mv4nREItm65xtx7K+54cmdhboymhaAVhBdYn LhCnzvLlebBjueejYw3r7h5s4L4y4zVyArJa1HhprYAmfemxKL3WzN27oHQN9nJS9Hnd WvESyxpe/kFCuxabb/O9XXuLo3YYPKQj13Ge8HVqXo/K2fL7fLKNQrEk+psHTj95tJ67 bSQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=LliNI4VN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id s17-20020a056a0008d100b006be264b2734si16896007pfu.29.2023.11.09.08.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 08:42:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=LliNI4VN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 7AFEC80A1346; Thu, 9 Nov 2023 08:40:58 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344308AbjKIQh7 (ORCPT + 31 others); Thu, 9 Nov 2023 11:37:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344214AbjKIQhu (ORCPT ); Thu, 9 Nov 2023 11:37:50 -0500 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 F1982384B; Thu, 9 Nov 2023 08:37:45 -0800 (PST) Received: from benjamin-XPS-13-9310.. (cola.collaboradmins.com [195.201.22.229]) (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 C53B3660740E; Thu, 9 Nov 2023 16:37:43 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1699547864; bh=hEdAN5aNNO1/pDSIenHgJGapeD5q9IeR/wL5fN5tnvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LliNI4VNQT1hmxnBQoxZt9oggsNC2RqMDllAfoRaPurgxtHlGXIyQ22KwbK18P7vf 31dwZjw06fiJK3gkoPEOZDKPo4E7rRA6hA5GXdfz1jqt7aq0MjNOczF+Nu2+jvGGRB 8jC2PX6RQ9u05f6plHs8vCHEa2VQh+9ZtYEOtGA07wH0HKS7cHm4of0L1zCRXm63ux we63T+WTWnbDXmwB1TOwxpu2URavq8QZl/m0CYyjqxFJ67tRUBESB7qSTsqtir4u0J lr9Viys+w9EDi1RphXqbm4iwetcNHP9K2xLhEKsRZyu85OJY5NbiwjCkGx3yKHg762 7+hWnrlKtb4qA== 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 , Hans de Goede , Sakari Ailus Subject: [PATCH v15 17/56] media: atomisp: Stop direct calls to queue num_buffers field Date: Thu, 9 Nov 2023 17:34:33 +0100 Message-Id: <20231109163512.179524-18-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231109163512.179524-14-benjamin.gaignard@collabora.com> References: <20231109163512.179524-14-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 (fry.vger.email [0.0.0.0]); Thu, 09 Nov 2023 08:40:58 -0800 (PST) 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782105371875671481 X-GMAIL-MSGID: 1782105371875671481 Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. This allows us to change how the number of buffers is computed in the future. Signed-off-by: Benjamin Gaignard Reviewed-by: Hans de Goede CC: Sakari Ailus --- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index a8a964b2f1a8..09c0091b920f 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -1028,7 +1028,7 @@ static int atomisp_qbuf_wrapper(struct file *file, void *fh, struct v4l2_buffer struct atomisp_device *isp = video_get_drvdata(vdev); struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev); - if (buf->index >= vdev->queue->num_buffers) + if (buf->index >= vb2_get_num_buffers(vdev->queue)) return -EINVAL; if (buf->reserved2 & ATOMISP_BUFFER_HAS_PER_FRAME_SETTING) {