From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03371238C26; Thu, 7 Aug 2025 13:18:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754572724; cv=none; b=aDf086oprbcXKiFpp9n+rxgdGCU0Ckwu+D8E9LGTgAiIy1mwW7U7hX0omrWrQu3WfHtsU3K3ghGvNVh0b/yv7QE/sLVtJdG9G/3zIDBbNSMOdxiYgOik9ZsAuoWm8pcedjXJpuo1c+zpXS6JSPk7Ri3HZSxblExpn7sigy0khw0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754572724; c=relaxed/simple; bh=jhZGuKs+VTL1EX9JQsLLNKW9dU7Cq1mi1XfmDpxGgmo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AGT/DfvD9gGdlmfcdAziBCe8fsiivrt5X0MW/T/lxJCcx7A/IV88SEBgX32Gbqs/OYaNMnY0+ZzTqgeQW1gQxMK1UUcUaCBGsDxPaOLeqYDVWvmOhSXvBVd/o6JOPDpcCyhjEPtkqvKrxTH4CqSUc0WxIyaNPVN9IfviZGG1Paw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JrXszesK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JrXszesK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E7EEC4CEEB; Thu, 7 Aug 2025 13:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1754572721; bh=jhZGuKs+VTL1EX9JQsLLNKW9dU7Cq1mi1XfmDpxGgmo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=JrXszesK5tUM43V2eGqUN+jLW7uAsSpNpdAmHts3xnx9QnJBpsYabAVOkIMuN0hlu vzSFO46kPooQ1U2SGy2fglffZP201jX0qjnxVu3is1h2rPaX0wgEZlqC1slHgg6arf yfim2V/46ZQzB6iWcvcGW/VFgwkYTHHWrZeMvCx5Q571Hhw5KHIT3k0pRTF/MjEovO ZwltMIlwKlapLaLNAQpAk4dMiYSWyUMDBcDlSWqJ56K+t555RJyDC/bTgOZ+V4Nys1 PFvalFsiCbVAcywS7w3AHHACq/81AbcrBbBOyU/09/Ie/BhylPBBz3NbkFZV04DH0t fUmdplWqOQxWQ== Message-ID: <8c24481d-dfdf-4923-9629-3f6b074c27da@kernel.org> Date: Thu, 7 Aug 2025 15:18:19 +0200 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 58/65] media: zoran: Remove access to __fh To: Laurent Pinchart Cc: Jacopo Mondi , Mauro Carvalho Chehab , Devarsh Thakkar , Benoit Parrot , Hans Verkuil , Mike Isely , Hans de Goede , Parthiban Veerasooran , Christian Gromm , Greg Kroah-Hartman , Alex Shi , Yanteng Si , Dongliang Mu , Jonathan Corbet , Tomasz Figa , Marek Szyprowski , Andy Walls , Michael Tretter , Pengutronix Kernel Team , Bin Liu , Matthias Brugger , AngeloGioacchino Del Regno , Dmitry Osipenko , Thierry Reding , Jonathan Hunter , Mirela Rabulea , Shawn Guo , Sascha Hauer , Fabio Estevam , Kieran Bingham , Michal Simek , Ming Qian , Zhou Peng , Xavier Roumegue , Philipp Zabel , Vikash Garodia , Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Sylwester Nawrocki , Jernej Skrabec , Chen-Yu Tsai , Samuel Holland , Daniel Almeida , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Nas Chung , Jackson Lee , Minghsiu Tsai , Houlong Wei , Andrew-CT Chen , Tiffany Lin , Yunfei Dong , Geert Uytterhoeven , Magnus Damm , Mikhail Ulyanov , Jacob Chen , Ezequiel Garcia , Heiko Stuebner , Detlev Casanova , Krzysztof Kozlowski , Alim Akhtar , Sylwester Nawrocki , =?UTF-8?Q?=C5=81ukasz_Stelmach?= , Andrzej Pietrasiewicz , Jacek Anaszewski , Andrzej Hajda , Fabien Dessenne , Hugues Fruchet , Jean-Christophe Trotin , Maxime Coquelin , Alexandre Torgue , Nicolas Dufresne , Benjamin Gaignard , Steve Longerbeam , Maxime Ripard , Paul Kocialkowski , =?UTF-8?Q?Niklas_S=C3=B6derlund?= , Robert Foss , Todor Tomov , Vladimir Zapolskiy , Corentin Labbe , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Stanislaw Gruszka , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-tegra@vger.kernel.org, imx@lists.linux.dev, linux-renesas-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-usb@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, mjpeg-users@lists.sourceforge.net References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> <20250802-media-private-data-v1-58-eb140ddd6a9d@ideasonboard.com> <20250807123157.GF11583@pendragon.ideasonboard.com> From: Hans Verkuil Content-Language: en-US In-Reply-To: <20250807123157.GF11583@pendragon.ideasonboard.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 8/7/25 14:31, Laurent Pinchart wrote: > On Thu, Aug 07, 2025 at 08:58:01AM +0200, Hans Verkuil wrote: >> On 02/08/2025 11:23, Jacopo Mondi wrote: >>> The __fh parameter is assigned to an unsued variable. Remove it >>> and remove the unused struct zoran_fh type. >>> >>> Signed-off-by: Jacopo Mondi >>> --- >>> drivers/media/pci/zoran/zoran.h | 6 ------ >>> drivers/media/pci/zoran/zoran_driver.c | 3 +-- >>> 2 files changed, 1 insertion(+), 8 deletions(-) >>> >>> diff --git a/drivers/media/pci/zoran/zoran.h b/drivers/media/pci/zoran/zoran.h >>> index 1cd990468d3de9db8b14b72483972041c57bfee2..d05e222b392156bf1b3b4c83c6591db642c3c377 100644 >>> --- a/drivers/media/pci/zoran/zoran.h >>> +++ b/drivers/media/pci/zoran/zoran.h >>> @@ -154,12 +154,6 @@ struct zoran_jpg_settings { >>> >>> struct zoran; >>> >>> -/* zoran_fh contains per-open() settings */ >>> -struct zoran_fh { >>> - struct v4l2_fh fh; >>> - struct zoran *zr; >>> -}; >>> - >>> struct card_info { >>> enum card_type type; >>> char name[32]; >>> diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c >>> index f42f596d3e6295e31e3b33cd83c5f7243911bd30..ec7fc1da4cc02f5a344cb49bb9a783c41c758195 100644 >>> --- a/drivers/media/pci/zoran/zoran_driver.c >>> +++ b/drivers/media/pci/zoran/zoran_driver.c >>> @@ -511,12 +511,11 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, >> >> This driver uses __fh as the name for the second argument of the ioctl >> callbacks. Can you take this opportunity to rename it to either 'fh' or 'priv'? > > It's a bit of yak shaving, but not too difficult so it will be addressed > in the next version (Jacopo already wrote the patches, thanks). > >> Generally it's not a good idea to prefix variables with __ for no good reason. >> >> Grepping for __fh also shows two other drivers: >> >> drivers/media/platform/chips-media/coda/coda-common.c:#define fh_to_ctx(__fh) container_of(__fh, struct coda_ctx, fh) >> drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h:#define fh_to_ctx(__fh) container_of(__fh, struct s5p_mfc_ctx, fh) >> >> I think it is a good idea to rename __fh to fh there as well. > > That can't be done, otherwise things like > > #define fh_to_ctx(fh) container_of(fh, struct coda_ctx, fh) > > static inline struct coda_ctx *file_to_ctx(struct file *filp) > { > return fh_to_ctx(file_to_v4l2_fh(filp)); > } > > will expand in the file_to_ctx() function to > > return container_of(file_to_v4l2_fh(filp), struct coda_ctx, file_to_v4l2_fh(filp)) If the fh_to_ctx #define is changed to a static inline, then there is no problem. That said, it is overkill. Regards, Hans > > We could rename the __fh argument to vfh or v4l2fh, but I think __fh is > equally good there. It's just the macro argument name. > >>> struct v4l2_format *fmt) >>> { >>> struct zoran *zr = video_drvdata(file); >>> - struct zoran_fh *fh = __fh; >>> int i; >>> int res = 0; >>> >>> if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) >>> - return zoran_s_fmt_vid_out(file, fh, fmt); >>> + return zoran_s_fmt_vid_out(file, __fh, fmt); >>> >>> for (i = 0; i < NUM_FORMATS; i++) >>> if (fmt->fmt.pix.pixelformat == zoran_formats[i].fourcc) >