From patchwork Thu Sep 14 13:33:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 139890 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp681034vqi; Thu, 14 Sep 2023 16:11:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGaFcMkNJ8myUK87YvL9h94k+R+NxzvzRV8reXVaJU7uTLrnKmTpjSy3cInPZsVgIEtYW2w X-Received: by 2002:a05:6a21:6d8d:b0:159:c3d5:40bc with SMTP id wl13-20020a056a216d8d00b00159c3d540bcmr276133pzb.1.1694733101050; Thu, 14 Sep 2023 16:11:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694733101; cv=none; d=google.com; s=arc-20160816; b=Z3GwYcksmWluzTwyWDh5W/yIyNnwM/r6chlXq8soG53K5A6ZQHGkHH6/3iyiwOF+71 6SABO0H6azz4/QYobSDLrth5PKOOelhWG7Ml98FMzxdeUs12ICjtW68HvcXOH8P8wf+H Xq6RCfYdeZZwT8/2hiJPpqzveBvafPIoTMFha6jhd82kvAg2d1N6u1Q399qzJo2jp6vK GzTHqiWlxaOc8EZZ9Apw8eW/ugMHexFCL5Ke4yPIFx+JQAIyC3tQrW0fkcQmq56ZoU16 ieyWAg9twa4He91DMmQ+kjBqr3ZthsQwx3jah8W+3DU8cjTmpkuKyfVYrS3mXqP9U2AT ghcg== 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=quVGyklw9qjYlLNKcyjosW0fq/RVVduGZ4UbV730Ido=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=ByfNhDYKiOCHDKc0ZOqv8yjlFh1hKiyRGb+NelDy0gcRAnQEutURsRxboj4B7y6UEr Z9hS3E8tO6M7rIp4H2tnakF60RRr8xvb4YpMCFgZHeXdddU3DqVLnt7uIhGKFHMg1fdH le1rgU9x1YkI5rOxqDQRHsZ4SzBr5+U/AhFLZRG0HZiWeu7v+QB5lF8T11E/qLLPDUo6 AgXbOXBEcYAQWsPeBzSvKjEUSxlk2tMGRnA6uWVEUkCd1iPX1EsicluD+4SyQarEpuF+ +M0HDahRMyZePzvy2EBAZIdXoYMOUDNXl4OsKt+ylZNhS2x6j53KW5mVmMFpJnQkxo+j chdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=hIrpjdHH; 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 n15-20020a170902d2cf00b001c3bd544f9fsi2506628plc.523.2023.09.14.16.11.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 16:11:41 -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=hIrpjdHH; 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 3317582F4E2A; Thu, 14 Sep 2023 06:35:45 -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 S240017AbjINNfi (ORCPT + 35 others); Thu, 14 Sep 2023 09:35:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239851AbjINNeu (ORCPT ); Thu, 14 Sep 2023 09:34:50 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4990272D; Thu, 14 Sep 2023 06:33:53 -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 0D7676607350; Thu, 14 Sep 2023 14:33:52 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694698432; bh=8QdmTHdgoaFCZ92hWXIEL9hOaDrX90tCZOqZYUq2PdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hIrpjdHHkd8DCsezUS6Db1t2mu//j9qGKSeanMJQE79X+olRQO4KTQpC5RaEVpaXZ fuztA6tGqvwzZ1PtMQJtqVn2jR+bbTJlozFixJYdu64lOLpfm86pNS0Htz0Spop+Oh Wd1Wevs9N5g1gGaXwynNkHxF6L1jjDQwlDyEa/bRvVS/GpyU3vGcaZXPNLG8YMeiEu 5/hrxlneaY3Pi+0si5lcj1NKHcHZuEhgQhhOdftaYznfEim3yrOBNLzUa5vLyhLISI 8jYt914ufA6p3QiSz+BypCIRLDedkOW6MUxydy9ude1UD5XADaX26eJ8LV+b3sRizY n1nNnWMdKdXeA== 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 40/49] media: usb: usbtv: Stop direct calls to queue num_buffers field Date: Thu, 14 Sep 2023 15:33:14 +0200 Message-Id: <20230914133323.198857-41-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 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 06:35:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777056455813121138 X-GMAIL-MSGID: 1777056455813121138 Use vb2_get_num_buffers() to avoid using queue num_buffer field directly. Signed-off-by: Benjamin Gaignard --- drivers/media/usb/usbtv/usbtv-video.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c index 1e30e05953dc..41704d45c65c 100644 --- a/drivers/media/usb/usbtv/usbtv-video.c +++ b/drivers/media/usb/usbtv/usbtv-video.c @@ -725,10 +725,11 @@ static int usbtv_queue_setup(struct vb2_queue *vq, unsigned int *nplanes, unsigned int sizes[], struct device *alloc_devs[]) { struct usbtv *usbtv = vb2_get_drv_priv(vq); + unsigned int q_num_bufs = vb2_get_num_buffers(vq); unsigned size = USBTV_CHUNK * usbtv->n_chunks * 2 * sizeof(u32); - if (vq->num_buffers + *nbuffers < 2) - *nbuffers = 2 - vq->num_buffers; + if (q_num_bufs + *nbuffers < 2) + *nbuffers = 2 - q_num_bufs; if (*nplanes) return sizes[0] < size ? -EINVAL : 0; *nplanes = 1;