From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8FE5CCD1AD for ; Mon, 20 Oct 2025 12:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uAvrqP/iNiveHe2HglljSnZhF/zMSpBzj6yZNjY3EfI=; b=AgeyhC5MJMsYQTb1CTdH1p1IT9 RIwEw9Vow5CkAyBZZ0XmccGSjgoqTOsPF3KMlsKUTW/RZRjuJA0MGY2JXlhkXgCHS04BTVY8Um7hG FSwJDrGFsIQDEDqi3ikltg09k/Fi55TR5k6suIhi6i3N1r1YawKca93NWd4vrzngNGHCLvCVPXNMu sABgp8nOg6SH29BsK0TcughHVDuIiND0JCtpw0DVdX0ofT8iOi8aUmrnIcKeAgSa/PWJNF9fe+EP9 3cdutAOxn4il2S1CFvuiqjiIPF8UaEpgMAi0jf/g0Q1zDpsI18TgTNj4h4Eomn1OlJRd6LMLLBPP5 P4zNgJ1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vAonl-0000000DLtA-0GBf; Mon, 20 Oct 2025 12:15:49 +0000 Received: from leonov.paulk.fr ([185.233.101.22]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uj3Dz-0000000BNE7-3qnC; Mon, 04 Aug 2025 22:00:10 +0000 Received: from laika.paulk.fr (12.234.24.109.rev.sfr.net [109.24.234.12]) by leonov.paulk.fr (Postfix) with ESMTPS id 2D7001F00060; Mon, 4 Aug 2025 21:59:41 +0000 (UTC) Received: by laika.paulk.fr (Postfix, from userid 65534) id 3CE7AB01183; Mon, 4 Aug 2025 21:59:37 +0000 (UTC) Received: from shepard (unknown [192.168.1.1]) by laika.paulk.fr (Postfix) with ESMTPSA id 02B54B01170; Mon, 4 Aug 2025 21:59:27 +0000 (UTC) Date: Mon, 4 Aug 2025 23:59:25 +0200 From: Paul Kocialkowski To: Jacopo Mondi Cc: Mauro Carvalho Chehab , Devarsh Thakkar , Benoit Parrot , Hans Verkuil , Mike Isely , Laurent Pinchart , 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 , Niklas =?utf-8?Q?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 Subject: Re: [PATCH 54/65] media: hantro: Access v4l2_fh from file->private_data Message-ID: References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> <20250802-media-private-data-v1-54-eb140ddd6a9d@ideasonboard.com> MIME-Version: 1.0 In-Reply-To: <20250802-media-private-data-v1-54-eb140ddd6a9d@ideasonboard.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250804_150008_279346_7B349473 X-CRM114-Status: GOOD ( 27.34 ) X-Mailman-Approved-At: Mon, 20 Oct 2025 05:15:44 -0700 X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============5941574532804230270==" Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org --===============5941574532804230270== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="/6X2y1A/1uo421sv" Content-Disposition: inline --/6X2y1A/1uo421sv Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, Very nice cleanup, glad to see this abstracted away from drivers! Reviewed-by: Paul Kocialkowski All the best, Paul On Sat 02 Aug 25, 11:23, Jacopo Mondi wrote: > From: Laurent Pinchart >=20 > To prepare for the introduction of video_device_state as second argument > of the v4l2_ioctl_ops handler, access the v4l2_fh from > file->private_data instead of using void *priv. >=20 > The file->private_data is initialized to point to the v4l2_fh > by the usage of v4l2_fh_init() in the v4l2_file_operations.open() > handler. >=20 > While at it remove the only left user of fh_to_ctx() and remove > the macro completely. >=20 > Signed-off-by: Laurent Pinchart > Signed-off-by: Jacopo Mondi > --- > drivers/media/platform/verisilicon/hantro.h | 5 ----- > drivers/media/platform/verisilicon/hantro_v4l2.c | 22 +++++++++++-------= ---- > 2 files changed, 11 insertions(+), 16 deletions(-) >=20 > diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/= platform/verisilicon/hantro.h > index 0f10714f1953945472e11d8c8ad87f8ec009b39f..e0fdc4535b2d73c5260057b0a= 89aee67a4732dd2 100644 > --- a/drivers/media/platform/verisilicon/hantro.h > +++ b/drivers/media/platform/verisilicon/hantro.h > @@ -382,11 +382,6 @@ extern int hantro_debug; > pr_err("%s:%d: " fmt, __func__, __LINE__, ##args) > =20 > /* Structure access helpers. */ > -static __always_inline struct hantro_ctx *fh_to_ctx(struct v4l2_fh *fh) > -{ > - return container_of(fh, struct hantro_ctx, fh); > -} > - > static __always_inline struct hantro_ctx *file_to_ctx(struct file *filp) > { > return container_of(file_to_v4l2_fh(filp), struct hantro_ctx, fh); > diff --git a/drivers/media/platform/verisilicon/hantro_v4l2.c b/drivers/m= edia/platform/verisilicon/hantro_v4l2.c > index 7c3515cf7d64a090adfb8d8aff368f9a617f8c8a..6bcd892e7bb49c654aae58416= 64d68c1692064bd 100644 > --- a/drivers/media/platform/verisilicon/hantro_v4l2.c > +++ b/drivers/media/platform/verisilicon/hantro_v4l2.c > @@ -185,7 +185,7 @@ static int vidioc_querycap(struct file *file, void *p= riv, > static int vidioc_enum_framesizes(struct file *file, void *priv, > struct v4l2_frmsizeenum *fsize) > { > - struct hantro_ctx *ctx =3D fh_to_ctx(priv); > + struct hantro_ctx *ctx =3D file_to_ctx(file); > const struct hantro_fmt *fmt; > =20 > fmt =3D hantro_find_format(ctx, fsize->pixel_format); > @@ -217,7 +217,7 @@ static int vidioc_enum_fmt(struct file *file, void *p= riv, > struct v4l2_fmtdesc *f, bool capture) > =20 > { > - struct hantro_ctx *ctx =3D fh_to_ctx(priv); > + struct hantro_ctx *ctx =3D file_to_ctx(file); > const struct hantro_fmt *fmt, *formats; > unsigned int num_fmts, i, j =3D 0; > bool skip_mode_none, enum_all_formats; > @@ -297,7 +297,7 @@ static int vidioc_g_fmt_out_mplane(struct file *file,= void *priv, > struct v4l2_format *f) > { > struct v4l2_pix_format_mplane *pix_mp =3D &f->fmt.pix_mp; > - struct hantro_ctx *ctx =3D fh_to_ctx(priv); > + struct hantro_ctx *ctx =3D file_to_ctx(file); > =20 > vpu_debug(4, "f->type =3D %d\n", f->type); > =20 > @@ -310,7 +310,7 @@ static int vidioc_g_fmt_cap_mplane(struct file *file,= void *priv, > struct v4l2_format *f) > { > struct v4l2_pix_format_mplane *pix_mp =3D &f->fmt.pix_mp; > - struct hantro_ctx *ctx =3D fh_to_ctx(priv); > + struct hantro_ctx *ctx =3D file_to_ctx(file); > =20 > vpu_debug(4, "f->type =3D %d\n", f->type); > =20 > @@ -398,13 +398,13 @@ static int hantro_try_fmt(const struct hantro_ctx *= ctx, > static int vidioc_try_fmt_cap_mplane(struct file *file, void *priv, > struct v4l2_format *f) > { > - return hantro_try_fmt(fh_to_ctx(priv), &f->fmt.pix_mp, f->type); > + return hantro_try_fmt(file_to_ctx(file), &f->fmt.pix_mp, f->type); > } > =20 > static int vidioc_try_fmt_out_mplane(struct file *file, void *priv, > struct v4l2_format *f) > { > - return hantro_try_fmt(fh_to_ctx(priv), &f->fmt.pix_mp, f->type); > + return hantro_try_fmt(file_to_ctx(file), &f->fmt.pix_mp, f->type); > } > =20 > static void > @@ -648,19 +648,19 @@ static int hantro_set_fmt_cap(struct hantro_ctx *ct= x, > static int > vidioc_s_fmt_out_mplane(struct file *file, void *priv, struct v4l2_forma= t *f) > { > - return hantro_set_fmt_out(fh_to_ctx(priv), &f->fmt.pix_mp, HANTRO_AUTO_= POSTPROC); > + return hantro_set_fmt_out(file_to_ctx(file), &f->fmt.pix_mp, HANTRO_AUT= O_POSTPROC); > } > =20 > static int > vidioc_s_fmt_cap_mplane(struct file *file, void *priv, struct v4l2_forma= t *f) > { > - return hantro_set_fmt_cap(fh_to_ctx(priv), &f->fmt.pix_mp); > + return hantro_set_fmt_cap(file_to_ctx(file), &f->fmt.pix_mp); > } > =20 > static int vidioc_g_selection(struct file *file, void *priv, > struct v4l2_selection *sel) > { > - struct hantro_ctx *ctx =3D fh_to_ctx(priv); > + struct hantro_ctx *ctx =3D file_to_ctx(file); > =20 > /* Crop only supported on source. */ > if (!ctx->is_encoder || > @@ -691,7 +691,7 @@ static int vidioc_g_selection(struct file *file, void= *priv, > static int vidioc_s_selection(struct file *file, void *priv, > struct v4l2_selection *sel) > { > - struct hantro_ctx *ctx =3D fh_to_ctx(priv); > + struct hantro_ctx *ctx =3D file_to_ctx(file); > struct v4l2_rect *rect =3D &sel->r; > struct vb2_queue *vq; > =20 > @@ -738,7 +738,7 @@ static const struct v4l2_event hantro_eos_event =3D { > static int vidioc_encoder_cmd(struct file *file, void *priv, > struct v4l2_encoder_cmd *ec) > { > - struct hantro_ctx *ctx =3D fh_to_ctx(priv); > + struct hantro_ctx *ctx =3D file_to_ctx(file); > int ret; > =20 > ret =3D v4l2_m2m_ioctl_try_encoder_cmd(file, priv, ec); >=20 > --=20 > 2.49.0 >=20 --=20 Paul Kocialkowski, Independent contractor - sys-base - https://www.sys-base.io/ Free software developer - https://www.paulk.fr/ Expert in multimedia, graphics and embedded hardware support with Linux. --/6X2y1A/1uo421sv Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEAbcMXZQMtj1fphLChP3B6o/ulQwFAmiRLT0ACgkQhP3B6o/u lQzrNQ//exzkeWe4akWNjtSBn1Bl653EfO7v/aMS3Y3CCAKwErQrOulake7C7uWp FWmge5iMC9U/bJjnJn6lW9WfRnVUXmp5akqOeWHMSQNTJOKjpKKu2vbmpqvYuw8/ EZ2UXBGtg72QjRVuzMJ+SE6pK4JPFM8d4TgJxzk49W5ABja+ipgEbdccHOOiSC6+ uFVnPmJI1kOcxLhh4CLeJsq2rbT56LiAWFj/BcsoRnz0+2o3/E8FL3f2KG5T4/Hj 6hZjsZySX3X+bwDVFBhMXv1d/ecgXPjUrdhj2kM+v50DMAu1jbz9aNM1kFzxA01q 9uh4AeSC65gQ8YnjC8mUo9BH/9JWzvf8SsGLTqLfDxkaHZcs5dIfqvNkmTs+sAM9 syJ2hplhAYUk20Pn/AAda2drxoqYYnUjt6R+UOaVcaJMLIr2z8CS60rWr2+Uwhpd njA1mv/Zih/rq8uNN8l+j4DAQabNh8g/LPeroTO0/eF5WsPTvZM/BKtKrJgoy3Rv E+C0EwaEiCNxZH9vUSmqw/DkWRX2CBe6NoDzUGwjWGJeSAjSCgbklwdyUuhKaJq0 MTDz/VZ2xLIMFm8RRFfYBjKohUK+RXA2OHHst4bQGq0rvjqtJo9yd3UzIFz+ww+L VpD0vh+lndjqAQHcpftyzMcgB6AVADDZydaRUFdLGm9OHaeZA5k= =4/Uq -----END PGP SIGNATURE----- --/6X2y1A/1uo421sv-- --===============5941574532804230270== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip --===============5941574532804230270==--