Message ID | 20230914133323.198857-24-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1211351vqi; Fri, 15 Sep 2023 10:33:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMr54rqGCsWynG/qghvw+O03l9zshvYZ0PO6e9d5kTg3Y1tbH1QhsWLP1LRDg9NdFu7vAC X-Received: by 2002:a17:90b:1a90:b0:274:6839:6a8c with SMTP id ng16-20020a17090b1a9000b0027468396a8cmr2215880pjb.6.1694799215596; Fri, 15 Sep 2023 10:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694799215; cv=none; d=google.com; s=arc-20160816; b=OO0fAnhT9LRfbOP1vrVJ+lXJvK0hDjFBQWShyGzHMwufAQWMWWucqBn/LHSh2KJD+I qPzxEYSHva3TRkyCz/DaLws2CdWJ5Aj/4fpZOqz8D/ovxPTdpRGyVm2jeRzmM0ZcpjrX 79QYe7MOoOJW5j86WQmHTUp8p39Wy0AqmwBA3m/qO5GNVaC7I7RcceNhowaA5NJ8R831 4XZ/AgNYt7O+xaeIsWr7nBGmU3otWlcpX+LSJNigr+dM8dXSqmCunOrbtBb8s8kbx9pc ovy0Zjosk2mNputWVLolvVqHvSHfajpY3yA17w6E9vHjR76C56pYqcqz0mL9/pmkXjXK hUCQ== 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=S3HpcoTOv+qfBg+xfI1cbb4POrBPGZsbIU6W8kNHClY=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=Z2rFIrLFu0WyVWreCyFsvuJFp4eOexCAYkQVX5WtYRb24zSe6+QoQDR3C+X0qe1UbH kLm7B3597ekd0sH0EHq9G1m1v1VkZr1lAo3rSO3ssMZ+SG9YR1ACpF3dyzJMJ2IUhraF k0iMtyfxFy0gL87S+NzELzbC3UNO1skBUttR8lu+gsRJGybFcr9CT8f+VMDESJu3MvuY mzyZVe0Nk/ds4hg3kHgiCLRoKPl/lzsZumidUWWtoaZPhITR13itTbsPbVTFt7ZhKnpB iu+zGogdjLEhmVJEzyMGMuSra9myRmiSSR6wj02/EArySCZItEwn8K2mbq0Wi1P6mPh/ Nrjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=BRJKAYVX; 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 ng8-20020a17090b1a8800b0025eeb3cc4b2si3944930pjb.9.2023.09.15.10.33.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 10:33:35 -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=BRJKAYVX; 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 514628213F1D; Thu, 14 Sep 2023 06:34:43 -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 S239684AbjINNeh (ORCPT <rfc822;chrisfriedt@gmail.com> + 35 others); Thu, 14 Sep 2023 09:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239071AbjINNeC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Sep 2023 09:34:02 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 193882105; Thu, 14 Sep 2023 06:33:45 -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 2BA32660734E; Thu, 14 Sep 2023 14:33:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694698423; bh=336tMZ/RUJb+ZhMa2C9VNJt3Yyz+CPMiBOLJjWSuFw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BRJKAYVXwhZNav2giBo3pXHUXbWZNnNn/esMnZZ2OStWYOMBWFldVyUj23jt/lmcx e5OD6YiVeO6dogFLYdEpRVfL68cYZxjBf4UunxHYT6Z5OMFEi40sl/LW8uJfsn4pQa 9i9CW0zfd+Gmr263fTeoi8z1PNRz9Hcznee662yWyritIFcleHr60lxGjsQlLryRwv SBrXXl7CjYX+FbLzW4/TIYhye/FRpmihwZDDAQIDEGvTa2IRfYFGDN7TiwordjsM3W HuQJKfcJPxkLlrUjPVoaVLdP0l660gp2RixoKoKgPlK2y0i/dPy6kDQB3aoq0v2Vih 8+dDET6Tb9gug== From: Benjamin Gaignard <benjamin.gaignard@collabora.com> 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 <benjamin.gaignard@collabora.com> Subject: [PATCH v7 23/49] media: pci: cx18: Stop direct calls to queue num_buffers field Date: Thu, 14 Sep 2023 15:32:57 +0200 Message-Id: <20230914133323.198857-24-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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> 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:34:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777125782048019412 X-GMAIL-MSGID: 1777125782048019412 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Sept. 14, 2023, 1:32 p.m. UTC
Use vb2_get_num_buffers() to avoid using queue num_buffer field directly.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
drivers/media/pci/cx18/cx18-streams.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On 14/09/2023 15:32, Benjamin Gaignard wrote: > Use vb2_get_num_buffers() to avoid using queue num_buffer field directly. > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> > --- > drivers/media/pci/cx18/cx18-streams.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/pci/cx18/cx18-streams.c b/drivers/media/pci/cx18/cx18-streams.c > index 597472754c4c..a7a7e006b3be 100644 > --- a/drivers/media/pci/cx18/cx18-streams.c > +++ b/drivers/media/pci/cx18/cx18-streams.c > @@ -105,6 +105,7 @@ static int cx18_queue_setup(struct vb2_queue *vq, > unsigned int sizes[], struct device *alloc_devs[]) > { > struct cx18_stream *s = vb2_get_drv_priv(vq); > + unsigned int q_num_bufs = vb2_get_num_buffers(vq); > struct cx18 *cx = s->cx; > unsigned int szimage; > > @@ -121,8 +122,8 @@ static int cx18_queue_setup(struct vb2_queue *vq, > * Let's request at least three buffers: two for the > * DMA engine and one for userspace. > */ > - if (vq->num_buffers + *nbuffers < 3) > - *nbuffers = 3 - vq->num_buffers; > + if (q_num_bufs + *nbuffers < 3) > + *nbuffers = 3 - q_num_bufs; From what I can see, this driver already sets min_buffers_needed to 3, so this check can just be dropped. Hans > > if (*nplanes) { > if (*nplanes != 1 || sizes[0] < szimage)
diff --git a/drivers/media/pci/cx18/cx18-streams.c b/drivers/media/pci/cx18/cx18-streams.c index 597472754c4c..a7a7e006b3be 100644 --- a/drivers/media/pci/cx18/cx18-streams.c +++ b/drivers/media/pci/cx18/cx18-streams.c @@ -105,6 +105,7 @@ static int cx18_queue_setup(struct vb2_queue *vq, unsigned int sizes[], struct device *alloc_devs[]) { struct cx18_stream *s = vb2_get_drv_priv(vq); + unsigned int q_num_bufs = vb2_get_num_buffers(vq); struct cx18 *cx = s->cx; unsigned int szimage; @@ -121,8 +122,8 @@ static int cx18_queue_setup(struct vb2_queue *vq, * Let's request at least three buffers: two for the * DMA engine and one for userspace. */ - if (vq->num_buffers + *nbuffers < 3) - *nbuffers = 3 - vq->num_buffers; + if (q_num_bufs + *nbuffers < 3) + *nbuffers = 3 - q_num_bufs; if (*nplanes) { if (*nplanes != 1 || sizes[0] < szimage)