From patchwork Tue Oct 31 16:30:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 160206 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp364097vqg; Tue, 31 Oct 2023 09:33:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHFxWxbl3c4t35rTBQ3YF5H2SYvh3p31zNQ571YfJjgcV8Ou7xTHCDnVP6CPV6rw6seyRh X-Received: by 2002:a05:6a21:7983:b0:181:44c:d6a with SMTP id bh3-20020a056a21798300b00181044c0d6amr1972127pzc.21.1698770034939; Tue, 31 Oct 2023 09:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698770034; cv=none; d=google.com; s=arc-20160816; b=wmlgpD4R+SB5NHzZftitCn16OI272njRd4+Miawj0oS1VrqM7Xc9o5tgoM+WeKVyeR +YoRQokMgjVVncEVN35QJl3WI3un583ZZPg/vlWGqiALwQQLcVN+SgZaSdXVSl2MDql1 xsoEYqoddAiDa98YQwgpTaLNc4WZI3BXV2NI2+TLfuqtu2+B1gXhHVuQjozOe8GIoNHK Ty4Y/MyO75NaLl8nm/aYZgkc8LyInx2myEyvvSSpwov1SzrHZ6RFfNinw6KUkSXGmuBN 1T0VNhgW1yM13lKW9EYm0IheVKMpv6KvCvlI9yI/7PzcD3kDTx2oS+B2fpnGz3LAtn2K BCQA== 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=yDHgLAmRkl08v4c6bunhwCP5CzeOn7URfn4nGwGV2w1XCwS1L9M2GkwFFZlWHGW0i5 VjEOzOEYWhPfE3fCDrcqrdm3rCbfNtm/2kpCyhcp4rRmi7FcXdOjupl9XNRxPigvYGJW xxQmSqqExJc/GwlJzWyP159hxyw6ju0caGnexHksjZZMbxmnyVN9KxlWcRuKuHGsC0ob f8wrzGX539Tsob6zJZ15s0T2oKO/epBxYDOEN3Kg0dNZ1ABjxjrjLJXEtCPf83xHuTuN YAdI4FtO7xdmh2wC5F04RY6UOQnmqui3lZ5oYkfUlh2jVPa/g7GSHVh6BzSdjtPbh030 esJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="RD/Np8c9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id by26-20020a056a02059a00b005b9305bfbd1si1252763pgb.742.2023.10.31.09.33.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:33:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="RD/Np8c9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 0D3B480A310E; Tue, 31 Oct 2023 09:33:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345887AbjJaQci (ORCPT + 33 others); Tue, 31 Oct 2023 12:32:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345557AbjJaQcG (ORCPT ); Tue, 31 Oct 2023 12:32:06 -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 C98B3119; Tue, 31 Oct 2023 09:31:40 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:c562:2ef4:80c0:92f]) (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 36C7B66073C0; Tue, 31 Oct 2023 16:31:39 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698769899; bh=hEdAN5aNNO1/pDSIenHgJGapeD5q9IeR/wL5fN5tnvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RD/Np8c970zKgt9nhctbRQZjGMEbJnQ5gmrP2+35OGnzkzl79aWQncAQAgbZl9kD2 Rn1V4swq74dE6UQ57TpFBU5FohlWOfSTAAwJeSgt2/sLqLwVtWSqdE0IIeWMWtjKgZ IdNJh1MwP0YyuZ5tkdQd0rMCXpEO9D7dAlQfLpZtdWWqW5gMB6CPyWTN4zscuycj+8 GinmdKvRUi0FMTr0V4YQ3qgou8upHDVS18z91GUldTuBgzFvj1szBL58SlH7a8mxZG j3hbf4wN7pQ2EdWiQi4RvtKiegRp3Fh3Rzpyanx5fuQBf5WAqw0gdd1OO+MZtlsy+w iyO09VYLa0UOQ== 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 v14 17/56] media: atomisp: Stop direct calls to queue num_buffers field Date: Tue, 31 Oct 2023 17:30:25 +0100 Message-Id: <20231031163104.112469-18-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231031163104.112469-1-benjamin.gaignard@collabora.com> References: <20231031163104.112469-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 31 Oct 2023 09:33:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781289488047796193 X-GMAIL-MSGID: 1781289488047796193 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) {