From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 16FAD214A91; Sat, 2 Aug 2025 09:23:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126620; cv=none; b=LAyiqt2X8DUFAbsJ5EoaU7Mrms+WWTe96x5MvoG3im1q/aaRDlQG5gYwHfB1e5lqMCoSRi288yn7NAj8jK/w5h0xai08jSr/8zjwScHgzKix/wMPNI2iCOlq4qMhoMIVimgjp1kKlKvuvLU4UrjyqffMqfpdHB6X0pC6xgjcItU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126620; c=relaxed/simple; bh=uc+e4D121XpcsbBTsetI8Y/3AlX9Hz46SjF1XOt24QQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Da0/GQsqDXWdPgIQ5G5DqvTtdb0GI9UoxNASs031PA8of0XG5mhcy1yWETYnQIkDgO6KLaZl7UqfCTSFr1dg+FGVF2oJsZPEZv6u2mYz6DD7sN4iabnHyjc45rndoVbge5NtBeqSadhmY5i1H2Sdn1Nzq32TgeesmizbMr7Zrzw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=V5iDpcEs; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="V5iDpcEs" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 11CC83DA; Sat, 2 Aug 2025 11:22:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126570; bh=uc+e4D121XpcsbBTsetI8Y/3AlX9Hz46SjF1XOt24QQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=V5iDpcEspRPnvHfAwmOr99+IOUj9lDyUHdxF6w3FWnwGAO1+33nGVL7N9XM5qQJqa zG/eRFBKfgJFJiJ1JPZ3l47lLiuJfgv5GQ7AvAEbP6KtwH3xGSQXtSsVwcwTytnmGT 2HukJ/5pnKY6Jk6oBPJzo8ZfDbDuVBmWfAaONPC8= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:23 +0200 Subject: [PATCH 01/65] media: pci: saa7164: Store v4l2_fh pointer in file->private_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-1-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=10416; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=4KYc+fAfF5XAqGdIeu1Z3mk2YUK/u81xqaNfmxJ3Ufs=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj3RHqWTU3HuCd37ITdQdY7tRmUtJ6lQQYz0 KMrHWu85E+JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y9wAKCRByNAaPFqFW PEKcD/98jLHB4HokFvLEJrxTaXM/Serb/l7Ex/Uds/UYB8jQLGOeF/4nWiAMeE9ljn9idNeoexQ YzY6l5ipNXYKt8SpqjiNJ0WO/2Yu6CvTgBB7URe02gA2bJNnXjlBGXmaquBHBzvqaJLaz4cn8eu 9624b/9DQMRo0VVg4uAyclXwBLHSlBzZ5jUbAOIB1iqi1oSuzh5AhiboRs+OAb7yk3xRj+F2ew0 GfBOXE7qHxtzXyt2mHc+evzBcTOScHKEZDy/ZcwqAFCkR0x/up3I3ICsyrfPCZKQ13BrHEtjmGP zZnYt/jFmUjMiHVUFG+JBSOGkZAXEEW/I6lvsFLYnWvOBrGQS6TiLo+44PBa9V8XRzp8pddAr/+ ejretpCpgosNlOQhdUuxxMedmu2B7Duot57BIAfx6kWQEkqwr3/3UY2eenTgITzQwFfBNyJ9QmR VTwgKdM0gzy6KGahbRc2ln1oaGCZyGoQNRvwjH2BCKZnuqyzzKhd03K2v43qHXtOJjwKoaSRkvl wrtb2LZ6gJ/2U2diVU9sidMTAUioUH0zt7e4AsxR/3MKBafy/+lXdohYJWdFBpW/qXgLjqJVlvh tS0iQ5SoNtCBJlRnbw0ak+o40Le5sVvkLGvfdWa0pE8ENPBX2N8vVjRt8dpKg+3XN/7Bxq/cRzj wzQUMrJx6Nx3rng== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Most V4L2 drivers store the v4l2_fh pointer in file->private_data. The saa7164 instead stores the pointer to the driver-specific structure that embeds the v4l2_fh. Switch to storing the v4l2_fh pointer itself to standardize behaviour across drivers. This also prepares for future refactoring that depends on v4l2_fh being stored in private_data. This also fixes a bug in the vidioc_g_std() in saa7164-vbi.c that casts the private_data void pointer to a saa7164_encoder_fh instead of a saa7164_vbi_fh. The bug has no practical consequence as the two structures are identical. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/pci/saa7164/saa7164-encoder.c | 27 +++++++++++++------------= -- drivers/media/pci/saa7164/saa7164-vbi.c | 22 +++++++++++----------- drivers/media/pci/saa7164/saa7164.h | 10 ++++++++++ 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/drivers/media/pci/saa7164/saa7164-encoder.c b/drivers/media/pc= i/saa7164/saa7164-encoder.c index bf73e9e83f52324ca494816f7d9fa2fae7de6774..296f50b6b8d38e0ab617f0990d8= f697ba96b0016 100644 --- a/drivers/media/pci/saa7164/saa7164-encoder.c +++ b/drivers/media/pci/saa7164/saa7164-encoder.c @@ -219,7 +219,7 @@ int saa7164_s_std(struct saa7164_port *port, v4l2_std_i= d id) =20 static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id) { - struct saa7164_encoder_fh *fh =3D file->private_data; + struct saa7164_encoder_fh *fh =3D to_saa7164_encoder_fh(file); =20 return saa7164_s_std(fh->port, id); } @@ -232,7 +232,7 @@ int saa7164_g_std(struct saa7164_port *port, v4l2_std_i= d *id) =20 static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id) { - struct saa7164_encoder_fh *fh =3D file->private_data; + struct saa7164_encoder_fh *fh =3D to_saa7164_encoder_fh(file); =20 return saa7164_g_std(fh->port, id); } @@ -277,7 +277,7 @@ int saa7164_g_input(struct saa7164_port *port, unsigned= int *i) =20 static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) { - struct saa7164_encoder_fh *fh =3D file->private_data; + struct saa7164_encoder_fh *fh =3D to_saa7164_encoder_fh(file); =20 return saa7164_g_input(fh->port, i); } @@ -301,14 +301,14 @@ int saa7164_s_input(struct saa7164_port *port, unsign= ed int i) =20 static int vidioc_s_input(struct file *file, void *priv, unsigned int i) { - struct saa7164_encoder_fh *fh =3D file->private_data; + struct saa7164_encoder_fh *fh =3D to_saa7164_encoder_fh(file); =20 return saa7164_s_input(fh->port, i); } =20 int saa7164_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) { - struct saa7164_encoder_fh *fh =3D file->private_data; + struct saa7164_encoder_fh *fh =3D to_saa7164_encoder_fh(file); struct saa7164_port *port =3D fh->port; struct saa7164_dev *dev =3D port->dev; =20 @@ -347,7 +347,7 @@ int saa7164_g_frequency(struct saa7164_port *port, stru= ct v4l2_frequency *f) static int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { - struct saa7164_encoder_fh *fh =3D file->private_data; + struct saa7164_encoder_fh *fh =3D to_saa7164_encoder_fh(file); =20 return saa7164_g_frequency(fh->port, f); } @@ -400,7 +400,7 @@ int saa7164_s_frequency(struct saa7164_port *port, static int vidioc_s_frequency(struct file *file, void *priv, const struct v4l2_frequency *f) { - struct saa7164_encoder_fh *fh =3D file->private_data; + struct saa7164_encoder_fh *fh =3D to_saa7164_encoder_fh(file); =20 return saa7164_s_frequency(fh->port, f); } @@ -483,7 +483,7 @@ static int saa7164_s_ctrl(struct v4l2_ctrl *ctrl) static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct saa7164_encoder_fh *fh =3D file->private_data; + struct saa7164_encoder_fh *fh =3D to_saa7164_encoder_fh(file); struct saa7164_port *port =3D fh->port; struct saa7164_dev *dev =3D port->dev; =20 @@ -510,7 +510,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, v= oid *priv, static int vidioc_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { - struct saa7164_encoder_fh *fh =3D file->private_data; + struct saa7164_encoder_fh *fh =3D to_saa7164_encoder_fh(file); struct saa7164_port *port =3D fh->port; =20 f->fmt.pix.pixelformat =3D V4L2_PIX_FMT_MPEG; @@ -726,14 +726,14 @@ static int fops_open(struct file *file) fh->port =3D port; v4l2_fh_init(&fh->fh, video_devdata(file)); v4l2_fh_add(&fh->fh); - file->private_data =3D fh; + file->private_data =3D &fh->fh; =20 return 0; } =20 static int fops_release(struct file *file) { - struct saa7164_encoder_fh *fh =3D file->private_data; + struct saa7164_encoder_fh *fh =3D to_saa7164_encoder_fh(file); struct saa7164_port *port =3D fh->port; struct saa7164_dev *dev =3D port->dev; =20 @@ -787,7 +787,7 @@ saa7164_user_buffer *saa7164_enc_next_buf(struct saa716= 4_port *port) static ssize_t fops_read(struct file *file, char __user *buffer, size_t count, loff_t *pos) { - struct saa7164_encoder_fh *fh =3D file->private_data; + struct saa7164_encoder_fh *fh =3D to_saa7164_encoder_fh(file); struct saa7164_port *port =3D fh->port; struct saa7164_user_buffer *ubuf =3D NULL; struct saa7164_dev *dev =3D port->dev; @@ -893,8 +893,7 @@ static ssize_t fops_read(struct file *file, char __user= *buffer, static __poll_t fops_poll(struct file *file, poll_table *wait) { __poll_t req_events =3D poll_requested_events(wait); - struct saa7164_encoder_fh *fh =3D - (struct saa7164_encoder_fh *)file->private_data; + struct saa7164_encoder_fh *fh =3D to_saa7164_encoder_fh(file); struct saa7164_port *port =3D fh->port; __poll_t mask =3D v4l2_ctrl_poll(file, wait); =20 diff --git a/drivers/media/pci/saa7164/saa7164-vbi.c b/drivers/media/pci/sa= a7164/saa7164-vbi.c index ac958a5fca78e5094d7befd8c125fa4233bb6999..a7e398f304725c7fa5aa4cf1edf= 0deb0df059641 100644 --- a/drivers/media/pci/saa7164/saa7164-vbi.c +++ b/drivers/media/pci/saa7164/saa7164-vbi.c @@ -144,28 +144,28 @@ static int saa7164_vbi_initialize(struct saa7164_port= *port) /* -- V4L2 --------------------------------------------------------- */ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id id) { - struct saa7164_vbi_fh *fh =3D file->private_data; + struct saa7164_vbi_fh *fh =3D to_saa7164_vbi_fh(file); =20 return saa7164_s_std(fh->port->enc_port, id); } =20 static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *id) { - struct saa7164_encoder_fh *fh =3D file->private_data; + struct saa7164_vbi_fh *fh =3D to_saa7164_vbi_fh(file); =20 return saa7164_g_std(fh->port->enc_port, id); } =20 static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) { - struct saa7164_vbi_fh *fh =3D file->private_data; + struct saa7164_vbi_fh *fh =3D to_saa7164_vbi_fh(file); =20 return saa7164_g_input(fh->port->enc_port, i); } =20 static int vidioc_s_input(struct file *file, void *priv, unsigned int i) { - struct saa7164_vbi_fh *fh =3D file->private_data; + struct saa7164_vbi_fh *fh =3D to_saa7164_vbi_fh(file); =20 return saa7164_s_input(fh->port->enc_port, i); } @@ -173,7 +173,7 @@ static int vidioc_s_input(struct file *file, void *priv= , unsigned int i) static int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { - struct saa7164_vbi_fh *fh =3D file->private_data; + struct saa7164_vbi_fh *fh =3D to_saa7164_vbi_fh(file); =20 return saa7164_g_frequency(fh->port->enc_port, f); } @@ -181,7 +181,7 @@ static int vidioc_g_frequency(struct file *file, void *= priv, static int vidioc_s_frequency(struct file *file, void *priv, const struct v4l2_frequency *f) { - struct saa7164_vbi_fh *fh =3D file->private_data; + struct saa7164_vbi_fh *fh =3D to_saa7164_vbi_fh(file); int ret =3D saa7164_s_frequency(fh->port->enc_port, f); =20 if (ret =3D=3D 0) @@ -192,7 +192,7 @@ static int vidioc_s_frequency(struct file *file, void *= priv, static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct saa7164_vbi_fh *fh =3D file->private_data; + struct saa7164_vbi_fh *fh =3D to_saa7164_vbi_fh(file); struct saa7164_port *port =3D fh->port; struct saa7164_dev *dev =3D port->dev; =20 @@ -429,14 +429,14 @@ static int fops_open(struct file *file) fh->port =3D port; v4l2_fh_init(&fh->fh, video_devdata(file)); v4l2_fh_add(&fh->fh); - file->private_data =3D fh; + file->private_data =3D &fh->fh; =20 return 0; } =20 static int fops_release(struct file *file) { - struct saa7164_vbi_fh *fh =3D file->private_data; + struct saa7164_vbi_fh *fh =3D to_saa7164_vbi_fh(file); struct saa7164_port *port =3D fh->port; struct saa7164_dev *dev =3D port->dev; =20 @@ -489,7 +489,7 @@ saa7164_user_buffer *saa7164_vbi_next_buf(struct saa716= 4_port *port) static ssize_t fops_read(struct file *file, char __user *buffer, size_t count, loff_t *pos) { - struct saa7164_vbi_fh *fh =3D file->private_data; + struct saa7164_vbi_fh *fh =3D to_saa7164_vbi_fh(file); struct saa7164_port *port =3D fh->port; struct saa7164_user_buffer *ubuf =3D NULL; struct saa7164_dev *dev =3D port->dev; @@ -596,7 +596,7 @@ static ssize_t fops_read(struct file *file, char __user= *buffer, =20 static __poll_t fops_poll(struct file *file, poll_table *wait) { - struct saa7164_vbi_fh *fh =3D (struct saa7164_vbi_fh *)file->private_data; + struct saa7164_vbi_fh *fh =3D to_saa7164_vbi_fh(file); struct saa7164_port *port =3D fh->port; __poll_t mask =3D 0; =20 diff --git a/drivers/media/pci/saa7164/saa7164.h b/drivers/media/pci/saa716= 4/saa7164.h index e1bac1fe19d3098792b2051b537857e3f13054d5..7b511f7f1cfc305a9ffe60722b9= ebe093163787d 100644 --- a/drivers/media/pci/saa7164/saa7164.h +++ b/drivers/media/pci/saa7164/saa7164.h @@ -180,12 +180,22 @@ struct saa7164_encoder_fh { atomic_t v4l_reading; }; =20 +static inline struct saa7164_encoder_fh *to_saa7164_encoder_fh(struct file= *filp) +{ + return container_of(filp->private_data, struct saa7164_encoder_fh, fh); +} + struct saa7164_vbi_fh { struct v4l2_fh fh; struct saa7164_port *port; atomic_t v4l_reading; }; =20 +static inline struct saa7164_vbi_fh *to_saa7164_vbi_fh(struct file *filp) +{ + return container_of(filp->private_data, struct saa7164_vbi_fh, fh); +} + struct saa7164_histogram_bucket { u32 val; u32 count; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 7315620B81B; Sat, 2 Aug 2025 09:23:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126629; cv=none; b=Z8n3LxArR0LKJsvMvc/DLjTlTk02CkOXW0Xf6L8PUxeoxWB34Eo7EUybO/Cq7fQixv9bO6dnn8efdibfLJLFKC0olnJSUqQcFPJLNbio3KIGUDft0igPPrObIQ+IVb6W0j7laFeyDYowLHfIq2NvXp/qj08+SN0Afws1L8mNYBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126629; c=relaxed/simple; bh=K8dDCPVG1nkY6ic4h3FKwjvVzHTUjGzd1GG1sYDnoFA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e0SZxS5eTN3INCIkuuiX+MMXSMA7oibf4gdxNjBpPSiXBRICR/HURqVPczaqmVYVYbylTXBV1Yde6yoqPwIbq6UGi+KCbkDb7r/0BlwSp6WfJoZnpkbymsL3ifXa0z0yEPBGoOK/qffG4yHZuQpeG15EbxPzMbsZ/++1AQcggGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=g8cVRCST; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="g8cVRCST" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 50061725; Sat, 2 Aug 2025 11:22:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126580; bh=K8dDCPVG1nkY6ic4h3FKwjvVzHTUjGzd1GG1sYDnoFA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=g8cVRCST89q8XYffSHxu1w8tRa9g2WsNGAItA5r8tH7V/DbNblJ6jc6QvVyhgL8GB eKkqv3HG0YcDlIfWs/kNrYjBUoXt/w9rLBJirlDl0OvkFCg0Gk7qcnY3MaZSyFiphj CNoEtAx/JHqYMJ4o7RcXRdqE15IMUkcyVG52VhQU= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:24 +0200 Subject: [PATCH 02/65] media: imagination: Store v4l2_fh pointer in file->private_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-2-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4825; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=uq3V2iL6jCR+ekaMlo1+qk6d+aP7IFCv3nHFixV02JI=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj30OFbTXcU0cO/acV0mQKqOVtG4JiSgWCWT g8NFanNpkOJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y9wAKCRByNAaPFqFW PHCED/4vrTjKJYdLSEILTxmBH365qg3YmPx3URIJqZdf8km+nCKwi18Ewh7L8dvElXpn+jZJHMK iKF6lVmZ0nmIlIRlnH0Se6dmxhUSypRm6TuyQrsNID25XEkTcjN53a2+mk/NPFIGywdmIT7RxA0 bhfdBlfEJs53trejkMhGwCeigYz4KCwv9Jp+4R6xKuTII7IzCGi4ChSkK84RyAQYIYJrePAGgWY DNIXleinVIw/43K55GUapypW1rzzVB57Hf8PJCHKazRfD5Gxqmz51P8817+/bcabIMfp6b+wk0w /xgE23R2n45by1ZqRZPJgg3RSjyYhQ+SZEIojBzMxHsjz7ER/Uqp74kbaBK46lUromE5rNJKVIi 8fkdjLbmGlxHZIVaJG+mc83ADCfH572DS8t0knqjYlieQGK8F2wak6rvN/voGvF7UM3oZpjURwb Le9qpnU9LdYcS5WGJ2/ZjuWgjv6j4DwdSmxEHhtqX4Y21ggO8HrL6lWdhdvk943omp9GFgDPGWt qv5A5St0/fo6JY1FcZYd/AV2SbfJoaCb6aaaFuo/Ore1XBRkOSzj3IFDFCDa0wlOGaAqVsM1GNr /oaORYpASWFGcUWz2IBIjnFDw+QsEUtkzz9n5Hf3Yw+ojHMdNjUAQa2UzZxJhtL9XlP9gjqDZ/Q 1WxsRYX5yD/TxHA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Most V4L2 drivers store the v4l2_fh pointer in file->private_data. The e5010-jpeg-enc driver instead stores the pointer to the driver-specific structure that embeds the v4l2_fh. Switch to storing the v4l2_fh pointer itself to standardize behaviour across drivers. This also prepares for future refactoring that depends on v4l2_fh being stored in private_data. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/platform/imagination/e5010-jpeg-enc.c | 18 +++++++++--------- drivers/media/platform/imagination/e5010-jpeg-enc.h | 5 +++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/imagination/e5010-jpeg-enc.c b/drivers/= media/platform/imagination/e5010-jpeg-enc.c index ae868d9f73e13fdac747ef603e08ea13cd66d3a6..295461325862fb2bcac755cf815= 955955b37e6f0 100644 --- a/drivers/media/platform/imagination/e5010-jpeg-enc.c +++ b/drivers/media/platform/imagination/e5010-jpeg-enc.c @@ -253,7 +253,7 @@ static int e5010_enum_fmt(struct file *file, void *priv= , struct v4l2_fmtdesc *f) { int i, index =3D 0; struct e5010_fmt *fmt =3D NULL; - struct e5010_context *ctx =3D file->private_data; + struct e5010_context *ctx =3D to_e5010_context(file); =20 if (!V4L2_TYPE_IS_MULTIPLANAR(f->type)) { v4l2_err(&ctx->e5010->v4l2_dev, "ENUMFMT with Invalid type: %d\n", f->ty= pe); @@ -279,7 +279,7 @@ static int e5010_enum_fmt(struct file *file, void *priv= , struct v4l2_fmtdesc *f) =20 static int e5010_g_fmt(struct file *file, void *priv, struct v4l2_format *= f) { - struct e5010_context *ctx =3D file->private_data; + struct e5010_context *ctx =3D to_e5010_context(file); struct e5010_q_data *queue; int i; struct v4l2_pix_format_mplane *pix_mp =3D &f->fmt.pix_mp; @@ -380,14 +380,14 @@ static int e5010_jpeg_try_fmt(struct v4l2_format *f, = struct e5010_context *ctx) =20 static int e5010_try_fmt(struct file *file, void *priv, struct v4l2_format= *f) { - struct e5010_context *ctx =3D file->private_data; + struct e5010_context *ctx =3D to_e5010_context(file); =20 return e5010_jpeg_try_fmt(f, ctx); } =20 static int e5010_s_fmt(struct file *file, void *priv, struct v4l2_format *= f) { - struct e5010_context *ctx =3D file->private_data; + struct e5010_context *ctx =3D to_e5010_context(file); struct vb2_queue *vq; int ret =3D 0, i =3D 0; struct v4l2_pix_format_mplane *pix_mp =3D &f->fmt.pix_mp; @@ -462,7 +462,7 @@ static int e5010_enum_framesizes(struct file *file, voi= d *priv, struct v4l2_frms =20 static int e5010_g_selection(struct file *file, void *fh, struct v4l2_sele= ction *s) { - struct e5010_context *ctx =3D file->private_data; + struct e5010_context *ctx =3D to_e5010_context(file); struct e5010_q_data *queue; =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) @@ -490,7 +490,7 @@ static int e5010_g_selection(struct file *file, void *f= h, struct v4l2_selection =20 static int e5010_s_selection(struct file *file, void *fh, struct v4l2_sele= ction *s) { - struct e5010_context *ctx =3D file->private_data; + struct e5010_context *ctx =3D to_e5010_context(file); struct e5010_q_data *queue; struct vb2_queue *vq; struct v4l2_rect base_rect; @@ -742,7 +742,7 @@ static int e5010_open(struct file *file) } =20 v4l2_fh_init(&ctx->fh, vdev); - file->private_data =3D ctx; + file->private_data =3D &ctx->fh; v4l2_fh_add(&ctx->fh); =20 ctx->e5010 =3D e5010; @@ -781,7 +781,7 @@ static int e5010_open(struct file *file) static int e5010_release(struct file *file) { struct e5010_dev *e5010 =3D video_drvdata(file); - struct e5010_context *ctx =3D file->private_data; + struct e5010_context *ctx =3D to_e5010_context(file); =20 dprintk(e5010, 1, "Releasing instance: 0x%p, m2m_ctx: 0x%p\n", ctx, ctx->= fh.m2m_ctx); mutex_lock(&e5010->mutex); @@ -1262,7 +1262,7 @@ static void e5010_buf_queue(struct vb2_buffer *vb) static int e5010_encoder_cmd(struct file *file, void *priv, struct v4l2_encoder_cmd *cmd) { - struct e5010_context *ctx =3D file->private_data; + struct e5010_context *ctx =3D to_e5010_context(file); int ret; struct vb2_queue *cap_vq; =20 diff --git a/drivers/media/platform/imagination/e5010-jpeg-enc.h b/drivers/= media/platform/imagination/e5010-jpeg-enc.h index 71f49ead68980c83fd81b19fd63d9abd47abef64..eefaf60489d3fba518acd12709f= 2e4831686620b 100644 --- a/drivers/media/platform/imagination/e5010-jpeg-enc.h +++ b/drivers/media/platform/imagination/e5010-jpeg-enc.h @@ -120,6 +120,11 @@ struct e5010_context { u8 chroma_qp[QP_TABLE_SIZE]; }; =20 +static inline struct e5010_context *to_e5010_context(struct file *filp) +{ + return container_of(filp->private_data, struct e5010_context, fh); +} + /* * Buffer structure * Contains info for all buffers --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 A591020E00B; Sat, 2 Aug 2025 09:23:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126638; cv=none; b=NEg2D+LVvPNcV8ItW9UgK0NN533LGku8XOrVRUYu49gRUJeeFJhJTBmtE3chxl8H9euwjcRb8LgE+11nKLjTyrnunGh8BmoDa6boVwlnI1o2XIEqeQYhw1k/VfFDyn/wRx5raE7gYETmO8H9prGeDp44nG7Sj4bY+XAYfGQXwvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126638; c=relaxed/simple; bh=M16fcXPSFGIgO1fjImCRLdBNZivtR5rZm3smOC67Dos=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VkIOzMAnc+g3/+TMBP9nNXfXezYMZp4My29qpisw48d4lo0cTpbf9Pt7ZdNQpLHdabYrWmyeoH8OA++NoNCu+1gSgiSfFWcJBW5bIxEVSSmJnGgYmI2F4H+1HRLmTFnx8K6eSXLB3euTnfeJtInaS9cescge3wlanBCBkZNju5s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Xh5QMoMj; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Xh5QMoMj" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3885A842; Sat, 2 Aug 2025 11:23:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126589; bh=M16fcXPSFGIgO1fjImCRLdBNZivtR5rZm3smOC67Dos=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Xh5QMoMjqrqkgjHWdCiChhC1kdX3rt6vslL7ao3U194rehb2t/LzhlzZlqrh6+4Li TXEK7x4SM24jeMVMI9tnUtNWGlre6MKBX/a1G7iPg7TPV5tvdJ4RtiQc9hq6VaiCnv i2Hx8PcD5E6xY6KEeR7bvKmTwPdPJt9t1aXwo9Q4= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:25 +0200 Subject: [PATCH 03/65] media: ti: vpe: Store v4l2_fh pointer in file->private_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-3-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3454; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=Np6gXh7MItHymabBs1Yqzt+CAwSTLfj7TvMeffHrbwk=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj33+4XwqxYN9ZW66BafwfZLuLpBrwno2f/A DUK8COJi/uJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y9wAKCRByNAaPFqFW PAwfD/9nt85cmSPVXvNKQvfs5+zCtyPn2ct+RqtRZcjNxMi7ESzI1Hd093H9IIFBZSRZ4js9WNd SR4bWDMxl4ZMN3Z15rOrZEiyXKKAsu7Mjczefb5pYS67Rt0zsQR4M3vBAyjSgt4ONv/YOPnyJUv A/52sMC/hiQTgIJBrXaRA9qrECHWA1TMDYIDhdFZ/wJQWSd0NtEXkHnDmrtP2S38BtR03Rph1Iw +atlfcIB85GJX5d9Z4qXFlxfbm+EzZN5wzwP2wo3o1SZ08cbgOoBxuYYL+y15d4BmaWjlInbYEg Y8n2vsiO/Bhhqlg5rFC27ReaLp3GU0OgdlWkvoe7Mul/hXsRqFBXYgXTITfEfKYXA/h9ngMaUwC zJ5Gl3JNY/bevC/OE7UUStL/LwSByKeXsWAAIgK5g87BIN/iwMoIvLBpeEhf3/bIujUIrs0TxJ9 /e2/GqK06yKJoqucWoTtgYEwYGsxxOfMZRPj1gS1nyFpJKkpEjc/6cj5A39OUSpa3SO2TBZekO0 f5Mz3BWD7OjNemqOtj7qWsC9Q+Inze9auS33BFlI1MEnsZAoOcZWnXFqmb7jQSi1bgOJkzvSF1Q q3ddzKvIzhgXHi8v2KnEilNsO2s2MzBSzpqBIKTBKzAAhCtYWz+IxE8ZD+ax14Ax4/cNmk2ruLZ vHl5gQqKJGgGbbQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Most V4L2 drivers store the v4l2_fh pointer in file->private_data. The ti-vpe driver instead stores the pointer to the driver-specific structure that embeds the v4l2_fh. Switch to storing the v4l2_fh pointer itself to standardize behaviour across drivers. This also prepares for future refactoring that depends on v4l2_fh being stored in private_data. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/platform/ti/vpe/vpe.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/ti/vpe/vpe.c b/drivers/media/platform/t= i/vpe/vpe.c index 636d76ecebcd7e6f4e98d6fe4873bf98b0f0239e..b76b5d18c963d9a3313d34cfe0e= 12772738d336f 100644 --- a/drivers/media/platform/ti/vpe/vpe.c +++ b/drivers/media/platform/ti/vpe/vpe.c @@ -422,6 +422,10 @@ struct vpe_ctx { unsigned int src_mv_buf_selector; }; =20 +static inline struct vpe_ctx *to_vpe_ctx(struct file *filp) +{ + return container_of(filp->private_data, struct vpe_ctx, fh); +} =20 /* * M2M devices get 2 queues. @@ -1562,7 +1566,7 @@ static int vpe_enum_fmt(struct file *file, void *priv, static int vpe_g_fmt(struct file *file, void *priv, struct v4l2_format *f) { struct v4l2_pix_format_mplane *pix =3D &f->fmt.pix_mp; - struct vpe_ctx *ctx =3D file->private_data; + struct vpe_ctx *ctx =3D to_vpe_ctx(file); struct vb2_queue *vq; struct vpe_q_data *q_data; =20 @@ -1719,7 +1723,7 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct = v4l2_format *f, =20 static int vpe_try_fmt(struct file *file, void *priv, struct v4l2_format *= f) { - struct vpe_ctx *ctx =3D file->private_data; + struct vpe_ctx *ctx =3D to_vpe_ctx(file); struct vpe_fmt *fmt =3D find_format(f); =20 if (V4L2_TYPE_IS_OUTPUT(f->type)) @@ -1783,7 +1787,7 @@ static int __vpe_s_fmt(struct vpe_ctx *ctx, struct v4= l2_format *f) static int vpe_s_fmt(struct file *file, void *priv, struct v4l2_format *f) { int ret; - struct vpe_ctx *ctx =3D file->private_data; + struct vpe_ctx *ctx =3D to_vpe_ctx(file); =20 ret =3D vpe_try_fmt(file, priv, f); if (ret) @@ -1871,7 +1875,7 @@ static int __vpe_try_selection(struct vpe_ctx *ctx, s= truct v4l2_selection *s) static int vpe_g_selection(struct file *file, void *fh, struct v4l2_selection *s) { - struct vpe_ctx *ctx =3D file->private_data; + struct vpe_ctx *ctx =3D to_vpe_ctx(file); struct vpe_q_data *q_data; struct v4l2_pix_format_mplane *pix; bool use_c_rect =3D false; @@ -1935,7 +1939,7 @@ static int vpe_g_selection(struct file *file, void *f= h, static int vpe_s_selection(struct file *file, void *fh, struct v4l2_selection *s) { - struct vpe_ctx *ctx =3D file->private_data; + struct vpe_ctx *ctx =3D to_vpe_ctx(file); struct vpe_q_data *q_data; struct v4l2_selection sel =3D *s; int ret; @@ -2306,7 +2310,7 @@ static int vpe_open(struct file *file) init_adb_hdrs(ctx); =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D ctx; + file->private_data =3D &ctx->fh; =20 hdl =3D &ctx->hdl; v4l2_ctrl_handler_init(hdl, 1); @@ -2400,7 +2404,7 @@ static int vpe_open(struct file *file) static int vpe_release(struct file *file) { struct vpe_dev *dev =3D video_drvdata(file); - struct vpe_ctx *ctx =3D file->private_data; + struct vpe_ctx *ctx =3D to_vpe_ctx(file); =20 vpe_dbg(dev, "releasing instance %p\n", ctx); =20 --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 E97AB1FE44A; Sat, 2 Aug 2025 09:24:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126647; cv=none; b=GMSR+TZ3Wymab21DW8jCX67ZIXUNQrp3qn4uF+Xd1wQyH/5J46+Z2h3aTHM2ZkLFtFqwGuRiFhbOGh7Dx6t0mWRXxYo8jP5S8axzDRNsa57PPwoMuYSZxodHFfAUdIG0DQNTpWGkWFe0TUZ6bzgzkZYL3ER5z3guY7tRpYGK6qY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126647; c=relaxed/simple; bh=631Jp9Q9HtN9dP9KUd1m/USa3iWCujlx3YtZUAdIf8E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=j9wU6MkcNFmL5DQUS96tYAuEbjkPygxPk1bPYWrM1fLtnY/ZxJdCuVCjjd6qjKCeiGGjoXS7NQGcwglcE88fX+VB7TfEE7CJCTmZidzY/0K0oOTe0yXmH4uMSNuDjOkZwsuFClfa95EimG+Lm/mo8TEEP2ld/7N5lT1Gur8ocEg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=FeVm5O50; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FeVm5O50" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 03757502; Sat, 2 Aug 2025 11:23:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126598; bh=631Jp9Q9HtN9dP9KUd1m/USa3iWCujlx3YtZUAdIf8E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=FeVm5O500dAmHc2FksbxPqgQmgW5GMwIICmDuqzmrqW1P+fvOYimsBC2slbLUqXrT UZ3uSbVeYpxuIDXjRKJglyXn/I65Mk5wCu91MEMoXSdfCsaEXVLON2seHpotu5RwP7 4sV78CbR0Tx7kMmKq3k42zHLANw0S2gHetQnb24A= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:26 +0200 Subject: [PATCH 04/65] media: usb: hdpvr: Store v4l2_fh pointer in file->private_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-4-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1433; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=U3ev2gHGjMj8nv+N40Llo7W3J8u/K6ZbwlVUowvWkPY=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj3IH8fOMbXUtz0tvCIWrGh/p06iInRR+vXC v8mXTbAB3CJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y9wAKCRByNAaPFqFW PMxMD/9xdPurBF8VH9kd+ouOYLKov7Q5+LoHrIxqJ1UmDxRqFU3cO2MMwZir0jLofAtJI5rkUR3 V/NT8hmtjI3UXxxJnEpD+ZLVGI8qtV5fTPhrqUA0Cqsou7Z1ZgYlXxaois9AatHd0k8fKXD0nGV WU5MTu7++Qlpxc3Colj8npAsI+74hEi7EVtryKMKExVO95DbQz8ZvFb4gN+9r8zWpNTuTkVk0Ke KJNA+SL0fju2ltzBe8i2SQ7BjApa2Z6059yEyxr2yJLTEfc4t0JpV/uvlW0KsiAnB2lTdFlt3T6 FzlvYChBMTK9kTeCxaeoQwyzdAzhjXDqed3+BggT4OVG1MfcrjjGDOg89bfW1FZhaaiLIxHsIpF g/t2ipysNOfmIpKA92HLCwhXD3SDVxFys7fS7BZD9Za4Fad7qVXbZmC7VBViUZKhL2YE2oYRtkl Zrt7aTUMq+RQqNTyGuETmZjBztDsa/sRSGt6h7Nqtm4uvcZzzzQle2M1PrmN5w4zI2ruGtdtl1q KSbYZ3jrn7KwZ2Blc3ZvdCnk+3ve5t26EsLWgug6iwjcfsdJ3gww59pmjztFYyHyVRCaVvmbh2T 92VnFLQpUlDOLSaq3tzbDu3xtgyD/a7vHtT5QgPR3/f83oXPm985F2rNinVeA5rDqLEQ4hlk80q 2F2/YsprDujyjMw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Most V4L2 drivers store the v4l2_fh pointer in file->private_data. The hdpvr driver instead stores the pointer to the driver-specific structure that embeds the v4l2_fh. Switch to storing the v4l2_fh pointer itself to standardize behaviour across drivers. This also prepares for future refactoring that depends on v4l2_fh being stored in private_data. No extensive driver refactoring is required, as file->private_data is only used to check if a file handle is the owner of the device by comparing pointer values. The private_data pointer is actually compared to a struct v4l2_fh pointer, which happens to be the first field of the hdpvr_fh structure. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/usb/hdpvr/hdpvr-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpv= r/hdpvr-video.c index fd7d2a9d0449ab9ba68ddfa148a167797ea243fc..4c431bd9b50352ed1bd3da3e626= 25c9cff6c149d 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -381,7 +381,7 @@ static int hdpvr_open(struct file *file) fh->legacy_mode =3D true; v4l2_fh_init(&fh->fh, video_devdata(file)); v4l2_fh_add(&fh->fh); - file->private_data =3D fh; + file->private_data =3D &fh->fh; return 0; } =20 --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 2B37E218599; Sat, 2 Aug 2025 09:24:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126657; cv=none; b=VtwK6vXLjzSLXPRQU/MPPH4fGasAsk4/GIIFKMiePmgJdqIgpw24QZlvAhBx0ElHGHFpONHy9bR6YvAezGIVCihVuLs4drlEPqtGPdWKihvOWeQwxQfeKKsufErM4VgjvG5zL5ipape9M+z+vbA3piUD3uCiAER19vVQPDtxGnw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126657; c=relaxed/simple; bh=mNwsrp8nKBFkxt7rY+U2M0OWq3GCR2R2XCAdJROLTOk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hJOWqJzfc36X4/ZKUfzkoFRleMvCL3MqyIWQUPBc2wv12zryybBQ8UCVhthy63V2rKn0VR7YHTrh7An1VjVriU3q49ZsCUTas/WcRv8cNsj+wC0FTbJ0sjCBmbFqH7GETclj1zJAmG7aXJPAvNlW3FDik/0GSPkDQvgCuXGX5/c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=DSQrpcJp; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DSQrpcJp" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E59111FB8; Sat, 2 Aug 2025 11:23:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126607; bh=mNwsrp8nKBFkxt7rY+U2M0OWq3GCR2R2XCAdJROLTOk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=DSQrpcJpBnfnT7OmTg8T90ulQGNmcBlh4d8ucTOdKvpLbk0c454FckPhqvx89LmbN vCwsaczWRTvaZ0k9oVxT+kZQiOzwlCqrykBbr80yOciofSaOG5y9ojqzKLOqAsSAeS tXDWIcl38VAzTMKDnlZqvDHs1RcnBOQ+A2SpHYuE= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:27 +0200 Subject: [PATCH 05/65] media: usb: pvrusb2: Store v4l2_fh pointer in file->private_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-5-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=12175; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=DSu4UoxpEI7+C8U0CFqaBAzFa/k6azaXzHEH5+Tqsoc=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj3R4AfuAC2TJCoNxPqDBbjsGQjJnpQyMW4D KkVjzOho0OJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y9wAKCRByNAaPFqFW POxeD/9ExwrndtJFz6iR4YDFf0BLDxKErSKTK/afTEs5q0CH65ApkZAHCJY8P+DafxkZC6dhQs/ FKeKJECblq8zWsiCLBQSlKWrQ4FtBv/k+AYc/ofRZjh3EbLoeIUTJ0cbNrsQ7AGdhfhTPFFU30e C4eCLQuc+225WsAE8KYIyB12r9uUmvgJQHhm8a6qGAOe6YRyuds4Joq02dAQEpapyXc3KF6R3Hn jQ5QyVq6rH4whyspYj4kzz+mxZbCVCk48KKkp9wsFiFqbodkGD6mocULwH5doghE7QtLwFF3Lg4 a6yYMvkRM06NBl02+FeuPdvO05U0129VqG1g2sF+sblwWtuDERQrBYIUecqK5MJMGyrC1qv5Txf 5F66LgYJNKZmDkSdiqxGovRdWFZ2YdCMZefML7l8oRXOS4jVQlNPDdrPIBTu/KYU2+vg4bWo1kn 6zj2WN7iplFyzBWKl82TbT0J25cvW1JyDnis+1Wc0o48T2F73ZrZ5ZmCLBk6xYnpzKNXPL+Nr5u 4p/tbDwClXn2GnXj6tgWCp21CkC50GbQo2ESvwSgbAjN5XUsM4YZOi5iBwpziWhN9uIGotVke2W fyF4ouplFpyvQX6L5Ue3MnKLlaNVb0HiTUrQrE4uGASpLjucw9ad2cgbPlq+C7lKEFycnTYxzQc mZLE0DJcIa1guEQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Most V4L2 drivers store the v4l2_fh pointer in file->private_data. The pvrusb2 driver instead stores the pointer to the driver-specific structure that embeds the v4l2_fh. Switch to storing the v4l2_fh pointer itself to standardize behaviour across drivers. This also prepares for future refactoring that depends on v4l2_fh being stored in private_data. While at it, drop unneeded structure forward declarations. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 65 +++++++++++++++++-----------= ---- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/p= vrusb2/pvrusb2-v4l2.c index ad38e12405419caad056af8866b14ea621f0c2a1..7dc7c90ebf621c594bf5236276c= 402462d694a0a 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -21,8 +21,6 @@ #include #include =20 -struct pvr2_v4l2_dev; -struct pvr2_v4l2_fh; struct pvr2_v4l2; =20 struct pvr2_v4l2_dev { @@ -48,6 +46,11 @@ struct pvr2_v4l2_fh { unsigned int input_cnt; }; =20 +static inline struct pvr2_v4l2_fh *to_pvr2_v4l2_fh(struct file *filp) +{ + return container_of(filp->private_data, struct pvr2_v4l2_fh, fh); +} + struct pvr2_v4l2 { struct pvr2_channel channel; =20 @@ -108,7 +111,7 @@ static struct v4l2_format pvr_format [] =3D { */ static int pvr2_querycap(struct file *file, void *priv, struct v4l2_capabi= lity *cap) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; =20 strscpy(cap->driver, "pvrusb2", sizeof(cap->driver)); @@ -123,7 +126,7 @@ static int pvr2_querycap(struct file *file, void *priv,= struct v4l2_capability * =20 static int pvr2_g_std(struct file *file, void *priv, v4l2_std_id *std) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; int val =3D 0; int ret; @@ -136,7 +139,7 @@ static int pvr2_g_std(struct file *file, void *priv, v4= l2_std_id *std) =20 static int pvr2_s_std(struct file *file, void *priv, v4l2_std_id std) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; int ret; =20 @@ -148,7 +151,7 @@ static int pvr2_s_std(struct file *file, void *priv, v4= l2_std_id std) =20 static int pvr2_querystd(struct file *file, void *priv, v4l2_std_id *std) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; int val =3D 0; int ret; @@ -161,7 +164,7 @@ static int pvr2_querystd(struct file *file, void *priv,= v4l2_std_id *std) =20 static int pvr2_enum_input(struct file *file, void *priv, struct v4l2_inpu= t *vi) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; struct pvr2_ctrl *cptr; struct v4l2_input tmp; @@ -209,7 +212,7 @@ static int pvr2_enum_input(struct file *file, void *pri= v, struct v4l2_input *vi) =20 static int pvr2_g_input(struct file *file, void *priv, unsigned int *i) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; unsigned int idx; struct pvr2_ctrl *cptr; @@ -231,7 +234,7 @@ static int pvr2_g_input(struct file *file, void *priv, = unsigned int *i) =20 static int pvr2_s_input(struct file *file, void *priv, unsigned int inp) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; int ret; =20 @@ -286,7 +289,7 @@ static int pvr2_s_audio(struct file *file, void *priv, = const struct v4l2_audio * =20 static int pvr2_g_tuner(struct file *file, void *priv, struct v4l2_tuner *= vt) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; =20 if (vt->index !=3D 0) @@ -298,7 +301,7 @@ static int pvr2_g_tuner(struct file *file, void *priv, = struct v4l2_tuner *vt) =20 static int pvr2_s_tuner(struct file *file, void *priv, const struct v4l2_t= uner *vt) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; int ret; =20 @@ -314,7 +317,7 @@ static int pvr2_s_tuner(struct file *file, void *priv, = const struct v4l2_tuner * =20 static int pvr2_s_frequency(struct file *file, void *priv, const struct v4= l2_frequency *vf) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; unsigned long fv; struct v4l2_tuner vt; @@ -349,7 +352,7 @@ static int pvr2_s_frequency(struct file *file, void *pr= iv, const struct v4l2_fre =20 static int pvr2_g_frequency(struct file *file, void *priv, struct v4l2_fre= quency *vf) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; int val =3D 0; int cur_input; @@ -391,7 +394,7 @@ static int pvr2_enum_fmt_vid_cap(struct file *file, voi= d *priv, struct v4l2_fmtd =20 static int pvr2_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_f= ormat *vf) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; int val; =20 @@ -411,7 +414,7 @@ static int pvr2_g_fmt_vid_cap(struct file *file, void *= priv, struct v4l2_format =20 static int pvr2_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2= _format *vf) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; int lmin, lmax, ldef; struct pvr2_ctrl *hcp, *vcp; @@ -449,7 +452,7 @@ static int pvr2_try_fmt_vid_cap(struct file *file, void= *priv, struct v4l2_forma =20 static int pvr2_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_f= ormat *vf) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; struct pvr2_ctrl *hcp, *vcp; int ret =3D pvr2_try_fmt_vid_cap(file, fh, vf); @@ -466,7 +469,7 @@ static int pvr2_s_fmt_vid_cap(struct file *file, void *= priv, struct v4l2_format =20 static int pvr2_streamon(struct file *file, void *priv, enum v4l2_buf_type= i) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; struct pvr2_v4l2_dev *pdi =3D fh->pdi; int ret; @@ -485,7 +488,7 @@ static int pvr2_streamon(struct file *file, void *priv,= enum v4l2_buf_type i) =20 static int pvr2_streamoff(struct file *file, void *priv, enum v4l2_buf_typ= e i) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; =20 if (!fh->pdi->stream) { @@ -500,7 +503,7 @@ static int pvr2_streamoff(struct file *file, void *priv= , enum v4l2_buf_type i) static int pvr2_query_ext_ctrl(struct file *file, void *priv, struct v4l2_query_ext_ctrl *vc) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; struct pvr2_ctrl *cptr; int val; @@ -561,7 +564,7 @@ static int pvr2_query_ext_ctrl(struct file *file, void = *priv, =20 static int pvr2_querymenu(struct file *file, void *priv, struct v4l2_query= menu *vm) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; unsigned int cnt =3D 0; int ret; @@ -577,7 +580,7 @@ static int pvr2_querymenu(struct file *file, void *priv= , struct v4l2_querymenu * static int pvr2_g_ext_ctrls(struct file *file, void *priv, struct v4l2_ext_controls *ctls) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; struct v4l2_ext_control *ctrl; struct pvr2_ctrl *cptr; @@ -612,7 +615,7 @@ static int pvr2_g_ext_ctrls(struct file *file, void *pr= iv, static int pvr2_s_ext_ctrls(struct file *file, void *priv, struct v4l2_ext_controls *ctls) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; struct v4l2_ext_control *ctrl; unsigned int idx; @@ -637,7 +640,7 @@ static int pvr2_s_ext_ctrls(struct file *file, void *pr= iv, static int pvr2_try_ext_ctrls(struct file *file, void *priv, struct v4l2_ext_controls *ctls) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; struct v4l2_ext_control *ctrl; struct pvr2_ctrl *pctl; @@ -659,7 +662,7 @@ static int pvr2_try_ext_ctrls(struct file *file, void *= priv, static int pvr2_g_pixelaspect(struct file *file, void *priv, int type, struct v4l2_fract *f) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; struct v4l2_cropcap cap =3D { .type =3D type }; int ret; @@ -675,7 +678,7 @@ static int pvr2_g_pixelaspect(struct file *file, void *= priv, static int pvr2_g_selection(struct file *file, void *priv, struct v4l2_selection *sel) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; struct v4l2_cropcap cap; int val =3D 0; @@ -726,7 +729,7 @@ static int pvr2_g_selection(struct file *file, void *pr= iv, static int pvr2_s_selection(struct file *file, void *priv, struct v4l2_selection *sel) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; int ret; =20 @@ -758,7 +761,7 @@ static int pvr2_s_selection(struct file *file, void *pr= iv, =20 static int pvr2_log_status(struct file *file, void *priv) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); struct pvr2_hdw *hdw =3D fh->channel.mc_head->hdw; =20 pvr2_hdw_trigger_module_log(hdw); @@ -882,7 +885,7 @@ static void pvr2_v4l2_internal_check(struct pvr2_channe= l *chp) =20 static int pvr2_v4l2_release(struct file *file) { - struct pvr2_v4l2_fh *fhp =3D file->private_data; + struct pvr2_v4l2_fh *fhp =3D to_pvr2_v4l2_fh(file); struct pvr2_v4l2 *vp =3D fhp->pdi->v4lp; struct pvr2_hdw *hdw =3D fhp->channel.mc_head->hdw; =20 @@ -1000,7 +1003,7 @@ static int pvr2_v4l2_open(struct file *file) } =20 fhp->file =3D file; - file->private_data =3D fhp; + file->private_data =3D &fhp->fh; =20 fhp->fw_mode_flag =3D pvr2_hdw_cpufw_get_enabled(hdw); v4l2_fh_add(&fhp->fh); @@ -1055,7 +1058,7 @@ static int pvr2_v4l2_iosetup(struct pvr2_v4l2_fh *fh) static ssize_t pvr2_v4l2_read(struct file *file, char __user *buff, size_t count, loff_t *ppos) { - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); int ret; =20 if (fh->fw_mode_flag) { @@ -1117,7 +1120,7 @@ static ssize_t pvr2_v4l2_read(struct file *file, static __poll_t pvr2_v4l2_poll(struct file *file, poll_table *wait) { __poll_t mask =3D 0; - struct pvr2_v4l2_fh *fh =3D file->private_data; + struct pvr2_v4l2_fh *fh =3D to_pvr2_v4l2_fh(file); int ret; =20 if (fh->fw_mode_flag) { --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 8F0BC21B1B9; Sat, 2 Aug 2025 09:24:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126670; cv=none; b=W1XcDLDFY9lRCBrz8ddboCLyEkuE1zn/3Ywi2G7tttUn/Xf/uuIk3GIDniKvX24KYFeon7zMcs+28cpFAPawl5yRXtsPRaglNluuLvpiTVUWBM0d2bt216GV3DrGTVQILa7HVGP1Ri43JZebBweZ6opQ2wD23WxtU+jqN5czTyQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126670; c=relaxed/simple; bh=Q7uNkMZiUR/bAyP4ReuiDNkh5bQApW2xlrBUgmJ6QKo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eF9lmQ9T4wG2Y5F65j+nkfKPI/nzKKTccVhUnX1rXPPt3TBl0Kj1+D6CxvMVrVWnym4Cixy38YQJ21+ivQimrHNiOFhekie2bgGNGx7QUIsxr8pDMHos6m2EKkbJ49XXvV3GY25MR5tRDyv8GzaD+oSRbEL91zbC1WflMLzsufg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Qt496vmQ; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Qt496vmQ" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 47C052F92; Sat, 2 Aug 2025 11:23:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126621; bh=Q7uNkMZiUR/bAyP4ReuiDNkh5bQApW2xlrBUgmJ6QKo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Qt496vmQr+qgRMEyIl/SE5sDskG6fnGheHq330f4+774KPf1LlMV6RbdNuJemqYqG X7RsbLsmtdNfm5DTLA3eAM1LHQYhURvKCf7WCrdPCz2daf9D16QJi8hfMMMcPN/sxp b+t4QKddTrOPi6Gw761qhfKA91B7QpjLKRcr2Ci0= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:28 +0200 Subject: [PATCH 06/65] media: usb: uvcvideo: Store v4l2_fh pointer in file->private_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-6-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3116; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=k2a8LQETJyWR2lrXA5s/EIpHnltWb4lK+Y+yCXeLDbQ=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj3Cd24ST01biVMwBnhdcgc4JexWZ1RRHGt6 aNTUJytO6yJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y9wAKCRByNAaPFqFW PIrWEADEzYQUUXusyN/5PWZduwqYASEKZjv3DhemKWy8omxWHHGL3V9ygO/Zol0UXvAoIY9izDS hr345GKKuuTwjhpINb5X5WA4+XF2HALGBUqjz6HitPEAMfpIcgoY5YIKgXGr+AnFt8ek/O5XpPq xROsipH50X/KAV4TQvzwZ5uAd8jdhhp6ZaE0urbSbMnjXsUsPo9Gv/gV8U67dscDYaGZRWPgOWh wONEr4lo12lq8KatT2n4sCh3wwTrnZdZ7j+aFIr5RRQgk0X0FktXVvP54fkYznShPJweiwzsdNc 0BfieQ+5ILTSxHpg4rUYUuCg7pffwRYZqZeiPA64J1dPt+F9w5cbsuosMjmv2Mmv/+boOXoedVI w14RJpIVw5Dk1DJVu8M/6cPCnVByEEur0OLw/5I3s4/Mbj5ETl5DGnxrbKAsvOk9QmlvLzcgRRy mNr7LP5r4VJvrlJpr06z1ySN664lNIxPVlHvSVtSHmPCDhi8k48ls7XU5eKOJLwRsTg2icjuNXw lSy/pVjVukWETb7QUZQgc9UCzsmzSM7LTMyAHMbG/n+GWLokosseFjabHRBRhH9O5W7u9hpnrnf 96tc/uGLksh7ycinpXbc9zMBpKWIeTZGLVlIplk84LyM4vrwot3YFdmKPdK8EdTnZ9pD0MN3NPq ZeGWw2RI7zpMoLQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Most V4L2 drivers store the v4l2_fh pointer in file->private_data. The uvcvideo driver instead stores the pointer to the driver-specific structure that embeds the v4l2_fh. Switch to storing the v4l2_fh pointer itself to standardize behaviour across drivers. This also prepares for future refactoring that depends on v4l2_fh being stored in private_data. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/usb/uvc/uvc_v4l2.c | 10 +++++----- drivers/media/usb/uvc/uvcvideo.h | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v= 4l2.c index 160f9cf6e6dbdbf39e3eff56a5d5ea1d977fbe22..6dd329a972fda5c2574231b8526= 105676df3d4a1 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -603,14 +603,14 @@ static int uvc_v4l2_open(struct file *file) v4l2_fh_add(&handle->vfh); handle->chain =3D stream->chain; handle->stream =3D stream; - file->private_data =3D handle; + file->private_data =3D &handle->vfh; =20 return 0; } =20 static int uvc_v4l2_release(struct file *file) { - struct uvc_fh *handle =3D file->private_data; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_streaming *stream =3D handle->stream; =20 uvc_dbg(stream->dev, CALLS, "%s\n", __func__); @@ -626,7 +626,7 @@ static int uvc_v4l2_release(struct file *file) static int uvc_ioctl_querycap(struct file *file, void *fh, struct v4l2_capability *cap) { - struct uvc_fh *handle =3D file->private_data; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_video_chain *chain =3D handle->chain; struct uvc_streaming *stream =3D handle->stream; =20 @@ -1170,7 +1170,7 @@ static int uvc_v4l2_put_xu_query(const struct uvc_xu_= control_query *kp, static long uvc_v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) { - struct uvc_fh *handle =3D file->private_data; + struct uvc_fh *handle =3D to_uvc_fh(file); union { struct uvc_xu_control_mapping xmap; struct uvc_xu_control_query xqry; @@ -1221,7 +1221,7 @@ static long uvc_v4l2_compat_ioctl32(struct file *file, static long uvc_v4l2_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - struct uvc_fh *handle =3D file->private_data; + struct uvc_fh *handle =3D to_uvc_fh(file); unsigned int converted_cmd =3D v4l2_translate_cmd(cmd); int ret; =20 diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvi= deo.h index 757254fc4fe930ae61c9d0425f04d4cd074a617e..8b56252030480b8a5d2ef6de249= 02b544357ff02 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -637,6 +637,11 @@ struct uvc_fh { unsigned int pending_async_ctrls; }; =20 +static inline struct uvc_fh *to_uvc_fh(struct file *filp) +{ + return container_of(filp->private_data, struct uvc_fh, vfh); +} + /* ------------------------------------------------------------------------ * Debugging, printing and logging */ --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 2882920AF87; Sat, 2 Aug 2025 09:24:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126679; cv=none; b=Dvs4SvZTiu1EIx43xZ7cFWwP7ykYbM/1VU7xaWyL1N0Yw3YsMsOuaQ+HJWEjGP9ase6tS91Xx6zhK9k9Au+oTsc/YkVGLkxyJ/TP39CtOCKZpH3lzI9qxbz4kdDUyIpdUoEwEGj0RdIXV34ZX27pRGJJEsL4D+qPr73I08OYwwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126679; c=relaxed/simple; bh=6F3PmnRdTsR6MP0pAkheGJaZIteib7h3Mt38QOL4+ks=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MHD7Sz2Tuy8cXRbrITLkdwAyo+dHXVzoKNS7QCJV8G0fB1Y8XPkt4FEyNPbLZjv3SUwlQc5Ik99yo67GtmgPaPvTVtSdteTIZyYOxbXHhzjDNbdzq0HWfoUB4ZagAFgpBS3aD8UUIHor8dT31KzJlzQ9hYkcR2MMdsljhQJtIqA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=rAFxA493; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rAFxA493" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BCA411741; Sat, 2 Aug 2025 11:23:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126630; bh=6F3PmnRdTsR6MP0pAkheGJaZIteib7h3Mt38QOL4+ks=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rAFxA493SWAD9TKKi/8m6Hv+f3yVH6PRa9hRM3hBnrJQOoaSrfgP62Rrltl40evok C5qla7DhplXPFGaijSw8DaDg6nxNxBBJidrW2Jc5A2cAuKm1xh4hu9gekA4a35DdgQ rE2UrWTUAmvbnSBwN7+1sWr/1aDIf4+mcroDG+YM= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:29 +0200 Subject: [PATCH 07/65] media: staging: most: Store v4l2_fh pointer in file->private_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-7-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2287; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=d1NV4J7Giad62JgBsrW5PwS1cT7NJmAZ57UHAI1qwVg=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj4d2z3dXIt37s+JMRVX5xja57etKpuYf7wo w1WB8WrjYGJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+AAKCRByNAaPFqFW PKm9D/9cOtEDkLOKZwjwKkZQThkzdJmTDjhOz4PDCmlo2gyCGRkvtl9sCDXyx6IFzek1RzaMV4M ojKA+L06VoolHAjP9McH2iYSVvbx9IGkWX6g2bQaw3b4RPQJt/TaMpqmMxBrCs0OlCQhqhOnLTo lmwiFYLW9XqtmrQcOVEHPuEKna2X1pKfKX73eOm/WlDOVbksbN6uMkOrk/9sHkshZS3imopwIoX OywTU1stICqKyghDw7nC/v7lllKShDBaOkrbkIfS+XlLpWdPwv50HF/2WzOn25+D36ttakcZBx6 Cjyskopw7Td+2t/zKTZcYtj28/U0xC9N1OOwgTwVwyhQXKRzdd/5gOnKqBYifJSQhATNhCwY85f CWb9xknx3/Y5pjngkIj0YVOKy2DD9Bbocipp9rSF7BbQvOZhnEZZFQyFTd6zmLoAvAKXZJU6R/A W2jjCmzX7MNuVSa9j/F923fad/g2S9VaJmrlYL4AeUxKa1VhKCwhNlyFHa2/KzDgkPh7AWQ99Xa pMofXhpiIAdlCkX7rNpdqkiIRlytrnbhqnAhUFQtMpZohW6hBxc1ECBKdMaayvVssNdvDhuQTsn PSFFLv/XcnpqSj64xb73UcbzR2357sniQCZsr+79OOKiwECemqEy9EDBOhL/zSH0EenrSWHKifx 8W0FfhQ7Q2FtIew== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Most V4L2 drivers store the v4l2_fh pointer in file->private_data. The most driver instead stores the pointer to the driver-specific structure that embeds the v4l2_fh. Switch to storing the v4l2_fh pointer itself to standardize behaviour across drivers. This also prepares for future refactoring that depends on v4l2_fh being stored in private_data. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/staging/most/video/video.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/vide= o/video.c index 2b3cdb1ce1404cd13655c780f1215c364ce1a70f..bce7ffeac8fe50d3442f4993ae4= 9ab5fc96ec3cd 100644 --- a/drivers/staging/most/video/video.c +++ b/drivers/staging/most/video/video.c @@ -52,6 +52,11 @@ struct comp_fh { u32 offs; }; =20 +static inline struct comp_fh *to_comp_fh(struct file *filp) +{ + return container_of(filp->private_data, struct comp_fh, fh); +} + static LIST_HEAD(video_devices); static DEFINE_SPINLOCK(list_lock); =20 @@ -91,7 +96,7 @@ static int comp_vdev_open(struct file *filp) =20 fh->mdev =3D mdev; v4l2_fh_init(&fh->fh, vdev); - filp->private_data =3D fh; + filp->private_data =3D &fh->fh; =20 v4l2_fh_add(&fh->fh); =20 @@ -115,7 +120,7 @@ static int comp_vdev_open(struct file *filp) =20 static int comp_vdev_close(struct file *filp) { - struct comp_fh *fh =3D filp->private_data; + struct comp_fh *fh =3D to_comp_fh(filp); struct most_video_dev *mdev =3D fh->mdev; struct mbo *mbo, *tmp; =20 @@ -151,7 +156,7 @@ static int comp_vdev_close(struct file *filp) static ssize_t comp_vdev_read(struct file *filp, char __user *buf, size_t count, loff_t *pos) { - struct comp_fh *fh =3D filp->private_data; + struct comp_fh *fh =3D to_comp_fh(filp); struct most_video_dev *mdev =3D fh->mdev; int ret =3D 0; =20 @@ -200,7 +205,7 @@ static ssize_t comp_vdev_read(struct file *filp, char _= _user *buf, =20 static __poll_t comp_vdev_poll(struct file *filp, poll_table *wait) { - struct comp_fh *fh =3D filp->private_data; + struct comp_fh *fh =3D to_comp_fh(filp); struct most_video_dev *mdev =3D fh->mdev; __poll_t mask =3D 0; =20 --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 7132E21FF3F; Sat, 2 Aug 2025 09:24:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126690; cv=none; b=h4iVQGvpaokuHpPBaYHVMp4EUczTxbOxyuFEmJUlsUE/3RUudkT0Ml5PkG+SlObxxO5Eo2RQMMA9qAAPEfItE4KBIVNBaZacEomwl9fAcxtBCURVUb/7/FuDZj5VLm9mQpdBE/EkMq2SX2gH09HBW8/eVpVYZelMWYBoW8AfxEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126690; c=relaxed/simple; bh=oMQuymU0B4eBtOYGyubXKbvMqUDHa3DBTWPgyyqygGQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=n0htdxYLhkCjMxJE+5Jp9dYkPsS1BQ+jgTC2OK1jA14OHohGxv2OCgBtgB/HqbZxrN4iKbVg4Cme37yczhnIJ3SvhkAtdgyfZR8mgy/wS5ST7eWoAG15coycTpHasUI3soSXrf+2lhdXIFOyeKYGF3FnsLnDsByEecQgiEFE6dg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=tOP2mUVo; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tOP2mUVo" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8EE1F300B; Sat, 2 Aug 2025 11:23:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126640; bh=oMQuymU0B4eBtOYGyubXKbvMqUDHa3DBTWPgyyqygGQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tOP2mUVozCOLtDgbuREksonuPWduaQswmQOHGkxrsYJRILpQNfdZ7eVIg4y2O56u4 PBjF3EFBqYkiVjRUp1Fvti+mCUxyFWZ42mhKYf4Xc4XodvN4ufItRM/TfFrebQzQFm at8E2GtlpfxtrEUB6NB/kD98dzoM9Rm6kDWtYiv0= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:30 +0200 Subject: [PATCH 08/65] media: Wrap file->private_data access with a helper function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-8-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=29734; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=IwOSO7QeRnoPQdEdAMWoWLBHSh1EXaz3rzILPV/sk2Q=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj44Aabm1hEk7tTNvn0c2K3l1uhPvZ1iw++R f1Bu/7+Yp2JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+AAKCRByNAaPFqFW POjUD/9Mk2sOrvDQxzGTNaCIT2y6OMzihpUxIvmtfFNHpRRCjNRbOx4Vtu4l41LyJrsVjsFMuNC Vqry80BQxrzzbUpYlVJrIF+HK935zGN1xGOpMb8mBkEsNcYVANQUA94zGEW3CBXTNDlxjj7dcdz l7+98SLP+Q+z552qMB+xP1/h7ID7Y+XY9Zf69E6mZhwwRpst35U/RW1Y2rtxMDfiX481Jcs59jG jbU7Pl3SWZq7cbpmCVW7HgA8osReX5YnKGa9kZUhmX5xPLhyA1Ie4AQKq0qRGZflkZ4yiJ5B1dn 5PBy19AYNYZFi+W/LyZ0QJ36IeMiP28/roi8e8ErfzhCeG/u/BpzqOrxv40FtUvzWsw+AxLKcK6 yofkuoDCkyutzRZ49XHfbTU4Va95xY2wc/d5vM0E4nAW/d/k49rhvU20Rk0fWXsnps3QvX21DbN W4auI0eOHaz2tZQSgVbMHI7wSPIjYcI6iRftQGACdobq6feZuTwjn8ZenhtdkPjLe3GLJPY89XD 88h1C5S9odOUnCSh/uU88m9VvF77xgQGou4rfjj1/1+x3p60DXTpOv6t3oBH7k2+8CaHcdKL7yn 6NJ2xM61TeW4FtIdENUINIPcuBNxMZnFX64pDgAt7we89qUopOr141I4gOCcR1o9o74K98KFVZa w24cWatSG8pZ0fg== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Accessing file->private_data manually to retrieve the v4l2_fh pointer is error-prone, as the field is a void * and will happily convert implicitly to any pointer type. To avoid direct access to file->private_data, introduce a new inline function that retrieves the v4l2_fh pointer, and use it to replace common access patterns through the kernel. Changes to drivers have been generated with the following coccinelle semantic patch: @@ struct file *filp; identifier fh; @@ - struct v4l2_fh *fh =3D filp->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(filp); Manual changes have been applied to Documentation/ to update the usage patterns, and to include/media/v4l2-fh.h to add the new function. While at it, fix a typo in the title of v4l2-fh.rst: the file describes the "file handles" API, not "file handlers". No functional change is intended, this only paves the way to remove direct accesses to file->private_data and make V4L2 drivers safer. Other accesses to the field will be addressed separately. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- Documentation/driver-api/media/v4l2-fh.rst | 16 ++++++---- .../zh_CN/video4linux/v4l2-framework.txt | 2 +- drivers/media/common/videobuf2/videobuf2-v4l2.c | 2 +- drivers/media/pci/cx18/cx18-fileops.c | 2 +- drivers/media/pci/ivtv/ivtv-fileops.c | 2 +- drivers/media/platform/allegro-dvt/allegro-core.c | 2 +- .../media/platform/mediatek/jpeg/mtk_jpeg_core.c | 2 +- drivers/media/platform/nvidia/tegra-vde/v4l2.c | 2 +- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 4 +-- drivers/media/platform/renesas/vsp1/vsp1_histo.c | 6 ++-- drivers/media/platform/renesas/vsp1/vsp1_video.c | 12 ++++---- drivers/media/platform/ti/omap3isp/ispvideo.c | 2 +- drivers/media/platform/xilinx/xilinx-dma.c | 10 +++---- drivers/media/usb/uvc/uvc_metadata.c | 10 +++---- drivers/media/v4l2-core/v4l2-ctrls-api.c | 4 +-- drivers/media/v4l2-core/v4l2-fh.c | 2 +- drivers/media/v4l2-core/v4l2-mem2mem.c | 34 +++++++++++-------= ---- drivers/media/v4l2-core/v4l2-subdev.c | 8 ++--- include/media/v4l2-fh.h | 14 +++++++++ 19 files changed, 77 insertions(+), 59 deletions(-) diff --git a/Documentation/driver-api/media/v4l2-fh.rst b/Documentation/dri= ver-api/media/v4l2-fh.rst index 3eeaa8da0c9ec6a0005975551d624b48cecf7229..2c87b74578d97a171ad06d3eb60= a02cd58b557b1 100644 --- a/Documentation/driver-api/media/v4l2-fh.rst +++ b/Documentation/driver-api/media/v4l2-fh.rst @@ -1,7 +1,7 @@ .. SPDX-License-Identifier: GPL-2.0 =20 -V4L2 File handlers ------------------- +V4L2 File handles +----------------- =20 struct v4l2_fh provides a way to easily keep file handle specific data that is used by the V4L2 framework. @@ -18,7 +18,9 @@ This bit is set whenever :c:func:`v4l2_fh_init` is called. =20 struct v4l2_fh is allocated as a part of the driver's own file handle structure and ``file->private_data`` is set to it in the driver's ``open()= `` -function by the driver. +function by the driver. The :c:type:`v4l2_fh` file handle can be retrieved +from the :c:type:`file` using :c:func:`file_to_v4l2_fh`. Drivers must not +access ``file->private_data`` directly. =20 In many cases the struct v4l2_fh will be embedded in a larger structure. In that case you should call: @@ -63,7 +65,7 @@ Example: =20 int my_release(struct file *file) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); struct my_fh *my_fh =3D container_of(fh, struct my_fh, fh); =20 ... @@ -78,11 +80,9 @@ Below is a short description of the :c:type:`v4l2_fh` fu= nctions used: :c:func:`v4l2_fh_init ` (:c:type:`fh `, :c:type:`vdev `) =20 - - Initialise the file handle. This **MUST** be performed in the driver's :c:type:`v4l2_file_operations`->open() handler. =20 - :c:func:`v4l2_fh_add ` (:c:type:`fh `) =20 @@ -101,6 +101,10 @@ Below is a short description of the :c:type:`v4l2_fh` = functions used: - Uninitialise the file handle. After uninitialisation the :c:type:`v4l2_f= h` memory can be freed. =20 +:c:func:`file_to_v4l2_fh ` +(struct file \*filp) + +- Retrieve the :c:type:`v4l2_fh` instance associated with a :c:type:`file`. =20 If struct v4l2_fh is not embedded, then you can use these helper functions: =20 diff --git a/Documentation/translations/zh_CN/video4linux/v4l2-framework.tx= t b/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt index 9cc97ec75d7a4ff6a7d91a0013ac4306200c1fd8..a9eb62fa1531c69110ff17945fa= 2fcfa596f4df8 100644 --- a/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt +++ b/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt @@ -819,7 +819,7 @@ int my_open(struct file *file) =20 int my_release(struct file *file) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); struct my_fh *my_fh =3D container_of(fh, struct my_fh, fh); =20 ... diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/medi= a/common/videobuf2/videobuf2-v4l2.c index 1cd26faee50338aefeb670c6865da7c2d43f44d3..f29307e59be591d77a49e143b28= 80a31673b5e2f 100644 --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c @@ -979,7 +979,7 @@ __poll_t vb2_poll(struct vb2_queue *q, struct file *fil= e, poll_table *wait) res =3D vb2_core_poll(q, file, wait); =20 if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 poll_wait(file, &fh->wait, wait); if (v4l2_event_pending(fh)) diff --git a/drivers/media/pci/cx18/cx18-fileops.c b/drivers/media/pci/cx18= /cx18-fileops.c index cefa91b37f890c8b27d932b832c05ac158eae216..af25628b11bad9ee983e1921dc8= 9044756986940 100644 --- a/drivers/media/pci/cx18/cx18-fileops.c +++ b/drivers/media/pci/cx18/cx18-fileops.c @@ -678,7 +678,7 @@ void cx18_stop_capture(struct cx18_stream *s, int gop_e= nd) =20 int cx18_v4l2_close(struct file *filp) { - struct v4l2_fh *fh =3D filp->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(filp); struct cx18_open_id *id =3D fh2id(fh); struct cx18 *cx =3D id->cx; struct cx18_stream *s =3D &cx->streams[id->type]; diff --git a/drivers/media/pci/ivtv/ivtv-fileops.c b/drivers/media/pci/ivtv= /ivtv-fileops.c index cfa28d0355863b08b72cefce9377833e1c1440d6..230d498108b5b0d44a238cd87dc= ea061811af814 100644 --- a/drivers/media/pci/ivtv/ivtv-fileops.c +++ b/drivers/media/pci/ivtv/ivtv-fileops.c @@ -877,7 +877,7 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id,= int flags, u64 pts) =20 int ivtv_v4l2_close(struct file *filp) { - struct v4l2_fh *fh =3D filp->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(filp); struct ivtv_open_id *id =3D fh2id(fh); struct ivtv *itv =3D id->itv; struct ivtv_stream *s =3D &itv->streams[id->type]; diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/me= dia/platform/allegro-dvt/allegro-core.c index eb03df0d8652745ef533b9b7aa6c105a140ad022..1f134e08923a528cc676f825da6= 8951c97ac2f25 100644 --- a/drivers/media/platform/allegro-dvt/allegro-core.c +++ b/drivers/media/platform/allegro-dvt/allegro-core.c @@ -3483,7 +3483,7 @@ static int allegro_enum_framesizes(struct file *file,= void *fh, static int allegro_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type type) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); struct allegro_channel *channel =3D fh_to_channel(fh); int err; =20 diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers= /media/platform/mediatek/jpeg/mtk_jpeg_core.c index 7eb12449b63a59072eb3b3b86b0883c23d5a4c34..329e5787c2c282c43dcee80ceb0= f1ba337324b74 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -588,7 +588,7 @@ static int mtk_jpeg_enc_s_selection(struct file *file, = void *priv, =20 static int mtk_jpeg_qbuf(struct file *file, void *priv, struct v4l2_buffer= *buf) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_fh_to_ctx(priv); struct vb2_queue *vq; struct vb2_buffer *vb; diff --git a/drivers/media/platform/nvidia/tegra-vde/v4l2.c b/drivers/media= /platform/nvidia/tegra-vde/v4l2.c index e3726cab0c82c92cf0d552b8e8061fd22badfa90..531a85e3fe49ad0aa94fb96cbc7= a84d474faae94 100644 --- a/drivers/media/platform/nvidia/tegra-vde/v4l2.c +++ b/drivers/media/platform/nvidia/tegra-vde/v4l2.c @@ -853,7 +853,7 @@ static int tegra_open(struct file *file) =20 static int tegra_release(struct file *file) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); struct tegra_ctx *ctx =3D fh_to_tegra_ctx(fh); struct tegra_vde *vde =3D ctx->vde; =20 diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index 8681dd1930334cb455a91bbfd054fcf88ee27cbb..1b2148578cb6751056b4111c654= 2f01d76c292c8 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -1604,7 +1604,7 @@ static void mxc_jpeg_device_run(void *priv) static int mxc_jpeg_decoder_cmd(struct file *file, void *priv, struct v4l2_decoder_cmd *cmd) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(fh); unsigned long flags; int ret; @@ -1637,7 +1637,7 @@ static int mxc_jpeg_decoder_cmd(struct file *file, vo= id *priv, static int mxc_jpeg_encoder_cmd(struct file *file, void *priv, struct v4l2_encoder_cmd *cmd) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(fh); unsigned long flags; int ret; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_histo.c b/drivers/med= ia/platform/renesas/vsp1/vsp1_histo.c index c762202877babdc651a63997f4340f6a37a301ac..390ea50f1595ad7702bec46e9b9= f3e237c73a622 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_histo.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_histo.c @@ -392,7 +392,7 @@ static const struct v4l2_subdev_ops histo_ops =3D { static int histo_v4l2_querycap(struct file *file, void *fh, struct v4l2_capability *cap) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct vsp1_histogram *histo =3D vdev_to_histo(vfh->vdev); =20 cap->capabilities =3D V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING @@ -409,7 +409,7 @@ static int histo_v4l2_querycap(struct file *file, void = *fh, static int histo_v4l2_enum_format(struct file *file, void *fh, struct v4l2_fmtdesc *f) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct vsp1_histogram *histo =3D vdev_to_histo(vfh->vdev); =20 if (f->index > 0 || f->type !=3D histo->queue.type) @@ -423,7 +423,7 @@ static int histo_v4l2_enum_format(struct file *file, vo= id *fh, static int histo_v4l2_get_format(struct file *file, void *fh, struct v4l2_format *format) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct vsp1_histogram *histo =3D vdev_to_histo(vfh->vdev); struct v4l2_meta_format *meta =3D &format->fmt.meta; =20 diff --git a/drivers/media/platform/renesas/vsp1/vsp1_video.c b/drivers/med= ia/platform/renesas/vsp1/vsp1_video.c index bc66fbdde3cc1590072c3917cfe3005fade58307..656fb5e6cb303cfcde1d91c839a= 9aceca79c77f7 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_video.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_video.c @@ -896,7 +896,7 @@ static const struct vb2_ops vsp1_video_queue_qops =3D { static int vsp1_video_querycap(struct file *file, void *fh, struct v4l2_capability *c= ap) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct vsp1_video *video =3D to_vsp1_video(vfh->vdev); =20 cap->capabilities =3D V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING @@ -912,7 +912,7 @@ vsp1_video_querycap(struct file *file, void *fh, struct= v4l2_capability *cap) static int vsp1_video_enum_format(struct file *file, void *fh, struct v4l2_fmtdesc *f) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct vsp1_video *video =3D to_vsp1_video(vfh->vdev); const struct vsp1_format_info *info; =20 @@ -933,7 +933,7 @@ static int vsp1_video_enum_format(struct file *file, vo= id *fh, static int vsp1_video_get_format(struct file *file, void *fh, struct v4l2_format *for= mat) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct vsp1_video *video =3D to_vsp1_video(vfh->vdev); =20 if (format->type !=3D video->queue.type) @@ -949,7 +949,7 @@ vsp1_video_get_format(struct file *file, void *fh, stru= ct v4l2_format *format) static int vsp1_video_try_format(struct file *file, void *fh, struct v4l2_format *for= mat) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct vsp1_video *video =3D to_vsp1_video(vfh->vdev); =20 if (format->type !=3D video->queue.type) @@ -961,7 +961,7 @@ vsp1_video_try_format(struct file *file, void *fh, stru= ct v4l2_format *format) static int vsp1_video_set_format(struct file *file, void *fh, struct v4l2_format *for= mat) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct vsp1_video *video =3D to_vsp1_video(vfh->vdev); const struct vsp1_format_info *info; int ret; @@ -991,7 +991,7 @@ vsp1_video_set_format(struct file *file, void *fh, stru= ct v4l2_format *format) static int vsp1_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct vsp1_video *video =3D to_vsp1_video(vfh->vdev); struct media_device *mdev =3D &video->vsp1->media_dev; struct vsp1_pipeline *pipe; diff --git a/drivers/media/platform/ti/omap3isp/ispvideo.c b/drivers/media/= platform/ti/omap3isp/ispvideo.c index 78e30298c7ad155c70a2a369daa8c232b97e55b7..a777135c6a6ca51c85c5a75b76c= bc4a8421963ec 100644 --- a/drivers/media/platform/ti/omap3isp/ispvideo.c +++ b/drivers/media/platform/ti/omap3isp/ispvideo.c @@ -1348,7 +1348,7 @@ static int isp_video_open(struct file *file) static int isp_video_release(struct file *file) { struct isp_video *video =3D video_drvdata(file); - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct isp_video_fh *handle =3D to_isp_video_fh(vfh); =20 /* Disable streaming and free the buffers queue resources. */ diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/pla= tform/xilinx/xilinx-dma.c index 18bfa6001909dfa6efc23b3ca432a39a1b316afc..fcfe0883aba5fb8bcf954ce4be9= 56edb39e610cb 100644 --- a/drivers/media/platform/xilinx/xilinx-dma.c +++ b/drivers/media/platform/xilinx/xilinx-dma.c @@ -469,7 +469,7 @@ static const struct vb2_ops xvip_dma_queue_qops =3D { static int xvip_dma_querycap(struct file *file, void *fh, struct v4l2_capability *cap) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct xvip_dma *dma =3D to_xvip_dma(vfh->vdev); =20 cap->capabilities =3D dma->xdev->v4l2_caps | V4L2_CAP_STREAMING | @@ -491,7 +491,7 @@ xvip_dma_querycap(struct file *file, void *fh, struct v= 4l2_capability *cap) static int xvip_dma_enum_format(struct file *file, void *fh, struct v4l2_fmtdesc *f) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct xvip_dma *dma =3D to_xvip_dma(vfh->vdev); =20 if (f->index > 0) @@ -505,7 +505,7 @@ xvip_dma_enum_format(struct file *file, void *fh, struc= t v4l2_fmtdesc *f) static int xvip_dma_get_format(struct file *file, void *fh, struct v4l2_format *forma= t) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct xvip_dma *dma =3D to_xvip_dma(vfh->vdev); =20 format->fmt.pix =3D dma->format; @@ -565,7 +565,7 @@ __xvip_dma_try_format(struct xvip_dma *dma, struct v4l2= _pix_format *pix, static int xvip_dma_try_format(struct file *file, void *fh, struct v4l2_format *forma= t) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct xvip_dma *dma =3D to_xvip_dma(vfh->vdev); =20 __xvip_dma_try_format(dma, &format->fmt.pix, NULL); @@ -575,7 +575,7 @@ xvip_dma_try_format(struct file *file, void *fh, struct= v4l2_format *format) static int xvip_dma_set_format(struct file *file, void *fh, struct v4l2_format *forma= t) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct xvip_dma *dma =3D to_xvip_dma(vfh->vdev); const struct xvip_video_format *info; =20 diff --git a/drivers/media/usb/uvc/uvc_metadata.c b/drivers/media/usb/uvc/u= vc_metadata.c index 229e08ff323eed9129d835b24ea2e8085bb713b8..4cbf6ce314fdd548eb72127bf8f= 671f8a465783a 100644 --- a/drivers/media/usb/uvc/uvc_metadata.c +++ b/drivers/media/usb/uvc/uvc_metadata.c @@ -26,7 +26,7 @@ static int uvc_meta_v4l2_querycap(struct file *file, void *fh, struct v4l2_capability *cap) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct uvc_streaming *stream =3D video_get_drvdata(vfh->vdev); struct uvc_video_chain *chain =3D stream->chain; =20 @@ -42,7 +42,7 @@ static int uvc_meta_v4l2_querycap(struct file *file, void= *fh, static int uvc_meta_v4l2_get_format(struct file *file, void *fh, struct v4l2_format *format) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct uvc_streaming *stream =3D video_get_drvdata(vfh->vdev); struct v4l2_meta_format *fmt =3D &format->fmt.meta; =20 @@ -60,7 +60,7 @@ static int uvc_meta_v4l2_get_format(struct file *file, vo= id *fh, static int uvc_meta_v4l2_try_format(struct file *file, void *fh, struct v4l2_format *format) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct uvc_streaming *stream =3D video_get_drvdata(vfh->vdev); struct uvc_device *dev =3D stream->dev; struct v4l2_meta_format *fmt =3D &format->fmt.meta; @@ -86,7 +86,7 @@ static int uvc_meta_v4l2_try_format(struct file *file, vo= id *fh, static int uvc_meta_v4l2_set_format(struct file *file, void *fh, struct v4l2_format *format) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct uvc_streaming *stream =3D video_get_drvdata(vfh->vdev); struct v4l2_meta_format *fmt =3D &format->fmt.meta; int ret; @@ -115,7 +115,7 @@ static int uvc_meta_v4l2_set_format(struct file *file, = void *fh, static int uvc_meta_v4l2_enum_formats(struct file *file, void *fh, struct v4l2_fmtdesc *fdesc) { - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct uvc_streaming *stream =3D video_get_drvdata(vfh->vdev); struct uvc_device *dev =3D stream->dev; u32 i =3D fdesc->index; diff --git a/drivers/media/v4l2-core/v4l2-ctrls-api.c b/drivers/media/v4l2-= core/v4l2-ctrls-api.c index d49a68b36c28ba4b38b90b86b5bdfa631d86ada1..d46b2c8f3d23596293210125b14= 8c3da99c52cac 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-api.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-api.c @@ -1253,7 +1253,7 @@ EXPORT_SYMBOL(v4l2_querymenu); int v4l2_ctrl_log_status(struct file *file, void *fh) { struct video_device *vfd =3D video_devdata(file); - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); =20 if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) && vfd->v4l2_dev) v4l2_ctrl_handler_log_status(vfh->ctrl_handler, @@ -1348,7 +1348,7 @@ EXPORT_SYMBOL(v4l2_ctrl_subdev_subscribe_event); */ __poll_t v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 poll_wait(file, &fh->wait, wait); if (v4l2_event_pending(fh)) diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4= l2-fh.c index 90eec79ee995a2d214590beeacc91b9f8f33236d..7a5f7aa5e25341df62bb4e3380b= f19f46e2df955 100644 --- a/drivers/media/v4l2-core/v4l2-fh.c +++ b/drivers/media/v4l2-core/v4l2-fh.c @@ -90,7 +90,7 @@ EXPORT_SYMBOL_GPL(v4l2_fh_exit); =20 int v4l2_fh_release(struct file *filp) { - struct v4l2_fh *fh =3D filp->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(filp); =20 if (fh) { v4l2_fh_del(fh); diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-co= re/v4l2-mem2mem.c index eb22d6172462da2cc6256087540223210c42b181..e67e67f76f7237452c0fd705df7= afa0da4a65069 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -971,7 +971,7 @@ __poll_t v4l2_m2m_poll(struct file *file, struct v4l2_m= 2m_ctx *m2m_ctx, rc =3D v4l2_m2m_poll_for_data(file, m2m_ctx, wait); =20 if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 poll_wait(file, &fh->wait, wait); if (v4l2_event_pending(fh)) @@ -1004,7 +1004,7 @@ unsigned long v4l2_m2m_get_unmapped_area(struct file = *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); unsigned long offset =3D pgoff << PAGE_SHIFT; struct vb2_queue *vq; =20 @@ -1371,7 +1371,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_request_queue); int v4l2_m2m_ioctl_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *rb) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 return v4l2_m2m_reqbufs(file, fh->m2m_ctx, rb); } @@ -1380,7 +1380,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_reqbufs); int v4l2_m2m_ioctl_create_bufs(struct file *file, void *priv, struct v4l2_create_buffers *create) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 return v4l2_m2m_create_bufs(file, fh->m2m_ctx, create); } @@ -1389,7 +1389,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_create_bufs); int v4l2_m2m_ioctl_remove_bufs(struct file *file, void *priv, struct v4l2_remove_buffers *remove) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); struct vb2_queue *q =3D v4l2_m2m_get_vq(fh->m2m_ctx, remove->type); =20 if (!q) @@ -1404,7 +1404,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_remove_bufs); int v4l2_m2m_ioctl_querybuf(struct file *file, void *priv, struct v4l2_buffer *buf) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 return v4l2_m2m_querybuf(file, fh->m2m_ctx, buf); } @@ -1413,7 +1413,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_querybuf); int v4l2_m2m_ioctl_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 return v4l2_m2m_qbuf(file, fh->m2m_ctx, buf); } @@ -1422,7 +1422,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_qbuf); int v4l2_m2m_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 return v4l2_m2m_dqbuf(file, fh->m2m_ctx, buf); } @@ -1431,7 +1431,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_dqbuf); int v4l2_m2m_ioctl_prepare_buf(struct file *file, void *priv, struct v4l2_buffer *buf) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 return v4l2_m2m_prepare_buf(file, fh->m2m_ctx, buf); } @@ -1440,7 +1440,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_prepare_buf); int v4l2_m2m_ioctl_expbuf(struct file *file, void *priv, struct v4l2_exportbuffer *eb) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 return v4l2_m2m_expbuf(file, fh->m2m_ctx, eb); } @@ -1449,7 +1449,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_expbuf); int v4l2_m2m_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type type) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 return v4l2_m2m_streamon(file, fh->m2m_ctx, type); } @@ -1458,7 +1458,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_streamon); int v4l2_m2m_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type type) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 return v4l2_m2m_streamoff(file, fh->m2m_ctx, type); } @@ -1542,7 +1542,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_decoder_cmd); int v4l2_m2m_ioctl_encoder_cmd(struct file *file, void *priv, struct v4l2_encoder_cmd *ec) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 return v4l2_m2m_encoder_cmd(file, fh->m2m_ctx, ec); } @@ -1551,7 +1551,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_encoder_cmd); int v4l2_m2m_ioctl_decoder_cmd(struct file *file, void *priv, struct v4l2_decoder_cmd *dc) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 return v4l2_m2m_decoder_cmd(file, fh->m2m_ctx, dc); } @@ -1572,7 +1572,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_stateless_try_decode= r_cmd); int v4l2_m2m_ioctl_stateless_decoder_cmd(struct file *file, void *priv, struct v4l2_decoder_cmd *dc) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); struct vb2_v4l2_buffer *out_vb, *cap_vb; struct v4l2_m2m_dev *m2m_dev =3D fh->m2m_ctx->m2m_dev; unsigned long flags; @@ -1617,7 +1617,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_stateless_decoder_cm= d); =20 int v4l2_m2m_fop_mmap(struct file *file, struct vm_area_struct *vma) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 return v4l2_m2m_mmap(file, fh->m2m_ctx, vma); } @@ -1625,7 +1625,7 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_fop_mmap); =20 __poll_t v4l2_m2m_fop_poll(struct file *file, poll_table *wait) { - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); struct v4l2_m2m_ctx *m2m_ctx =3D fh->m2m_ctx; __poll_t ret; =20 diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-cor= e/v4l2-subdev.c index 4fd25fea3b58477056729665706ddbacc436379c..29d3b788b288675c9ec849bb14e= 1936356d95743 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -122,7 +122,7 @@ static int subdev_close(struct file *file) { struct video_device *vdev =3D video_devdata(file); struct v4l2_subdev *sd =3D vdev_to_v4l2_subdev(vdev); - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct v4l2_subdev_fh *subdev_fh =3D to_v4l2_subdev_fh(vfh); =20 if (sd->internal_ops && sd->internal_ops->close) @@ -612,7 +612,7 @@ static long subdev_do_ioctl(struct file *file, unsigned= int cmd, void *arg, { struct video_device *vdev =3D video_devdata(file); struct v4l2_subdev *sd =3D vdev_to_v4l2_subdev(vdev); - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct v4l2_subdev_fh *subdev_fh =3D to_v4l2_subdev_fh(vfh); bool ro_subdev =3D test_bit(V4L2_FL_SUBDEV_RO_DEVNODE, &vdev->flags); bool streams_subdev =3D sd->flags & V4L2_SUBDEV_FL_STREAMS; @@ -1135,7 +1135,7 @@ static long subdev_do_ioctl_lock(struct file *file, u= nsigned int cmd, void *arg) =20 if (video_is_registered(vdev)) { struct v4l2_subdev *sd =3D vdev_to_v4l2_subdev(vdev); - struct v4l2_fh *vfh =3D file->private_data; + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); struct v4l2_subdev_fh *subdev_fh =3D to_v4l2_subdev_fh(vfh); struct v4l2_subdev_state *state; =20 @@ -1192,7 +1192,7 @@ static __poll_t subdev_poll(struct file *file, poll_t= able *wait) { struct video_device *vdev =3D video_devdata(file); struct v4l2_subdev *sd =3D vdev_to_v4l2_subdev(vdev); - struct v4l2_fh *fh =3D file->private_data; + struct v4l2_fh *fh =3D file_to_v4l2_fh(file); =20 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) return EPOLLERR; diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h index b5b3e00c8e6a0b082d9cd8a0c972a5094adcb6f2..823fa8ebeb8fbe36f05a1c31d3d= 3a9b7bba4de4d 100644 --- a/include/media/v4l2-fh.h +++ b/include/media/v4l2-fh.h @@ -56,6 +56,20 @@ struct v4l2_fh { struct v4l2_m2m_ctx *m2m_ctx; }; =20 +/** + * file_to_v4l2_fh - Return the v4l2_fh associated with a struct file + * + * @filp: pointer to &struct file + * + * This function should be used by drivers to retrieve the &struct v4l2_fh + * instance pointer stored in the file private_data instead of accessing t= he + * private_data field directly. + */ +static inline struct v4l2_fh *file_to_v4l2_fh(struct file *filp) +{ + return filp->private_data; +} + /** * v4l2_fh_init - Initialise the file handle. * --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 9AE43241139; Sat, 2 Aug 2025 09:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126700; cv=none; b=aWyXUEYrC3Vb2cgtopiLwRcZQqyr/P01kQxOODoGIsFPz6YgFn22oJ6ykeJPKduIzmf+/57/extg2hLLMcX13jRz2ZTbu9sYX/bzxQ1pXykkxyLF/9UIwEA3qvqq3jYqvL7hOCesyNAjP33oY6Dr4uOkr53HWQAthQlsoUF1xQo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126700; c=relaxed/simple; bh=WfjffTcJOWLdlrWem3MdhRU1zwqLoI09JZOwJPl5TRk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hol3flN3pp43XViNAunYvboFkh0pJxTmZasqTdfYP9P3At6I9rK0u+afBcozPxLo+q2MTRIlzMpJ+BNemcXlX7dYmkt14lJ3PRD0UtCs63nakyZZFmcbPuhqogXdvHNKShT93c9tRwZAR+8kpMebkr1fcv0naTXXLVCWhBw/ydo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=I8rstv18; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="I8rstv18" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E00113064; Sat, 2 Aug 2025 11:24:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126649; bh=WfjffTcJOWLdlrWem3MdhRU1zwqLoI09JZOwJPl5TRk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=I8rstv182vkAT+hoN092Wv7YgIQiaVZUDqwiVun2l1uM++SsJ5QZLlq/TMNmB8l7N bH6IBaNCbqY0+btaxUYnxqE/cbaeo3x6Qnv187Q6UJpuAdmHYfJ3e7NambctPnz0SP /QXeLo1hfji8PwcA+xJxWqtW7oDL3YgaJ9CMawMw= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:31 +0200 Subject: [PATCH 09/65] media: Replace file->private_data access with file_to_v4l2_fh() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-9-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=22494; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=ur2C2n1/7W+w6783Glcj1/4RDB0dymp7bMnetCHDy7E=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj4imTS1pDgK8oU5ve+gl5xQgi3IQ/KaOtt2 fSo2rqwdIeJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+AAKCRByNAaPFqFW PHFcD/9X0QwsKS4VK/6vSKze8KcKUeit96e5fzfUYuUC/ubuDAGAnw5eZwrsjfogi8Rmr6Qxvl3 TyG9nwG0YxPBxKP9WEqMhVcm2YbrBsOYyAdS9ONUHNR0FU31aWWejkLcIJZUAxTDJvo+Wj/TEgO YvomhPB38PXWRTyKKDMlCpjDHwS7WhkFHPLFdKE/PI4b3+i1lr1Y8oBNVkx06Su9I4Qwf1KpIId xwvwaSw5/kyqdgkOkqsPGxbMTfePi6B2SuQNpsbpzNDEV5H4b6Bx3cGmf98ktT416At9mlZb2gD cKpFiGuie2F/zn+8yghiVJyHTcvPKh9UUGSxi+Cd3rqeBPeaK26rJsmc4Ekhn7GQGFNhcim8G3t +Ql7Kn6nwfinlYZPDnUOvD2wTxQD3/tmi20kUWAQW7WuEVkwl6cX5o3lcwRkQikeZkEi3KXArO1 DC7rF9/pGbN+y8dWLijq4bJdw16x+UfXlzm1NqTNji0HUlL829+ZQyP6t+Kp3SdMRL4B/3hal0c 1otoUL5XwxwRtj8e3V463Dtu/+LWASnF/i0odD+q77SR3bXS9t2bAvx0cRYlkb0I3Qa+ob3jxl7 84z9dwnKpRmbRyDjRWGt+vMrY9awjydfuPPfMk6OcL7+E5ZDrGu3HFCW5de98IsiURjdTe9c0Np LxJk4C8WJ3AWlgQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Accessing file->private_data manually to retrieve the v4l2_fh pointer is error-prone, as the field is a void * and will happily cast implicitly to any pointer type. Replace all remaining locations that read the v4l2_fh pointer directly from file->private_data with usage of the file_to_v4l2_fh() function. The change was generated manually. No functional change is intended, this only paves the way to remove direct accesses to file->private_data and make V4L2 drivers safer. Other accesses to the field will be addressed separately. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/pci/cx18/cx18-driver.h | 2 +- drivers/media/pci/cx18/cx18-fileops.c | 2 +- drivers/media/pci/saa7164/saa7164.h | 4 ++-- drivers/media/platform/amphion/vpu.h | 2 +- drivers/media/platform/imagination/e5010-jpeg-enc.h | 2 +- drivers/media/platform/nxp/dw100/dw100.c | 2 +- drivers/media/platform/nxp/imx-pxp.c | 2 +- drivers/media/platform/qcom/iris/iris_vidc.c | 2 +- drivers/media/platform/qcom/venus/core.h | 2 +- drivers/media/platform/samsung/s3c-camif/camif-capture.c | 6 +++--- drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 2 +- drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +- drivers/media/platform/ti/vpe/vpe.c | 2 +- drivers/media/test-drivers/vicodec/vicodec-core.c | 2 +- drivers/media/test-drivers/vim2m.c | 2 +- drivers/media/test-drivers/visl/visl.h | 2 +- drivers/media/test-drivers/vivid/vivid-core.c | 4 ++-- drivers/media/test-drivers/vivid/vivid-radio-rx.c | 4 ++-- drivers/media/test-drivers/vivid/vivid-radio-tx.c | 4 ++-- drivers/media/usb/hdpvr/hdpvr-video.c | 12 ++++++------ drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 2 +- drivers/media/usb/uvc/uvcvideo.h | 2 +- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 +- drivers/media/v4l2-core/v4l2-ioctl.c | 4 ++-- drivers/staging/most/video/video.c | 2 +- drivers/usb/gadget/function/uvc.h | 5 +++++ drivers/usb/gadget/function/uvc_v4l2.c | 2 +- 27 files changed, 43 insertions(+), 38 deletions(-) diff --git a/drivers/media/pci/cx18/cx18-driver.h b/drivers/media/pci/cx18/= cx18-driver.h index 485ca9747c4c1c4a78c7bb2cd998927b075d44e9..92acd23a8c4d0d44069accf02c8= 464bc27a15458 100644 --- a/drivers/media/pci/cx18/cx18-driver.h +++ b/drivers/media/pci/cx18/cx18-driver.h @@ -414,7 +414,7 @@ static inline struct cx18_open_id *fh2id(struct v4l2_fh= *fh) =20 static inline struct cx18_open_id *file2id(struct file *file) { - return fh2id(file->private_data); + return fh2id(file_to_v4l2_fh(file)); } =20 /* forward declaration of struct defined in cx18-cards.h */ diff --git a/drivers/media/pci/cx18/cx18-fileops.c b/drivers/media/pci/cx18= /cx18-fileops.c index af25628b11bad9ee983e1921dc89044756986940..89e38b3036309af0747362bafad= 5024413c2c5bd 100644 --- a/drivers/media/pci/cx18/cx18-fileops.c +++ b/drivers/media/pci/cx18/cx18-fileops.c @@ -709,7 +709,7 @@ int cx18_v4l2_close(struct file *filp) } =20 if (id->type =3D=3D CX18_ENC_STREAM_TYPE_YUV && - filp->private_data =3D=3D vdev->queue->owner) { + file_to_v4l2_fh(filp) =3D=3D vdev->queue->owner) { vb2_queue_release(vdev->queue); vdev->queue->owner =3D NULL; } diff --git a/drivers/media/pci/saa7164/saa7164.h b/drivers/media/pci/saa716= 4/saa7164.h index 7b511f7f1cfc305a9ffe60722b9ebe093163787d..94e987e7b5e5d4af8f3cdc7c148= eb2b33b1076b9 100644 --- a/drivers/media/pci/saa7164/saa7164.h +++ b/drivers/media/pci/saa7164/saa7164.h @@ -182,7 +182,7 @@ struct saa7164_encoder_fh { =20 static inline struct saa7164_encoder_fh *to_saa7164_encoder_fh(struct file= *filp) { - return container_of(filp->private_data, struct saa7164_encoder_fh, fh); + return container_of(file_to_v4l2_fh(filp), struct saa7164_encoder_fh, fh); } =20 struct saa7164_vbi_fh { @@ -193,7 +193,7 @@ struct saa7164_vbi_fh { =20 static inline struct saa7164_vbi_fh *to_saa7164_vbi_fh(struct file *filp) { - return container_of(filp->private_data, struct saa7164_vbi_fh, fh); + return container_of(file_to_v4l2_fh(filp), struct saa7164_vbi_fh, fh); } =20 struct saa7164_histogram_bucket { diff --git a/drivers/media/platform/amphion/vpu.h b/drivers/media/platform/= amphion/vpu.h index cac0f1a64feafc41d9f050f58004ae47f2e2ac90..bfd171a3ded40e66d0b601d9eb3= e749cb39de58c 100644 --- a/drivers/media/platform/amphion/vpu.h +++ b/drivers/media/platform/amphion/vpu.h @@ -328,7 +328,7 @@ static inline const char *vpu_core_type_desc(enum vpu_c= ore_type type) =20 static inline struct vpu_inst *to_inst(struct file *filp) { - return container_of(filp->private_data, struct vpu_inst, fh); + return container_of(file_to_v4l2_fh(filp), struct vpu_inst, fh); } =20 #define ctrl_to_inst(ctrl) \ diff --git a/drivers/media/platform/imagination/e5010-jpeg-enc.h b/drivers/= media/platform/imagination/e5010-jpeg-enc.h index eefaf60489d3fba518acd12709f2e4831686620b..da57bc1baa46403c4a91f56e152= 334fa9dd83369 100644 --- a/drivers/media/platform/imagination/e5010-jpeg-enc.h +++ b/drivers/media/platform/imagination/e5010-jpeg-enc.h @@ -122,7 +122,7 @@ struct e5010_context { =20 static inline struct e5010_context *to_e5010_context(struct file *filp) { - return container_of(filp->private_data, struct e5010_context, fh); + return container_of(file_to_v4l2_fh(filp), struct e5010_context, fh); } =20 /* diff --git a/drivers/media/platform/nxp/dw100/dw100.c b/drivers/media/platf= orm/nxp/dw100/dw100.c index 3d1db1121bf9cd4da0a8cf22f853bdfb375e74e0..2460f09a6813a320f7637bc332e= 641b7741ced21 100644 --- a/drivers/media/platform/nxp/dw100/dw100.c +++ b/drivers/media/platform/nxp/dw100/dw100.c @@ -266,7 +266,7 @@ static inline int dw100_dump_regs(struct seq_file *m) =20 static inline struct dw100_ctx *dw100_file2ctx(struct file *file) { - return container_of(file->private_data, struct dw100_ctx, fh); + return container_of(file_to_v4l2_fh(file), struct dw100_ctx, fh); } =20 static struct dw100_q_data *dw100_get_q_data(struct dw100_ctx *ctx, diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/= nxp/imx-pxp.c index 7f8ffbac582fcf6a968e5ab000827d7086c18261..879b1803a2b38c6748fa4748f25= 504665f8106bb 100644 --- a/drivers/media/platform/nxp/imx-pxp.c +++ b/drivers/media/platform/nxp/imx-pxp.c @@ -248,7 +248,7 @@ struct pxp_ctx { =20 static inline struct pxp_ctx *file2ctx(struct file *file) { - return container_of(file->private_data, struct pxp_ctx, fh); + return container_of(file_to_v4l2_fh(file), struct pxp_ctx, fh); } =20 static struct pxp_q_data *get_q_data(struct pxp_ctx *ctx, diff --git a/drivers/media/platform/qcom/iris/iris_vidc.c b/drivers/media/p= latform/qcom/iris/iris_vidc.c index c417e8c31f806e03555cd5e2a662a6efe5d58f3e..0c3b47b9958aa3388d91ffda9b2= acfbb53f09f59 100644 --- a/drivers/media/platform/qcom/iris/iris_vidc.c +++ b/drivers/media/platform/qcom/iris/iris_vidc.c @@ -69,7 +69,7 @@ static void iris_remove_session(struct iris_inst *inst) =20 static inline struct iris_inst *iris_get_inst(struct file *filp, void *fh) { - return container_of(filp->private_data, struct iris_inst, fh); + return container_of(file_to_v4l2_fh(filp), struct iris_inst, fh); } =20 static void iris_m2m_device_run(void *priv) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platf= orm/qcom/venus/core.h index 5b1ba1c69adba14c3560a4bc6d09435529f295a6..3c0c5f9dbe7bd54975e44ae87ee= 3df442305c0fe 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -535,7 +535,7 @@ struct venus_inst { =20 static inline struct venus_inst *to_inst(struct file *filp) { - return container_of(filp->private_data, struct venus_inst, fh); + return container_of(file_to_v4l2_fh(filp), struct venus_inst, fh); } =20 static inline void *to_hfi_priv(struct venus_core *core) diff --git a/drivers/media/platform/samsung/s3c-camif/camif-capture.c b/dri= vers/media/platform/samsung/s3c-camif/camif-capture.c index 3e566b65f4178a799e9172831dab6b7fa2004887..cae15a4ce5fd83f00ced8b2dfbb= 5f5a6f7483ca4 100644 --- a/drivers/media/platform/samsung/s3c-camif/camif-capture.c +++ b/drivers/media/platform/samsung/s3c-camif/camif-capture.c @@ -572,7 +572,7 @@ static int s3c_camif_close(struct file *file) =20 mutex_lock(&camif->lock); =20 - if (vp->owner =3D=3D file->private_data) { + if (vp->owner =3D=3D file_to_v4l2_fh(file)) { camif_stop_capture(vp); vb2_queue_release(&vp->vb_queue); vp->owner =3D NULL; @@ -595,7 +595,7 @@ static __poll_t s3c_camif_poll(struct file *file, __poll_t ret; =20 mutex_lock(&camif->lock); - if (vp->owner && vp->owner !=3D file->private_data) + if (vp->owner && vp->owner !=3D file_to_v4l2_fh(file)) ret =3D EPOLLERR; else ret =3D vb2_poll(&vp->vb_queue, file, wait); @@ -609,7 +609,7 @@ static int s3c_camif_mmap(struct file *file, struct vm_= area_struct *vma) struct camif_vp *vp =3D video_drvdata(file); int ret; =20 - if (vp->owner && vp->owner !=3D file->private_data) + if (vp->owner && vp->owner !=3D file_to_v4l2_fh(file)) ret =3D -EBUSY; else ret =3D vb2_mmap(&vp->vb_queue, vma); diff --git a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c b/drivers/med= ia/platform/sunxi/sun8i-di/sun8i-di.c index 3e7f2df70408b882f6c9d47b66a8e092f6960927..43755043e8af907fe6755cfe684= 8ceb655444dfc 100644 --- a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +++ b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c @@ -309,7 +309,7 @@ static void deinterlace_init(struct deinterlace_dev *de= v) =20 static inline struct deinterlace_ctx *deinterlace_file2ctx(struct file *fi= le) { - return container_of(file->private_data, struct deinterlace_ctx, fh); + return container_of(file_to_v4l2_fh(file), struct deinterlace_ctx, fh); } =20 static bool deinterlace_check_format(u32 pixelformat) diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/dri= vers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index abd10b218aa1dc552004fe7ebcb815b3d6b8a43d..d0608b5d900fc83a6c63979d21a= b3b4ce9a67af9 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -170,7 +170,7 @@ static irqreturn_t rotate_irq(int irq, void *data) =20 static inline struct rotate_ctx *rotate_file2ctx(struct file *file) { - return container_of(file->private_data, struct rotate_ctx, fh); + return container_of(file_to_v4l2_fh(file), struct rotate_ctx, fh); } =20 static void rotate_prepare_format(struct v4l2_pix_format *pix_fmt) diff --git a/drivers/media/platform/ti/vpe/vpe.c b/drivers/media/platform/t= i/vpe/vpe.c index b76b5d18c963d9a3313d34cfe0e12772738d336f..4b9b2bec7377d724c272ff76fb8= 116b65227c542 100644 --- a/drivers/media/platform/ti/vpe/vpe.c +++ b/drivers/media/platform/ti/vpe/vpe.c @@ -424,7 +424,7 @@ struct vpe_ctx { =20 static inline struct vpe_ctx *to_vpe_ctx(struct file *filp) { - return container_of(filp->private_data, struct vpe_ctx, fh); + return container_of(file_to_v4l2_fh(filp), struct vpe_ctx, fh); } =20 /* diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/me= dia/test-drivers/vicodec/vicodec-core.c index c45f5cf12ded3c8b57483b148bf7bbffb8a458c5..e27f6761cba18e78e1833745e77= 347f7405957e0 100644 --- a/drivers/media/test-drivers/vicodec/vicodec-core.c +++ b/drivers/media/test-drivers/vicodec/vicodec-core.c @@ -144,7 +144,7 @@ static const struct v4l2_event vicodec_eos_event =3D { =20 static inline struct vicodec_ctx *file2ctx(struct file *file) { - return container_of(file->private_data, struct vicodec_ctx, fh); + return container_of(file_to_v4l2_fh(file), struct vicodec_ctx, fh); } =20 static struct vicodec_q_data *get_q_data(struct vicodec_ctx *ctx, diff --git a/drivers/media/test-drivers/vim2m.c b/drivers/media/test-driver= s/vim2m.c index 1d1a9e7685050e53575a3bf09e9ff1df5aea0ee0..55d885be5bcc0541e4ea539a2fa= feeb2d76680e3 100644 --- a/drivers/media/test-drivers/vim2m.c +++ b/drivers/media/test-drivers/vim2m.c @@ -236,7 +236,7 @@ struct vim2m_ctx { =20 static inline struct vim2m_ctx *file2ctx(struct file *file) { - return container_of(file->private_data, struct vim2m_ctx, fh); + return container_of(file_to_v4l2_fh(file), struct vim2m_ctx, fh); } =20 static struct vim2m_q_data *get_q_data(struct vim2m_ctx *ctx, diff --git a/drivers/media/test-drivers/visl/visl.h b/drivers/media/test-dr= ivers/visl/visl.h index 434e9efbf9b21db4b1b903035d18e2a12f716947..ad3d0ab791d6aec4fb120dcfe86= 000e498f6713d 100644 --- a/drivers/media/test-drivers/visl/visl.h +++ b/drivers/media/test-drivers/visl/visl.h @@ -163,7 +163,7 @@ struct visl_ctrl_desc { =20 static inline struct visl_ctx *visl_file_to_ctx(struct file *file) { - return container_of(file->private_data, struct visl_ctx, fh); + return container_of(file_to_v4l2_fh(file), struct visl_ctx, fh); } =20 static inline struct visl_ctx *visl_v4l2fh_to_ctx(struct v4l2_fh *v4l2_fh) diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/= test-drivers/vivid/vivid-core.c index 8d56168c72aa09f94ba2f0bdb2415e7247e08c14..9c9a93a3b5402741642253bbd14= 87f723d58fcf5 100644 --- a/drivers/media/test-drivers/vivid/vivid-core.c +++ b/drivers/media/test-drivers/vivid/vivid-core.c @@ -654,11 +654,11 @@ static int vivid_fop_release(struct file *file) v4l2_info(&dev->v4l2_dev, "reconnect\n"); vivid_reconnect(dev); } - if (file->private_data =3D=3D dev->radio_rx_rds_owner) { + if (file_to_v4l2_fh(file) =3D=3D dev->radio_rx_rds_owner) { dev->radio_rx_rds_last_block =3D 0; dev->radio_rx_rds_owner =3D NULL; } - if (file->private_data =3D=3D dev->radio_tx_rds_owner) { + if (file_to_v4l2_fh(file) =3D=3D dev->radio_tx_rds_owner) { dev->radio_tx_rds_last_block =3D 0; dev->radio_tx_rds_owner =3D NULL; } diff --git a/drivers/media/test-drivers/vivid/vivid-radio-rx.c b/drivers/me= dia/test-drivers/vivid/vivid-radio-rx.c index 79c1723bd84cbf18060817a3b03f8d1e83990a38..be711cae2d492f8d259fda2dc03= 92a84f22565a4 100644 --- a/drivers/media/test-drivers/vivid/vivid-radio-rx.c +++ b/drivers/media/test-drivers/vivid/vivid-radio-rx.c @@ -42,13 +42,13 @@ ssize_t vivid_radio_rx_read(struct file *file, char __u= ser *buf, if (mutex_lock_interruptible(&dev->mutex)) return -ERESTARTSYS; if (dev->radio_rx_rds_owner && - file->private_data !=3D dev->radio_rx_rds_owner) { + file_to_v4l2_fh(file) !=3D dev->radio_rx_rds_owner) { mutex_unlock(&dev->mutex); return -EBUSY; } if (dev->radio_rx_rds_owner =3D=3D NULL) { vivid_radio_rds_init(dev); - dev->radio_rx_rds_owner =3D file->private_data; + dev->radio_rx_rds_owner =3D file_to_v4l2_fh(file); } =20 retry: diff --git a/drivers/media/test-drivers/vivid/vivid-radio-tx.c b/drivers/me= dia/test-drivers/vivid/vivid-radio-tx.c index 049d40b948bb25276650d8ac6a83c8adf8221e51..f6e80b8d00a673dea89311e0673= 75a8e460b81aa 100644 --- a/drivers/media/test-drivers/vivid/vivid-radio-tx.c +++ b/drivers/media/test-drivers/vivid/vivid-radio-tx.c @@ -39,11 +39,11 @@ ssize_t vivid_radio_tx_write(struct file *file, const c= har __user *buf, if (mutex_lock_interruptible(&dev->mutex)) return -ERESTARTSYS; if (dev->radio_tx_rds_owner && - file->private_data !=3D dev->radio_tx_rds_owner) { + file_to_v4l2_fh(file) !=3D dev->radio_tx_rds_owner) { mutex_unlock(&dev->mutex); return -EBUSY; } - dev->radio_tx_rds_owner =3D file->private_data; + dev->radio_tx_rds_owner =3D file_to_v4l2_fh(file); =20 retry: timestamp =3D ktime_sub(ktime_get(), dev->radio_rds_init_time); diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpv= r/hdpvr-video.c index 4c431bd9b50352ed1bd3da3e62625c9cff6c149d..ea17f1a5f5b0a01d7ae159b7f00= d65ce952f4974 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -390,7 +390,7 @@ static int hdpvr_release(struct file *file) struct hdpvr_device *dev =3D video_drvdata(file); =20 mutex_lock(&dev->io_mutex); - if (file->private_data =3D=3D dev->owner) { + if (file_to_v4l2_fh(file) =3D=3D dev->owner) { hdpvr_stop_streaming(dev); dev->owner =3D NULL; } @@ -426,7 +426,7 @@ static ssize_t hdpvr_read(struct file *file, char __use= r *buffer, size_t count, mutex_unlock(&dev->io_mutex); goto err; } - dev->owner =3D file->private_data; + dev->owner =3D file_to_v4l2_fh(file); print_buffer_status(); } mutex_unlock(&dev->io_mutex); @@ -541,7 +541,7 @@ static __poll_t hdpvr_poll(struct file *filp, poll_tabl= e *wait) "start_streaming failed\n"); dev->status =3D STATUS_IDLE; } else { - dev->owner =3D filp->private_data; + dev->owner =3D file_to_v4l2_fh(filp); } =20 print_buffer_status(); @@ -1048,7 +1048,7 @@ static int vidioc_encoder_cmd(struct file *filp, void= *priv, =20 switch (a->cmd) { case V4L2_ENC_CMD_START: - if (dev->owner && filp->private_data !=3D dev->owner) { + if (dev->owner && file_to_v4l2_fh(filp) !=3D dev->owner) { res =3D -EBUSY; break; } @@ -1056,12 +1056,12 @@ static int vidioc_encoder_cmd(struct file *filp, vo= id *priv, break; res =3D hdpvr_start_streaming(dev); if (!res) - dev->owner =3D filp->private_data; + dev->owner =3D file_to_v4l2_fh(filp); else dev->status =3D STATUS_IDLE; break; case V4L2_ENC_CMD_STOP: - if (dev->owner && filp->private_data !=3D dev->owner) { + if (dev->owner && file_to_v4l2_fh(filp) !=3D dev->owner) { res =3D -EBUSY; break; } diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/p= vrusb2/pvrusb2-v4l2.c index 7dc7c90ebf621c594bf5236276c402462d694a0a..481b03bbecf8134f75b3988e45f= c392f07ae90fd 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -48,7 +48,7 @@ struct pvr2_v4l2_fh { =20 static inline struct pvr2_v4l2_fh *to_pvr2_v4l2_fh(struct file *filp) { - return container_of(filp->private_data, struct pvr2_v4l2_fh, fh); + return container_of(file_to_v4l2_fh(filp), struct pvr2_v4l2_fh, fh); } =20 struct pvr2_v4l2 { diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvi= deo.h index 8b56252030480b8a5d2ef6de24902b544357ff02..70dc80e2b213dff333665022b34= 10b175d072793 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -639,7 +639,7 @@ struct uvc_fh { =20 static inline struct uvc_fh *to_uvc_fh(struct file *filp) { - return container_of(filp->private_data, struct uvc_fh, vfh); + return container_of(file_to_v4l2_fh(filp), struct uvc_fh, vfh); } =20 /* ------------------------------------------------------------------------ diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/= v4l2-core/v4l2-compat-ioctl32.c index 8c07400bd280dea5d2e66e2759658c423bcd3866..8a5559225ff27cde3b1b7322abd= 16bac8c1617b9 100644 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -678,7 +678,7 @@ static inline bool ctrl_is_pointer(struct file *file, u= 32 id) const struct v4l2_ioctl_ops *ops =3D vdev->ioctl_ops; =20 if (test_bit(V4L2_FL_USES_V4L2_FH, &vdev->flags)) - fh =3D file->private_data; + fh =3D file_to_v4l2_fh(file); =20 if (fh && fh->ctrl_handler) hdl =3D fh->ctrl_handler; diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core= /v4l2-ioctl.c index 46da373066f4ec786b87ef18b8372abee621332f..8c81852c30466865eca36fd4192= 3f6d05dbf9293 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1197,7 +1197,7 @@ static int v4l_s_priority(const struct v4l2_ioctl_ops= *ops, vfd =3D video_devdata(file); if (!test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) return -ENOTTY; - vfh =3D file->private_data; + vfh =3D file_to_v4l2_fh(file); return v4l2_prio_change(vfd->prio, &vfh->prio, *p); } =20 @@ -3084,7 +3084,7 @@ static long __video_do_ioctl(struct file *file, } =20 if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) - vfh =3D file->private_data; + vfh =3D file_to_v4l2_fh(file); =20 /* * We need to serialize streamon/off with queueing new requests. diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/vide= o/video.c index bce7ffeac8fe50d3442f4993ae49ab5fc96ec3cd..116331cead2a6676f2c018b3f8f= c10b0716dfc3a 100644 --- a/drivers/staging/most/video/video.c +++ b/drivers/staging/most/video/video.c @@ -54,7 +54,7 @@ struct comp_fh { =20 static inline struct comp_fh *to_comp_fh(struct file *filp) { - return container_of(filp->private_data, struct comp_fh, fh); + return container_of(file_to_v4l2_fh(filp), struct comp_fh, fh); } =20 static LIST_HEAD(video_devices); diff --git a/drivers/usb/gadget/function/uvc.h b/drivers/usb/gadget/functio= n/uvc.h index 6f44dd732315074e215f75e5df99c289f9cebe35..9e79cbe50715791a7f7ddd3bc20= e9a28d221db61 100644 --- a/drivers/usb/gadget/function/uvc.h +++ b/drivers/usb/gadget/function/uvc.h @@ -196,6 +196,11 @@ struct uvc_file_handle { #define to_uvc_file_handle(handle) \ container_of(handle, struct uvc_file_handle, vfh) =20 +static inline struct uvc_file_handle *file_to_uvc_file_handle(struct file = *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct uvc_file_handle, vfh); +} + /* ------------------------------------------------------------------------ * Functions */ diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/fu= nction/uvc_v4l2.c index fc9a8d31a1e983945838a6ac84f5b9090ac13697..886300a29b908a6dda3e2dfcb6b= 3414f782b172b 100644 --- a/drivers/usb/gadget/function/uvc_v4l2.c +++ b/drivers/usb/gadget/function/uvc_v4l2.c @@ -685,7 +685,7 @@ uvc_v4l2_release(struct file *file) { struct video_device *vdev =3D video_devdata(file); struct uvc_device *uvc =3D video_get_drvdata(vdev); - struct uvc_file_handle *handle =3D to_uvc_file_handle(file->private_data); + struct uvc_file_handle *handle =3D file_to_uvc_file_handle(file); struct uvc_video *video =3D handle->device; =20 mutex_lock(&video->mutex); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 8F7862222B4; Sat, 2 Aug 2025 09:25:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126707; cv=none; b=OPNYMkHcYtUppSbcnzHTAFV3QWilqwMT65JI1BpDckTv9Z8pJ3B8Y1ZIP7P/oSfOshFw1fzNdeoSTh0JkFiNVk6/2CuT8pLVlksgfhfqnzrgaKKpE4IFzEhm9VsUz8AbH3jVkcFGSFICGnpvyGe8DfEJfujXcaKdQm3FYI1J+OE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126707; c=relaxed/simple; bh=OM/rWlEKQ8f8HPIrakLZ0WhLkd4bPI6pfIRVXjyRJJM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cII0vYPd55dyT1mg9P/rMzy+pgG7zGy1de8NcVLcWMVBLitQW3N9NDELHkfEj22Kz+LT/2+yzHTA5RGULWmEomPOUFkwVMSTrrI/YeBhb7dTuK55Nh2HChx3KKWDCpPFe1TFK0GTzo7dOrPRm5jNc92xazc4flyJwJaU+Vbj/zs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=ib/AkYuz; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ib/AkYuz" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1FBB9305C; Sat, 2 Aug 2025 11:24:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126658; bh=OM/rWlEKQ8f8HPIrakLZ0WhLkd4bPI6pfIRVXjyRJJM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ib/AkYuzsNuKTt+lp42wfbltoMJtD5Sd4hsrRjAcqAMEf9SCjBWcBnbuX50vt5Prw 0UzYkmWn2/xlChWVoyTLLj93l8MP3fB+FzbSXSdwBfPD7QAOfvUBlQUbRUwAu4vGMY U9QTUuKMZnkPvtECT7b6OO11EXVtXW0+EZ9EHjHY= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:32 +0200 Subject: [PATCH 10/65] media: nvidia: tegra-vde: Replace file->private_data access Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-10-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1550; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=HdAr4YyOcrocqziACBpasSPBf3zgC1qgSFvP/LJn3YQ=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj41aVvy6Rjwij+qj6xHx4PUZkLAhV3n8zM3 AY+rL2WR0OJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+AAKCRByNAaPFqFW PKCIEACt+1llOB444L1nlesDr3J1k37KiM1p/lvO6eUrnhStXc7r3O+OFl93UfBTj2+YjQ1caYY lM7LmFaSuXHnMP3gnTbmwc7szdGB5nwBaaWC9+7tE6KC/GuBE1stlpZYiCRrETy9kBkUDbsLcMB pSR60pJm6pAxmSr1D3CVrswOfnMdiRhcXVgCs/M6wWA1TZQDGu1qfLANLutXJWrDgLOmQVnVYId Xb5aTkYhFgPduOVyaTA0P9lWEOMK8dsJnw7NwPugtQ01l9D6qPoZpRkbOQtm/+6HALFV6kJZPUp 6Lq3E0DGPuQUILws3PZXfBKC2EtOdoCEkR4VzIfdQ8h5OJdyyuMrIPHpBX9FtUbLtx/6kdQOiBH RfDgaYS9Y2A+IfP22V4VXYEl9+g6Db6WmbDheJO4/jdhs8jYwMXmVH1AL6M34Lj49outPp4tIpd mhYXqOjZbqNvmBGTF1dG0IKQ8wJQV+IzJbe25fkw7pYBwUv7OE15TBk/xbxjms7VbMXF18QG6S9 K4HHENXpy5GWX4kBs39GNpKJsBs4YBofJrpM0iHhNZnRFg0cXgqvt+7ryv1721kfPoBeOnx4g9r Ak3tPK/iYLW+h4M2QumwTv8Gy8yj077pLHiVgy+bJ58QTy/ARoWSLHL4dpCJH57fMvm59jr2FtI fkrkiqymIOZa3eQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Accessing file->private_data manually to retrieve the v4l2_fh pointer is error-prone, as the field is a void * and will happily cast implicitly to any pointer type. The tegra-vde driver accesses file->private_data in the tegra_open() function, right after setting the field to &ctx->fh. Replace the accesses with usage of &ctx->fh. No functional change is intended, this only paves the way to remove direct accesses to file->private_data and make V4L2 drivers safer. Other accesses to the field will be addressed separately. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/platform/nvidia/tegra-vde/v4l2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/nvidia/tegra-vde/v4l2.c b/drivers/media= /platform/nvidia/tegra-vde/v4l2.c index 531a85e3fe49ad0aa94fb96cbc7a84d474faae94..393dc3f07d5c78ff5ab0ae7b636= 8914859564458 100644 --- a/drivers/media/platform/nvidia/tegra-vde/v4l2.c +++ b/drivers/media/platform/nvidia/tegra-vde/v4l2.c @@ -836,10 +836,10 @@ static int tegra_open(struct file *file) v4l2_fh_add(&ctx->fh); =20 tegra_reset_coded_fmt(ctx); - tegra_try_coded_fmt(file, file->private_data, &ctx->coded_fmt); + tegra_try_coded_fmt(file, &ctx->fh, &ctx->coded_fmt); =20 tegra_reset_decoded_fmt(ctx); - tegra_try_decoded_fmt(file, file->private_data, &ctx->decoded_fmt); + tegra_try_decoded_fmt(file, &ctx->fh, &ctx->decoded_fmt); =20 return 0; =20 --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 3354F2222B4; Sat, 2 Aug 2025 09:25:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126720; cv=none; b=TfwFtjYQXx8DCJn2xR31sP64Gb4TfGU50mMEQa2tqN/GLfA0dty4qJaL5sRHMpbOdU5/x8vjm8iZEj/NhDhPyd+k0raeky/v7YdK4CQ7pKI77g3r/yD713bSaI4CHgR+vx74DZUCqHecNjUAnbpa5OTBGG3wLMjasmmo/JRYEfU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126720; c=relaxed/simple; bh=JH4pyiH1IYy7ONTnie74fJF2p0cwDMovrqBAsP6oUlE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ETzt4NsZ0/v+SXs52ZR5fbSoBzgWw0D55dcNAIs+I5MJTOiw7gq7OJI/On7vCrhv/DelQ34lkYLdEPNZYLDnlha/a1FaVTyn9RKlivMifgBKSBbKQj2iNsSISJueqaMsBGsvDgoWA80PmXjnEQ/QdiB3JdANfsLIPmbIw/0ZtKI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=rFG4CQtr; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rFG4CQtr" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id ED15B32CA; Sat, 2 Aug 2025 11:24:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126669; bh=JH4pyiH1IYy7ONTnie74fJF2p0cwDMovrqBAsP6oUlE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rFG4CQtrfqkzxmcS/aCmywjrbk563f+RrC/3SE6H05ZA7rG5Mm3t20dAC5ZUHw8LB jlShiIzAZPs0DutWvAZFE847i20BUl4usB/2a1bVTO+tg/n4TdvwXF74NZ1cZxPN42 BONj/HLbA1H7s1D81pnqWrNh1WLkDBUtH4tsu/7A= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:33 +0200 Subject: [PATCH 11/65] media: Replace file->private_data access with custom functions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-11-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=61718; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=tykG4RFPosriRJxJbDj8GzFXMR1j9aCB/cWW38tiygA=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj4cDiFdpyp/184uWzE42I1uMfp0U83coNSz TAaHXOey1yJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+AAKCRByNAaPFqFW PBTjEADFLzlXRpytji5w2QArq6lVsiKr8D1H0xkdlPAx2Chyp6+DNfK+/WWclxCoqPc/qBHewbw mE+0Cmp5jtwVX/cj/75RZLzqzodVRC4z02kMuEP4xQhqu7o169nUhMZDtnp6Lo7wDPceKvgspGp hxkfxRtD0nvCRpZDxxwuzTptqz5MW8AqUkRECnxQxZ6NfFYlTp+7PerNXO7H//qyed33zcEW4+A qRt/1U1502+01kjt0xE2W28EA0cLqECn0+LVPRt8OaF+FK9RVS/1d8ByNIHWyrgeqnNcD82Df2d 8VIYVMtIIkDx77RtVVPM0apuNYfCeMGuGYagW9qzr/kOEyNoSjPfyKih+3NjcaNKrnZrYNnzW5t 1CNhECh4K6HmfyeL3AvAc5WeDxAYGwYAwa/484EfvLuC1jaC8oLh2xsmqkUmt3+JEa+VPOWLopc lrr2RsTJ4t//bZN9fr8Jgnq3UqeB6HV+l+fn55U1J1jBwguql2QM8EqB+f6KYYCGB5y1DakQzez LC5Atex2cN2VY0UcZNJhkXvjrVrP11Cr+JuLOt4Dq/Zw5yEfe1Bw5mK8/G+h/+9eA5j1V/0E/7a LxaQDG227I2VnFTqDw5Pto31bHQFWyEHsnxbj5MlAntUIXVP392X60aqDguwOqU/da2uon2/x50 FB7bMSDZbcHK5EA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Accessing file->private_data manually to retrieve the v4l2_fh pointer is error-prone, as the field is a void * and will happily cast implicitly to any pointer type. Replace all remaining locations that read the v4l2_fh pointer directly from file->private_data and cast it to driver-specific file handle structures with driver-specific functions that use file_to_v4l2_fh() and perform the same cast. No functional change is intended, this only paves the way to remove direct accesses to file->private_data and make V4L2 drivers safer. Other accesses to the field will be addressed separately. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi Acked-by: Lukasz Stelmach --- drivers/media/pci/ivtv/ivtv-driver.h | 5 ++++ drivers/media/pci/ivtv/ivtv-fileops.c | 10 +++---- drivers/media/pci/ivtv/ivtv-ioctl.c | 8 +++--- drivers/media/platform/allegro-dvt/allegro-core.c | 7 ++++- drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 8 ++++-- .../media/platform/chips-media/coda/coda-common.c | 7 ++++- .../platform/chips-media/wave5/wave5-helper.c | 2 +- .../media/platform/chips-media/wave5/wave5-vpu.h | 5 ++++ drivers/media/platform/m2m-deinterlace.c | 7 ++++- .../media/platform/mediatek/jpeg/mtk_jpeg_core.c | 7 ++++- drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c | 7 ++++- .../media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 7 ++++- .../mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 2 +- .../mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h | 5 ++++ .../mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c | 2 +- .../mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h | 5 ++++ drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 7 ++++- drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 7 ++++- drivers/media/platform/nxp/mx2_emmaprp.c | 7 ++++- drivers/media/platform/renesas/rcar_fdp1.c | 7 ++++- drivers/media/platform/renesas/rcar_jpu.c | 7 ++++- drivers/media/platform/rockchip/rga/rga.c | 3 +-- drivers/media/platform/rockchip/rga/rga.h | 5 ++++ drivers/media/platform/rockchip/rkvdec/rkvdec.c | 2 +- drivers/media/platform/rockchip/rkvdec/rkvdec.h | 5 ++++ .../media/platform/samsung/exynos-gsc/gsc-core.h | 6 +++++ .../media/platform/samsung/exynos-gsc/gsc-m2m.c | 6 ++--- .../media/platform/samsung/exynos4-is/fimc-core.h | 5 ++++ .../media/platform/samsung/exynos4-is/fimc-m2m.c | 2 +- drivers/media/platform/samsung/s5p-g2d/g2d.c | 7 +++-- .../media/platform/samsung/s5p-jpeg/jpeg-core.c | 9 +++++-- drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 6 ++--- .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 6 +++++ drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c | 7 ++++- drivers/media/platform/st/sti/delta/delta-v4l2.c | 26 +++++++++++------- drivers/media/platform/st/sti/hva/hva-v4l2.c | 31 ++++++++++++------= ---- drivers/media/platform/st/sti/hva/hva.h | 2 -- drivers/media/platform/st/stm32/dma2d/dma2d.c | 7 +++-- drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 3 +-- .../platform/sunxi/sun8i-rotate/sun8i_rotate.c | 3 +-- drivers/media/platform/ti/omap3isp/ispvideo.c | 4 +-- drivers/media/platform/ti/omap3isp/ispvideo.h | 6 +++++ drivers/media/platform/verisilicon/hantro.h | 5 ++++ drivers/media/platform/verisilicon/hantro_drv.c | 3 +-- drivers/staging/media/imx/imx-media-csc-scaler.c | 7 ++++- drivers/staging/media/meson/vdec/vdec.c | 24 ++++++----------- drivers/staging/media/meson/vdec/vdec.h | 5 ++++ drivers/staging/media/sunxi/cedrus/cedrus.c | 3 +-- drivers/staging/media/sunxi/cedrus/cedrus.h | 5 ++++ drivers/staging/media/sunxi/cedrus/cedrus_video.c | 5 ---- 50 files changed, 237 insertions(+), 100 deletions(-) diff --git a/drivers/media/pci/ivtv/ivtv-driver.h b/drivers/media/pci/ivtv/= ivtv-driver.h index a6ffa99e16bc64a5b7d3e48c1ab32b49a7989242..cad548b28e360ecfe2bcb9fcb5d= 12cd8823c3727 100644 --- a/drivers/media/pci/ivtv/ivtv-driver.h +++ b/drivers/media/pci/ivtv/ivtv-driver.h @@ -388,6 +388,11 @@ static inline struct ivtv_open_id *fh2id(struct v4l2_f= h *fh) return container_of(fh, struct ivtv_open_id, fh); } =20 +static inline struct ivtv_open_id *file2id(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct ivtv_open_id, fh); +} + struct yuv_frame_info { u32 update; diff --git a/drivers/media/pci/ivtv/ivtv-fileops.c b/drivers/media/pci/ivtv= /ivtv-fileops.c index 230d498108b5b0d44a238cd87dcea061811af814..cc91695a5b7605dcd964bd2c68b= b12f645dc302f 100644 --- a/drivers/media/pci/ivtv/ivtv-fileops.c +++ b/drivers/media/pci/ivtv/ivtv-fileops.c @@ -502,7 +502,7 @@ int ivtv_start_capture(struct ivtv_open_id *id) =20 ssize_t ivtv_v4l2_read(struct file * filp, char __user *buf, size_t count,= loff_t * pos) { - struct ivtv_open_id *id =3D fh2id(filp->private_data); + struct ivtv_open_id *id =3D file2id(filp); struct ivtv *itv =3D id->itv; struct ivtv_stream *s =3D &itv->streams[id->type]; ssize_t rc; @@ -564,7 +564,7 @@ static int ivtv_schedule_dma(struct ivtv_stream *s) =20 static ssize_t ivtv_write(struct file *filp, const char __user *user_buf, = size_t count, loff_t *pos) { - struct ivtv_open_id *id =3D fh2id(filp->private_data); + struct ivtv_open_id *id =3D file2id(filp); struct ivtv *itv =3D id->itv; struct ivtv_stream *s =3D &itv->streams[id->type]; struct yuv_playback_info *yi =3D &itv->yuv_info; @@ -719,7 +719,7 @@ static ssize_t ivtv_write(struct file *filp, const char= __user *user_buf, size_t =20 ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, si= ze_t count, loff_t *pos) { - struct ivtv_open_id *id =3D fh2id(filp->private_data); + struct ivtv_open_id *id =3D file2id(filp); struct ivtv *itv =3D id->itv; ssize_t res; =20 @@ -732,7 +732,7 @@ ssize_t ivtv_v4l2_write(struct file *filp, const char _= _user *user_buf, size_t c =20 __poll_t ivtv_v4l2_dec_poll(struct file *filp, poll_table *wait) { - struct ivtv_open_id *id =3D fh2id(filp->private_data); + struct ivtv_open_id *id =3D file2id(filp); struct ivtv *itv =3D id->itv; struct ivtv_stream *s =3D &itv->streams[id->type]; __poll_t res =3D 0; @@ -767,7 +767,7 @@ __poll_t ivtv_v4l2_dec_poll(struct file *filp, poll_tab= le *wait) __poll_t ivtv_v4l2_enc_poll(struct file *filp, poll_table *wait) { __poll_t req_events =3D poll_requested_events(wait); - struct ivtv_open_id *id =3D fh2id(filp->private_data); + struct ivtv_open_id *id =3D file2id(filp); struct ivtv *itv =3D id->itv; struct ivtv_stream *s =3D &itv->streams[id->type]; int eof =3D test_bit(IVTV_F_S_STREAMOFF, &s->s_flags); diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/i= vtv-ioctl.c index 7947dcd615e882da5240ed6b10dde8449036d019..d888435b71fb6f6873d9d884248= a67364576bf33 100644 --- a/drivers/media/pci/ivtv/ivtv-ioctl.c +++ b/drivers/media/pci/ivtv/ivtv-ioctl.c @@ -727,7 +727,7 @@ static int ivtv_s_register(struct file *file, void *fh,= const struct v4l2_dbg_re =20 static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capabili= ty *vcap) { - struct ivtv_open_id *id =3D fh2id(file->private_data); + struct ivtv_open_id *id =3D fh2id(file_to_v4l2_fh(file)); struct ivtv *itv =3D id->itv; =20 strscpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); @@ -1584,7 +1584,7 @@ static int ivtv_log_status(struct file *file, void *f= h) =20 static int ivtv_decoder_cmd(struct file *file, void *fh, struct v4l2_decod= er_cmd *dec) { - struct ivtv_open_id *id =3D fh2id(file->private_data); + struct ivtv_open_id *id =3D fh2id(file_to_v4l2_fh(file)); struct ivtv *itv =3D id->itv; =20 IVTV_DEBUG_IOCTL("VIDIOC_DECODER_CMD %d\n", dec->cmd); @@ -1593,7 +1593,7 @@ static int ivtv_decoder_cmd(struct file *file, void *= fh, struct v4l2_decoder_cmd =20 static int ivtv_try_decoder_cmd(struct file *file, void *fh, struct v4l2_d= ecoder_cmd *dec) { - struct ivtv_open_id *id =3D fh2id(file->private_data); + struct ivtv_open_id *id =3D fh2id(file_to_v4l2_fh(file)); struct ivtv *itv =3D id->itv; =20 IVTV_DEBUG_IOCTL("VIDIOC_TRY_DECODER_CMD %d\n", dec->cmd); @@ -1602,7 +1602,7 @@ static int ivtv_try_decoder_cmd(struct file *file, vo= id *fh, struct v4l2_decoder =20 static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *= arg) { - struct ivtv_open_id *id =3D fh2id(filp->private_data); + struct ivtv_open_id *id =3D fh2id(file_to_v4l2_fh(filp)); struct ivtv *itv =3D id->itv; struct ivtv_stream *s =3D &itv->streams[id->type]; =20 diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/me= dia/platform/allegro-dvt/allegro-core.c index 1f134e08923a528cc676f825da68951c97ac2f25..74977f3ae4844022c04de877f31= b4fc6aaac0749 100644 --- a/drivers/media/platform/allegro-dvt/allegro-core.c +++ b/drivers/media/platform/allegro-dvt/allegro-core.c @@ -302,6 +302,11 @@ struct allegro_channel { unsigned int error; }; =20 +static inline struct allegro_channel *file_to_channel(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct allegro_channel, fh); +} + static inline int allegro_channel_get_i_frame_qp(struct allegro_channel *channel) { @@ -3229,7 +3234,7 @@ static int allegro_open(struct file *file) =20 static int allegro_release(struct file *file) { - struct allegro_channel *channel =3D fh_to_channel(file->private_data); + struct allegro_channel *channel =3D file_to_channel(file); =20 v4l2_m2m_ctx_release(channel->fh.m2m_ctx); =20 diff --git a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c b/drivers/med= ia/platform/amlogic/meson-ge2d/ge2d.c index 0c004bb8ba05059245e73a306ed2d20dc18c9197..c7df29a2d82012b7fc290edf3f6= 29a0c3ed7bcc8 100644 --- a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c +++ b/drivers/media/platform/amlogic/meson-ge2d/ge2d.c @@ -82,6 +82,11 @@ struct ge2d_ctx { u32 xy_swap; }; =20 +static inline struct ge2d_ctx *file_to_ge2d_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct ge2d_ctx, fh); +} + struct meson_ge2d { struct v4l2_device v4l2_dev; struct v4l2_m2m_dev *m2m_dev; @@ -871,8 +876,7 @@ static int ge2d_open(struct file *file) =20 static int ge2d_release(struct file *file) { - struct ge2d_ctx *ctx =3D - container_of(file->private_data, struct ge2d_ctx, fh); + struct ge2d_ctx *ctx =3D file_to_ge2d_ctx(file); struct meson_ge2d *ge2d =3D ctx->ge2d; =20 mutex_lock(&ge2d->mutex); diff --git a/drivers/media/platform/chips-media/coda/coda-common.c b/driver= s/media/platform/chips-media/coda/coda-common.c index e6e3f5ec24f691fd5eac1896efc69d8541a49bf3..92fb24cace8ef75e70eb2aae96b= c169a7cf97563 100644 --- a/drivers/media/platform/chips-media/coda/coda-common.c +++ b/drivers/media/platform/chips-media/coda/coda-common.c @@ -56,6 +56,11 @@ =20 #define fh_to_ctx(__fh) container_of(__fh, struct coda_ctx, fh) =20 +static inline struct coda_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct coda_ctx, fh); +} + int coda_debug; module_param(coda_debug, int, 0644); MODULE_PARM_DESC(coda_debug, "Debug level (0-2)"); @@ -2733,7 +2738,7 @@ static int coda_open(struct file *file) static int coda_release(struct file *file) { struct coda_dev *dev =3D video_drvdata(file); - struct coda_ctx *ctx =3D fh_to_ctx(file->private_data); + struct coda_ctx *ctx =3D file_to_ctx(file); =20 coda_dbg(1, ctx, "release instance (%p)\n", ctx); =20 diff --git a/drivers/media/platform/chips-media/wave5/wave5-helper.c b/driv= ers/media/platform/chips-media/wave5/wave5-helper.c index 2c9d8cbca6e4b7e688408099a9d73e12eed5435b..031dea0ee61c6c5afddf7ff47d6= 7d85826f16d8d 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-helper.c +++ b/drivers/media/platform/chips-media/wave5/wave5-helper.c @@ -59,7 +59,7 @@ int wave5_vpu_release_device(struct file *filp, int (*close_func)(struct vpu_instance *inst, u32 *fail_res), char *name) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(filp->private_data); + struct vpu_instance *inst =3D file_to_vpu_inst(filp); int ret =3D 0; =20 v4l2_m2m_ctx_release(inst->v4l2_fh.m2m_ctx); diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu.h b/drivers= /media/platform/chips-media/wave5/wave5-vpu.h index 3847332551fc06555b4ba78d12abd2bc653ffea7..1e8fda9a010da3e7df3b37cfd3e= 39510d9e85bb3 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu.h +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu.h @@ -46,6 +46,11 @@ static inline struct vpu_instance *wave5_to_vpu_inst(str= uct v4l2_fh *vfh) return container_of(vfh, struct vpu_instance, v4l2_fh); } =20 +static inline struct vpu_instance *file_to_vpu_inst(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct vpu_instance, v4l2_fh); +} + static inline struct vpu_instance *wave5_ctrl_to_vpu_inst(struct v4l2_ctrl= *vctrl) { return container_of(vctrl->handler, struct vpu_instance, v4l2_ctrl_hdl); diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platf= orm/m2m-deinterlace.c index 5188f31890966735c6eba990587627f43ff84378..1812c07837ad33e10db9005fd20= 09b4ea2a799d0 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c @@ -142,6 +142,11 @@ struct deinterlace_ctx { struct dma_interleaved_template *xt; }; =20 +static inline struct deinterlace_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct deinterlace_ctx, fh); +} + /* * mem2mem callbacks */ @@ -872,7 +877,7 @@ static int deinterlace_open(struct file *file) static int deinterlace_release(struct file *file) { struct deinterlace_dev *pcdev =3D video_drvdata(file); - struct deinterlace_ctx *ctx =3D file->private_data; + struct deinterlace_ctx *ctx =3D file_to_ctx(file); =20 dprintk(pcdev, "Releasing instance %p\n", ctx); =20 diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers= /media/platform/mediatek/jpeg/mtk_jpeg_core.c index 329e5787c2c282c43dcee80ceb0f1ba337324b74..bf7cae1993d5e21975bc9dffcbc= fb3fe1843d575 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -124,6 +124,11 @@ static inline struct mtk_jpeg_ctx *mtk_jpeg_fh_to_ctx(= struct v4l2_fh *fh) return container_of(fh, struct mtk_jpeg_ctx, fh); } =20 +static inline struct mtk_jpeg_ctx *mtk_jpeg_file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct mtk_jpeg_ctx, fh); +} + static inline struct mtk_jpeg_src_buf *mtk_jpeg_vb2_to_srcbuf( struct vb2_buffer *vb) { @@ -1208,7 +1213,7 @@ static int mtk_jpeg_open(struct file *file) static int mtk_jpeg_release(struct file *file) { struct mtk_jpeg_dev *jpeg =3D video_drvdata(file); - struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_fh_to_ctx(file->private_data); + struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_file_to_ctx(file); =20 mutex_lock(&jpeg->lock); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); diff --git a/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c b/drivers/me= dia/platform/mediatek/mdp/mtk_mdp_m2m.c index d0fd77dcf8e20fcd7a483f1fd0ce234f5ac2bf6b..e3e01a9a0f78cb2fe665132bd1b= de66afa63bddb 100644 --- a/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c +++ b/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c @@ -353,6 +353,11 @@ static inline struct mtk_mdp_ctx *fh_to_ctx(struct v4l= 2_fh *fh) return container_of(fh, struct mtk_mdp_ctx, fh); } =20 +static inline struct mtk_mdp_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct mtk_mdp_ctx, fh); +} + static inline struct mtk_mdp_ctx *ctrl_to_ctx(struct v4l2_ctrl *ctrl) { return container_of(ctrl->handler, struct mtk_mdp_ctx, ctrl_handler); @@ -1137,7 +1142,7 @@ static int mtk_mdp_m2m_open(struct file *file) =20 static int mtk_mdp_m2m_release(struct file *file) { - struct mtk_mdp_ctx *ctx =3D fh_to_ctx(file->private_data); + struct mtk_mdp_ctx *ctx =3D file_to_ctx(file); struct mtk_mdp_dev *mdp =3D ctx->mdp_dev; =20 flush_workqueue(mdp->job_wq); diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c b/drivers/= media/platform/mediatek/mdp3/mtk-mdp3-m2m.c index 59ce5cce069836a6902df686f4dd91b13fa729f2..8ebab14c535bfe023d720964965= d97f758e5eb63 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c @@ -15,6 +15,11 @@ static inline struct mdp_m2m_ctx *fh_to_ctx(struct v4l2_= fh *fh) return container_of(fh, struct mdp_m2m_ctx, fh); } =20 +static inline struct mdp_m2m_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct mdp_m2m_ctx, fh); +} + static inline struct mdp_m2m_ctx *ctrl_to_ctx(struct v4l2_ctrl *ctrl) { return container_of(ctrl->handler, struct mdp_m2m_ctx, ctrl_handler); @@ -643,7 +648,7 @@ static int mdp_m2m_open(struct file *file) =20 static int mdp_m2m_release(struct file *file) { - struct mdp_m2m_ctx *ctx =3D fh_to_ctx(file->private_data); + struct mdp_m2m_ctx *ctx =3D file_to_ctx(file); struct mdp_dev *mdp =3D video_drvdata(file); struct device *dev =3D &mdp->pdev->dev; =20 diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_= drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c index 9247d92d431d8570609423156b989878f7901f1c..18801883c31a80b2179eb0d9280= 150eeb4aa3770 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c @@ -294,7 +294,7 @@ static int fops_vcodec_open(struct file *file) static int fops_vcodec_release(struct file *file) { struct mtk_vcodec_dec_dev *dev =3D video_drvdata(file); - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(file->private_data); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); =20 mtk_v4l2_vdec_dbg(0, ctx, "[%d] decoder", ctx->id); mutex_lock(&dev->dev_mutex); diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_= drv.h b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h index aececca7ecf8936bb2b3b55c99354af983746b30..75156c77405e59e148ed820dba7= 0d90aa7e1fae8 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h @@ -314,6 +314,11 @@ static inline struct mtk_vcodec_dec_ctx *fh_to_dec_ctx= (struct v4l2_fh *fh) return container_of(fh, struct mtk_vcodec_dec_ctx, fh); } =20 +static inline struct mtk_vcodec_dec_ctx *file_to_dec_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct mtk_vcodec_dec_ctx, fh); +} + static inline struct mtk_vcodec_dec_ctx *ctrl_to_dec_ctx(struct v4l2_ctrl = *ctrl) { return container_of(ctrl->handler, struct mtk_vcodec_dec_ctx, ctrl_hdl); diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_= drv.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c index a1e4483abcdbdec22afc4747f439ea56c7181b75..e26a6c3ffa0cee17385575215b5= 5b575b14e58f4 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c @@ -203,7 +203,7 @@ static int fops_vcodec_open(struct file *file) static int fops_vcodec_release(struct file *file) { struct mtk_vcodec_enc_dev *dev =3D video_drvdata(file); - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(file->private_data); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); =20 mtk_v4l2_venc_dbg(1, ctx, "[%d] encoder", ctx->id); mutex_lock(&dev->dev_mutex); diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_= drv.h b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h index 0bd85d0fb379acbba3ac07c01e780cf57bef0305..402e7d31d03d1985ad5ff2831fa= ffc5c31b63467 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h @@ -222,6 +222,11 @@ static inline struct mtk_vcodec_enc_ctx *fh_to_enc_ctx= (struct v4l2_fh *fh) return container_of(fh, struct mtk_vcodec_enc_ctx, fh); } =20 +static inline struct mtk_vcodec_enc_ctx *file_to_enc_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct mtk_vcodec_enc_ctx, fh); +} + static inline struct mtk_vcodec_enc_ctx *ctrl_to_enc_ctx(struct v4l2_ctrl = *ctrl) { return container_of(ctrl->handler, struct mtk_vcodec_enc_ctx, ctrl_hdl); diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index 1b2148578cb6751056b4111c6542f01d76c292c8..a17a020ea4c698bfa57253f0f53= a17230d52dea3 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -649,6 +649,11 @@ static inline struct mxc_jpeg_ctx *mxc_jpeg_fh_to_ctx(= struct v4l2_fh *fh) return container_of(fh, struct mxc_jpeg_ctx, fh); } =20 +static inline struct mxc_jpeg_ctx *mxc_jpeg_file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct mxc_jpeg_ctx, fh); +} + static int enum_fmt(const struct mxc_jpeg_fmt *mxc_formats, int n, struct v4l2_fmtdesc *f, u32 type) { @@ -2735,7 +2740,7 @@ static const struct v4l2_ioctl_ops mxc_jpeg_ioctl_ops= =3D { static int mxc_jpeg_release(struct file *file) { struct mxc_jpeg_dev *mxc_jpeg =3D video_drvdata(file); - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(file->private_data); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); struct device *dev =3D mxc_jpeg->dev; =20 mutex_lock(&mxc_jpeg->lock); diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c b/drivers/m= edia/platform/nxp/imx8-isi/imx8-isi-m2m.c index 22e49d3a128732c077beb7ac2e2f688e0899f8e2..9226e42b95fc91ed5490be1599a= 539f0fdeeb123 100644 --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c @@ -79,6 +79,11 @@ static inline struct mxc_isi_m2m_ctx *to_isi_m2m_ctx(str= uct v4l2_fh *fh) return container_of(fh, struct mxc_isi_m2m_ctx, fh); } =20 +static inline struct mxc_isi_m2m_ctx *file_to_isi_m2m_ctx(struct file *fil= p) +{ + return container_of(file_to_v4l2_fh(filp), struct mxc_isi_m2m_ctx, fh); +} + static inline struct mxc_isi_m2m_ctx_queue_data * mxc_isi_m2m_ctx_qdata(struct mxc_isi_m2m_ctx *ctx, enum v4l2_buf_type type) { @@ -707,7 +712,7 @@ static int mxc_isi_m2m_open(struct file *file) static int mxc_isi_m2m_release(struct file *file) { struct mxc_isi_m2m *m2m =3D video_drvdata(file); - struct mxc_isi_m2m_ctx *ctx =3D to_isi_m2m_ctx(file->private_data); + struct mxc_isi_m2m_ctx *ctx =3D file_to_isi_m2m_ctx(file); =20 v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); mxc_isi_m2m_ctx_ctrls_delete(ctx); diff --git a/drivers/media/platform/nxp/mx2_emmaprp.c b/drivers/media/platf= orm/nxp/mx2_emmaprp.c index 0c6cc120fd2a443db4dbc583f2cdb1cfd61b6a7e..5c8c6285ec1e7b2e8df64132228= e71e1b097183e 100644 --- a/drivers/media/platform/nxp/mx2_emmaprp.c +++ b/drivers/media/platform/nxp/mx2_emmaprp.c @@ -214,6 +214,11 @@ struct emmaprp_ctx { struct emmaprp_q_data q_data[2]; }; =20 +static inline struct emmaprp_ctx *file_to_emmaprp_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct emmaprp_ctx, fh); +} + static struct emmaprp_q_data *get_q_data(struct emmaprp_ctx *ctx, enum v4l2_buf_type type) { @@ -758,7 +763,7 @@ static int emmaprp_open(struct file *file) static int emmaprp_release(struct file *file) { struct emmaprp_dev *pcdev =3D video_drvdata(file); - struct emmaprp_ctx *ctx =3D file->private_data; + struct emmaprp_ctx *ctx =3D file_to_emmaprp_ctx(file); =20 dprintk(pcdev, "Releasing instance %p\n", ctx); =20 diff --git a/drivers/media/platform/renesas/rcar_fdp1.c b/drivers/media/pla= tform/renesas/rcar_fdp1.c index 5d453a7a89889fa3fd115da5f87b4bb24554a3c6..f11ea9dc5027bdd89262270f4e3= 979a06650d9bc 100644 --- a/drivers/media/platform/renesas/rcar_fdp1.c +++ b/drivers/media/platform/renesas/rcar_fdp1.c @@ -635,6 +635,11 @@ static inline struct fdp1_ctx *fh_to_ctx(struct v4l2_f= h *fh) return container_of(fh, struct fdp1_ctx, fh); } =20 +static inline struct fdp1_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct fdp1_ctx, fh); +} + static struct fdp1_q_data *get_q_data(struct fdp1_ctx *ctx, enum v4l2_buf_type type) { @@ -2158,7 +2163,7 @@ static int fdp1_open(struct file *file) static int fdp1_release(struct file *file) { struct fdp1_dev *fdp1 =3D video_drvdata(file); - struct fdp1_ctx *ctx =3D fh_to_ctx(file->private_data); + struct fdp1_ctx *ctx =3D file_to_ctx(file); =20 dprintk(fdp1, "Releasing instance %p\n", ctx); =20 diff --git a/drivers/media/platform/renesas/rcar_jpu.c b/drivers/media/plat= form/renesas/rcar_jpu.c index 81038df71bb5d9b4b7464cedd7ca9bf38744921e..3ee51f53b0cd1c221cefd0ce93a= cbcda55faa4a6 100644 --- a/drivers/media/platform/renesas/rcar_jpu.c +++ b/drivers/media/platform/renesas/rcar_jpu.c @@ -485,6 +485,11 @@ static struct jpu_ctx *fh_to_ctx(struct v4l2_fh *fh) return container_of(fh, struct jpu_ctx, fh); } =20 +static struct jpu_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct jpu_ctx, fh); +} + static void jpu_set_tbl(struct jpu *jpu, u32 reg, const unsigned int *tbl, unsigned int len) { unsigned int i; @@ -1281,7 +1286,7 @@ static int jpu_open(struct file *file) static int jpu_release(struct file *file) { struct jpu *jpu =3D video_drvdata(file); - struct jpu_ctx *ctx =3D fh_to_ctx(file->private_data); + struct jpu_ctx *ctx =3D file_to_ctx(file); =20 v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); v4l2_ctrl_handler_free(&ctx->ctrl_handler); diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/plat= form/rockchip/rga/rga.c index 3dccab5fa4a131289c18150e6afbf3309cde318b..8a6e618d605c216b5113062d90d= f03dc632dc7c8 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -411,8 +411,7 @@ static int rga_open(struct file *file) =20 static int rga_release(struct file *file) { - struct rga_ctx *ctx =3D - container_of(file->private_data, struct rga_ctx, fh); + struct rga_ctx *ctx =3D file_to_rga_ctx(file); struct rockchip_rga *rga =3D ctx->rga; =20 mutex_lock(&rga->mutex); diff --git a/drivers/media/platform/rockchip/rga/rga.h b/drivers/media/plat= form/rockchip/rga/rga.h index 530e12de73c4f574f13e60fc2540b425263bd3ef..72a28b120fabfdce39e7773358d= 0c9528019e882 100644 --- a/drivers/media/platform/rockchip/rga/rga.h +++ b/drivers/media/platform/rockchip/rga/rga.h @@ -68,6 +68,11 @@ struct rga_ctx { u32 fill_color; }; =20 +static inline struct rga_ctx *file_to_rga_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct rga_ctx, fh); +} + struct rockchip_rga { struct v4l2_device v4l2_dev; struct v4l2_m2m_dev *m2m_dev; diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/medi= a/platform/rockchip/rkvdec/rkvdec.c index d707088ec0dc1f6a18b2d168ebdf20b443f2240e..41ab90cbcc0cdbe279f6512decc= 4301b6cff2dfa 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c @@ -953,7 +953,7 @@ static int rkvdec_open(struct file *filp) =20 static int rkvdec_release(struct file *filp) { - struct rkvdec_ctx *ctx =3D fh_to_rkvdec_ctx(filp->private_data); + struct rkvdec_ctx *ctx =3D file_to_rkvdec_ctx(filp); =20 v4l2_fh_del(&ctx->fh); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.h b/drivers/medi= a/platform/rockchip/rkvdec/rkvdec.h index f6e8bf38add3a0bf00a5dedd244931aca4a28e0a..35effe9467845fdfc4ffea43221= 1d1d2e75a08b0 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.h +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.h @@ -129,6 +129,11 @@ static inline struct rkvdec_ctx *fh_to_rkvdec_ctx(stru= ct v4l2_fh *fh) return container_of(fh, struct rkvdec_ctx, fh); } =20 +static inline struct rkvdec_ctx *file_to_rkvdec_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct rkvdec_ctx, fh); +} + struct rkvdec_aux_buf { void *cpu; dma_addr_t dma; diff --git a/drivers/media/platform/samsung/exynos-gsc/gsc-core.h b/drivers= /media/platform/samsung/exynos-gsc/gsc-core.h index b9777e07fb6d14f8e9a97ee593a09a412326f157..a5491fe39e0f686c75c888c4632= 150f32326c36e 100644 --- a/drivers/media/platform/samsung/exynos-gsc/gsc-core.h +++ b/drivers/media/platform/samsung/exynos-gsc/gsc-core.h @@ -86,6 +86,7 @@ enum gsc_yuv_fmt { }; =20 #define fh_to_ctx(__fh) container_of(__fh, struct gsc_ctx, fh) + #define is_rgb(x) (!!((x) & 0x1)) #define is_yuv420(x) (!!((x) & 0x2)) #define is_yuv422(x) (!!((x) & 0x4)) @@ -381,6 +382,11 @@ struct gsc_ctx { enum v4l2_colorspace out_colorspace; }; =20 +static inline struct gsc_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct gsc_ctx, fh); +} + void gsc_set_prefbuf(struct gsc_dev *gsc, struct gsc_frame *frm); int gsc_register_m2m_device(struct gsc_dev *gsc); void gsc_unregister_m2m_device(struct gsc_dev *gsc); diff --git a/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c b/drivers/= media/platform/samsung/exynos-gsc/gsc-m2m.c index 4bda1c369c44c41265a42f2bab6f70ec532881bd..968bb4327b7a1697641815dfb08= dc64251f5e927 100644 --- a/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c @@ -666,7 +666,7 @@ static int gsc_m2m_open(struct file *file) =20 static int gsc_m2m_release(struct file *file) { - struct gsc_ctx *ctx =3D fh_to_ctx(file->private_data); + struct gsc_ctx *ctx =3D file_to_ctx(file); struct gsc_dev *gsc =3D ctx->gsc_dev; =20 pr_debug("pid: %d, state: 0x%lx, refcnt=3D %d", @@ -690,7 +690,7 @@ static int gsc_m2m_release(struct file *file) static __poll_t gsc_m2m_poll(struct file *file, struct poll_table_struct *wait) { - struct gsc_ctx *ctx =3D fh_to_ctx(file->private_data); + struct gsc_ctx *ctx =3D file_to_ctx(file); struct gsc_dev *gsc =3D ctx->gsc_dev; __poll_t ret; =20 @@ -705,7 +705,7 @@ static __poll_t gsc_m2m_poll(struct file *file, =20 static int gsc_m2m_mmap(struct file *file, struct vm_area_struct *vma) { - struct gsc_ctx *ctx =3D fh_to_ctx(file->private_data); + struct gsc_ctx *ctx =3D file_to_ctx(file); struct gsc_dev *gsc =3D ctx->gsc_dev; int ret; =20 diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-core.h b/driver= s/media/platform/samsung/exynos4-is/fimc-core.h index 63385152a2ffe82e9871497733971cfc8a1a1238..25711df062e79eb2066f0f6eab1= c1733f16c9c2d 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-core.h +++ b/drivers/media/platform/samsung/exynos4-is/fimc-core.h @@ -498,6 +498,11 @@ struct fimc_ctx { =20 #define fh_to_ctx(__fh) container_of(__fh, struct fimc_ctx, fh) =20 +static inline struct fimc_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct fimc_ctx, fh); +} + static inline void set_frame_bounds(struct fimc_frame *f, u32 width, u32 h= eight) { f->o_width =3D width; diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c b/drivers= /media/platform/samsung/exynos4-is/fimc-m2m.c index 951433c8e92a5b75bad59f2e0dbf7d56f6726dee..feedf60dad09bd413cb8fe65d96= 5fd39b26b8764 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c @@ -675,7 +675,7 @@ static int fimc_m2m_open(struct file *file) =20 static int fimc_m2m_release(struct file *file) { - struct fimc_ctx *ctx =3D fh_to_ctx(file->private_data); + struct fimc_ctx *ctx =3D file_to_ctx(file); struct fimc_dev *fimc =3D ctx->fimc_dev; =20 dbg("pid: %d, state: 0x%lx, refcnt=3D %d", diff --git a/drivers/media/platform/samsung/s5p-g2d/g2d.c b/drivers/media/p= latform/samsung/s5p-g2d/g2d.c index ffed16a34493be2edbdaee13619467417487c1e7..44fcedbbc90a9863827aacbcd5f= 56d850cb552ea 100644 --- a/drivers/media/platform/samsung/s5p-g2d/g2d.c +++ b/drivers/media/platform/samsung/s5p-g2d/g2d.c @@ -25,7 +25,10 @@ #include "g2d.h" #include "g2d-regs.h" =20 -#define fh2ctx(__fh) container_of(__fh, struct g2d_ctx, fh) +static inline struct g2d_ctx *file2ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct g2d_ctx, fh); +} =20 static struct g2d_fmt formats[] =3D { { @@ -272,7 +275,7 @@ static int g2d_open(struct file *file) static int g2d_release(struct file *file) { struct g2d_dev *dev =3D video_drvdata(file); - struct g2d_ctx *ctx =3D fh2ctx(file->private_data); + struct g2d_ctx *ctx =3D file2ctx(file); =20 mutex_lock(&dev->mutex); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); diff --git a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c b/drivers/= media/platform/samsung/s5p-jpeg/jpeg-core.c index ac4cf269456a93ccb61c4978d81663e18124ca11..a8d0dddb1fb5b5344ac9c96657f= cf17a575d6a26 100644 --- a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c @@ -585,6 +585,11 @@ static inline struct s5p_jpeg_ctx *fh_to_ctx(struct v4= l2_fh *fh) return container_of(fh, struct s5p_jpeg_ctx, fh); } =20 +static inline struct s5p_jpeg_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct s5p_jpeg_ctx, fh); +} + static int s5p_jpeg_to_user_subsampling(struct s5p_jpeg_ctx *ctx) { switch (ctx->jpeg->variant->version) { @@ -1012,7 +1017,7 @@ static int s5p_jpeg_open(struct file *file) static int s5p_jpeg_release(struct file *file) { struct s5p_jpeg *jpeg =3D video_drvdata(file); - struct s5p_jpeg_ctx *ctx =3D fh_to_ctx(file->private_data); + struct s5p_jpeg_ctx *ctx =3D file_to_ctx(file); =20 mutex_lock(&jpeg->lock); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); @@ -1828,7 +1833,7 @@ static int s5p_jpeg_g_selection(struct file *file, vo= id *priv, static int s5p_jpeg_s_selection(struct file *file, void *fh, struct v4l2_selection *s) { - struct s5p_jpeg_ctx *ctx =3D fh_to_ctx(file->private_data); + struct s5p_jpeg_ctx *ctx =3D file_to_ctx(file); struct v4l2_rect *rect =3D &s->r; int ret =3D -EINVAL; =20 diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c b/drivers/med= ia/platform/samsung/s5p-mfc/s5p_mfc.c index 73fdcd362265ad123b3633b832e40fd3ca70c227..dd9761df59df5dd7b07b4e9afd2= d7939c46cb2de 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c @@ -970,7 +970,7 @@ static int s5p_mfc_open(struct file *file) /* Release MFC context */ static int s5p_mfc_release(struct file *file) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(file->private_data); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); struct s5p_mfc_dev *dev =3D ctx->dev; =20 /* if dev is null, do cleanup that doesn't need dev */ @@ -1027,7 +1027,7 @@ static int s5p_mfc_release(struct file *file) static __poll_t s5p_mfc_poll(struct file *file, struct poll_table_struct *wait) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(file->private_data); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); struct s5p_mfc_dev *dev =3D ctx->dev; struct vb2_queue *src_q, *dst_q; struct vb2_buffer *src_vb =3D NULL, *dst_vb =3D NULL; @@ -1078,7 +1078,7 @@ static __poll_t s5p_mfc_poll(struct file *file, /* Mmap */ static int s5p_mfc_mmap(struct file *file, struct vm_area_struct *vma) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(file->private_data); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); unsigned long offset =3D vma->vm_pgoff << PAGE_SHIFT; int ret; =20 diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h b/driv= ers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h index 86c316c1ff8f69cd0f172fa14477331e325ed8f5..bdc25f6982d1eb6e846f1604484= ea39968526bc0 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h @@ -768,6 +768,12 @@ struct mfc_control { ((f && f->op) ? f->op(args) : (typeof(f->op(args)))(-ENODEV)) =20 #define fh_to_ctx(__fh) container_of(__fh, struct s5p_mfc_ctx, fh) + +static inline struct s5p_mfc_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct s5p_mfc_ctx, fh); +} + #define ctrl_to_ctx(__ctrl) \ container_of((__ctrl)->handler, struct s5p_mfc_ctx, ctrl_handler) =20 diff --git a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c b/drivers/med= ia/platform/st/sti/bdisp/bdisp-v4l2.c index 1eb934490c0b57d89557afa3cc776cdbe4a529ff..26c4e48e5e84bcf315692515448= ae615727c454f 100644 --- a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c @@ -35,6 +35,11 @@ =20 #define fh_to_ctx(__fh) container_of(__fh, struct bdisp_ctx, fh) =20 +static inline struct bdisp_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct bdisp_ctx, fh); +} + enum bdisp_dev_flags { ST_M2M_OPEN, /* Driver opened */ ST_M2M_RUNNING, /* HW device running */ @@ -644,7 +649,7 @@ static int bdisp_open(struct file *file) =20 static int bdisp_release(struct file *file) { - struct bdisp_ctx *ctx =3D fh_to_ctx(file->private_data); + struct bdisp_ctx *ctx =3D file_to_ctx(file); struct bdisp_dev *bdisp =3D ctx->bdisp_dev; =20 dev_dbg(bdisp->dev, "%s\n", __func__); diff --git a/drivers/media/platform/st/sti/delta/delta-v4l2.c b/drivers/med= ia/platform/st/sti/delta/delta-v4l2.c index 196e6a40335d14898ff7abbb38d2de2f5bcf6789..8282e72af67084ddbb94ed78df8= 7a07e1e8b860f 100644 --- a/drivers/media/platform/st/sti/delta/delta-v4l2.c +++ b/drivers/media/platform/st/sti/delta/delta-v4l2.c @@ -25,6 +25,12 @@ #define DELTA_PREFIX "[---:----]" =20 #define to_ctx(__fh) container_of(__fh, struct delta_ctx, fh) + +static inline struct delta_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct delta_ctx, fh); +} + #define to_au(__vbuf) container_of(__vbuf, struct delta_au, vbuf) #define to_frame(__vbuf) container_of(__vbuf, struct delta_frame, vbuf) =20 @@ -382,7 +388,7 @@ static int delta_open_decoder(struct delta_ctx *ctx, u3= 2 streamformat, static int delta_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct delta_ctx *ctx =3D to_ctx(file->private_data); + struct delta_ctx *ctx =3D file_to_ctx(file); struct delta_dev *delta =3D ctx->dev; =20 strscpy(cap->driver, DELTA_NAME, sizeof(cap->driver)); @@ -396,7 +402,7 @@ static int delta_querycap(struct file *file, void *priv, static int delta_enum_fmt_stream(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct delta_ctx *ctx =3D to_ctx(file->private_data); + struct delta_ctx *ctx =3D file_to_ctx(file); struct delta_dev *delta =3D ctx->dev; =20 if (unlikely(f->index >=3D delta->nb_of_streamformats)) @@ -410,7 +416,7 @@ static int delta_enum_fmt_stream(struct file *file, voi= d *priv, static int delta_enum_fmt_frame(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct delta_ctx *ctx =3D to_ctx(file->private_data); + struct delta_ctx *ctx =3D file_to_ctx(file); struct delta_dev *delta =3D ctx->dev; =20 if (unlikely(f->index >=3D delta->nb_of_pixelformats)) @@ -424,7 +430,7 @@ static int delta_enum_fmt_frame(struct file *file, void= *priv, static int delta_g_fmt_stream(struct file *file, void *fh, struct v4l2_format *f) { - struct delta_ctx *ctx =3D to_ctx(file->private_data); + struct delta_ctx *ctx =3D file_to_ctx(file); struct delta_dev *delta =3D ctx->dev; struct v4l2_pix_format *pix =3D &f->fmt.pix; struct delta_streaminfo *streaminfo =3D &ctx->streaminfo; @@ -452,7 +458,7 @@ static int delta_g_fmt_stream(struct file *file, void *= fh, =20 static int delta_g_fmt_frame(struct file *file, void *fh, struct v4l2_form= at *f) { - struct delta_ctx *ctx =3D to_ctx(file->private_data); + struct delta_ctx *ctx =3D file_to_ctx(file); struct delta_dev *delta =3D ctx->dev; struct v4l2_pix_format *pix =3D &f->fmt.pix; struct delta_frameinfo *frameinfo =3D &ctx->frameinfo; @@ -491,7 +497,7 @@ static int delta_g_fmt_frame(struct file *file, void *f= h, struct v4l2_format *f) static int delta_try_fmt_stream(struct file *file, void *priv, struct v4l2_format *f) { - struct delta_ctx *ctx =3D to_ctx(file->private_data); + struct delta_ctx *ctx =3D file_to_ctx(file); struct delta_dev *delta =3D ctx->dev; struct v4l2_pix_format *pix =3D &f->fmt.pix; u32 streamformat =3D pix->pixelformat; @@ -545,7 +551,7 @@ static int delta_try_fmt_stream(struct file *file, void= *priv, static int delta_try_fmt_frame(struct file *file, void *priv, struct v4l2_format *f) { - struct delta_ctx *ctx =3D to_ctx(file->private_data); + struct delta_ctx *ctx =3D file_to_ctx(file); struct delta_dev *delta =3D ctx->dev; struct v4l2_pix_format *pix =3D &f->fmt.pix; u32 pixelformat =3D pix->pixelformat; @@ -605,7 +611,7 @@ static int delta_try_fmt_frame(struct file *file, void = *priv, static int delta_s_fmt_stream(struct file *file, void *fh, struct v4l2_format *f) { - struct delta_ctx *ctx =3D to_ctx(file->private_data); + struct delta_ctx *ctx =3D file_to_ctx(file); struct delta_dev *delta =3D ctx->dev; struct vb2_queue *vq; struct v4l2_pix_format *pix =3D &f->fmt.pix; @@ -641,7 +647,7 @@ static int delta_s_fmt_stream(struct file *file, void *= fh, =20 static int delta_s_fmt_frame(struct file *file, void *fh, struct v4l2_form= at *f) { - struct delta_ctx *ctx =3D to_ctx(file->private_data); + struct delta_ctx *ctx =3D file_to_ctx(file); struct delta_dev *delta =3D ctx->dev; const struct delta_dec *dec =3D ctx->dec; struct v4l2_pix_format *pix =3D &f->fmt.pix; @@ -1690,7 +1696,7 @@ static int delta_open(struct file *file) =20 static int delta_release(struct file *file) { - struct delta_ctx *ctx =3D to_ctx(file->private_data); + struct delta_ctx *ctx =3D file_to_ctx(file); struct delta_dev *delta =3D ctx->dev; const struct delta_dec *dec =3D ctx->dec; =20 diff --git a/drivers/media/platform/st/sti/hva/hva-v4l2.c b/drivers/media/p= latform/st/sti/hva/hva-v4l2.c index 5366c0f92549bb090967a1337ce55d0b0f1d76ce..29142c806cb74a510b2f27e79c9= e10ca4088b1e9 100644 --- a/drivers/media/platform/st/sti/hva/hva-v4l2.c +++ b/drivers/media/platform/st/sti/hva/hva-v4l2.c @@ -36,7 +36,10 @@ #define to_type_str(type) (type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT ? \ "frame" : "stream") =20 -#define fh_to_ctx(f) (container_of(f, struct hva_ctx, fh)) +static inline struct hva_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct hva_ctx, fh); +} =20 /* registry of available encoders */ static const struct hva_enc *hva_encoders[] =3D { @@ -254,7 +257,7 @@ static void hva_dbg_summary(struct hva_ctx *ctx) static int hva_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct hva_dev *hva =3D ctx_to_hdev(ctx); =20 strscpy(cap->driver, HVA_NAME, sizeof(cap->driver)); @@ -268,7 +271,7 @@ static int hva_querycap(struct file *file, void *priv, static int hva_enum_fmt_stream(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct hva_dev *hva =3D ctx_to_hdev(ctx); =20 if (unlikely(f->index >=3D hva->nb_of_streamformats)) @@ -282,7 +285,7 @@ static int hva_enum_fmt_stream(struct file *file, void = *priv, static int hva_enum_fmt_frame(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct hva_dev *hva =3D ctx_to_hdev(ctx); =20 if (unlikely(f->index >=3D hva->nb_of_pixelformats)) @@ -295,7 +298,7 @@ static int hva_enum_fmt_frame(struct file *file, void *= priv, =20 static int hva_g_fmt_stream(struct file *file, void *fh, struct v4l2_forma= t *f) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct hva_streaminfo *streaminfo =3D &ctx->streaminfo; =20 f->fmt.pix.width =3D streaminfo->width; @@ -314,7 +317,7 @@ static int hva_g_fmt_stream(struct file *file, void *fh= , struct v4l2_format *f) =20 static int hva_g_fmt_frame(struct file *file, void *fh, struct v4l2_format= *f) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct hva_frameinfo *frameinfo =3D &ctx->frameinfo; =20 f->fmt.pix.width =3D frameinfo->width; @@ -335,7 +338,7 @@ static int hva_g_fmt_frame(struct file *file, void *fh,= struct v4l2_format *f) static int hva_try_fmt_stream(struct file *file, void *priv, struct v4l2_format *f) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct device *dev =3D ctx_to_dev(ctx); struct v4l2_pix_format *pix =3D &f->fmt.pix; u32 streamformat =3D pix->pixelformat; @@ -399,7 +402,7 @@ static int hva_try_fmt_stream(struct file *file, void *= priv, static int hva_try_fmt_frame(struct file *file, void *priv, struct v4l2_format *f) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct device *dev =3D ctx_to_dev(ctx); struct v4l2_pix_format *pix =3D &f->fmt.pix; u32 pixelformat =3D pix->pixelformat; @@ -449,7 +452,7 @@ static int hva_try_fmt_frame(struct file *file, void *p= riv, =20 static int hva_s_fmt_stream(struct file *file, void *fh, struct v4l2_forma= t *f) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct device *dev =3D ctx_to_dev(ctx); struct vb2_queue *vq; int ret; @@ -479,7 +482,7 @@ static int hva_s_fmt_stream(struct file *file, void *fh= , struct v4l2_format *f) =20 static int hva_s_fmt_frame(struct file *file, void *fh, struct v4l2_format= *f) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct device *dev =3D ctx_to_dev(ctx); struct v4l2_pix_format *pix =3D &f->fmt.pix; struct vb2_queue *vq; @@ -517,7 +520,7 @@ static int hva_s_fmt_frame(struct file *file, void *fh,= struct v4l2_format *f) =20 static int hva_g_parm(struct file *file, void *fh, struct v4l2_streamparm = *sp) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct v4l2_fract *time_per_frame =3D &ctx->ctrls.time_per_frame; =20 if (sp->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) @@ -533,7 +536,7 @@ static int hva_g_parm(struct file *file, void *fh, stru= ct v4l2_streamparm *sp) =20 static int hva_s_parm(struct file *file, void *fh, struct v4l2_streamparm = *sp) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct v4l2_fract *time_per_frame =3D &ctx->ctrls.time_per_frame; =20 if (sp->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) @@ -553,7 +556,7 @@ static int hva_s_parm(struct file *file, void *fh, stru= ct v4l2_streamparm *sp) =20 static int hva_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct device *dev =3D ctx_to_dev(ctx); =20 if (buf->type =3D=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) { @@ -1225,7 +1228,7 @@ static int hva_open(struct file *file) =20 static int hva_release(struct file *file) { - struct hva_ctx *ctx =3D fh_to_ctx(file->private_data); + struct hva_ctx *ctx =3D file_to_ctx(file); struct hva_dev *hva =3D ctx_to_hdev(ctx); struct device *dev =3D ctx_to_dev(ctx); const struct hva_enc *enc =3D ctx->enc; diff --git a/drivers/media/platform/st/sti/hva/hva.h b/drivers/media/platfo= rm/st/sti/hva/hva.h index ba6b893416ec47ce371ee9ed886a8ac5acc6cecf..1fe561082a7439a05588c6b399a= e1afa5fc0f92c 100644 --- a/drivers/media/platform/st/sti/hva/hva.h +++ b/drivers/media/platform/st/sti/hva/hva.h @@ -13,8 +13,6 @@ #include #include =20 -#define fh_to_ctx(f) (container_of(f, struct hva_ctx, fh)) - #define hva_to_dev(h) (h->dev) =20 #define ctx_to_dev(c) (c->hva_dev->dev) diff --git a/drivers/media/platform/st/stm32/dma2d/dma2d.c b/drivers/media/= platform/st/stm32/dma2d/dma2d.c index 48fa781aab06c14cd64e9b9eb1a278a2ef8ca7fc..f4c5d73447a7c3efb0ad5d9bb8a= 09432c1a8fa60 100644 --- a/drivers/media/platform/st/stm32/dma2d/dma2d.c +++ b/drivers/media/platform/st/stm32/dma2d/dma2d.c @@ -45,7 +45,10 @@ * whole of a destination image with a pixel format conversion. */ =20 -#define fh2ctx(__fh) container_of(__fh, struct dma2d_ctx, fh) +static inline struct dma2d_ctx *file2ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct dma2d_ctx, fh); +} =20 static const struct dma2d_fmt formats[] =3D { { @@ -318,7 +321,7 @@ static int dma2d_open(struct file *file) static int dma2d_release(struct file *file) { struct dma2d_dev *dev =3D video_drvdata(file); - struct dma2d_ctx *ctx =3D fh2ctx(file->private_data); + struct dma2d_ctx *ctx =3D file2ctx(file); =20 mutex_lock(&dev->mutex); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); diff --git a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c b/drivers/med= ia/platform/sunxi/sun8i-di/sun8i-di.c index 43755043e8af907fe6755cfe6848ceb655444dfc..e9c7c99fbc559de85c33736a8f4= 59cd216b8cdbf 100644 --- a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +++ b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c @@ -756,8 +756,7 @@ static int deinterlace_open(struct file *file) static int deinterlace_release(struct file *file) { struct deinterlace_dev *dev =3D video_drvdata(file); - struct deinterlace_ctx *ctx =3D container_of(file->private_data, - struct deinterlace_ctx, fh); + struct deinterlace_ctx *ctx =3D deinterlace_file2ctx(file); =20 mutex_lock(&dev->dev_mutex); =20 diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/dri= vers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index d0608b5d900fc83a6c63979d21ab3b4ce9a67af9..9ea65cb7187fee323051b1cb62b= 342e119f7bb3d 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -691,8 +691,7 @@ static int rotate_open(struct file *file) static int rotate_release(struct file *file) { struct rotate_dev *dev =3D video_drvdata(file); - struct rotate_ctx *ctx =3D container_of(file->private_data, - struct rotate_ctx, fh); + struct rotate_ctx *ctx =3D rotate_file2ctx(file); =20 mutex_lock(&dev->dev_mutex); =20 diff --git a/drivers/media/platform/ti/omap3isp/ispvideo.c b/drivers/media/= platform/ti/omap3isp/ispvideo.c index a777135c6a6ca51c85c5a75b76cbc4a8421963ec..b76d40aeca17cf5b8b7619cadf0= afe66ff283a9d 100644 --- a/drivers/media/platform/ti/omap3isp/ispvideo.c +++ b/drivers/media/platform/ti/omap3isp/ispvideo.c @@ -1373,7 +1373,7 @@ static int isp_video_release(struct file *file) =20 static __poll_t isp_video_poll(struct file *file, poll_table *wait) { - struct isp_video_fh *vfh =3D to_isp_video_fh(file->private_data); + struct isp_video_fh *vfh =3D file_to_isp_video_fh(file); struct isp_video *video =3D video_drvdata(file); __poll_t ret; =20 @@ -1386,7 +1386,7 @@ static __poll_t isp_video_poll(struct file *file, pol= l_table *wait) =20 static int isp_video_mmap(struct file *file, struct vm_area_struct *vma) { - struct isp_video_fh *vfh =3D to_isp_video_fh(file->private_data); + struct isp_video_fh *vfh =3D file_to_isp_video_fh(file); =20 return vb2_mmap(&vfh->queue, vma); } diff --git a/drivers/media/platform/ti/omap3isp/ispvideo.h b/drivers/media/= platform/ti/omap3isp/ispvideo.h index 1d23df576e6b35f01d8b49a96a0acf1772c2e2c2..355812770e18ef5353ac68e6542= 6a3180a6d91ab 100644 --- a/drivers/media/platform/ti/omap3isp/ispvideo.h +++ b/drivers/media/platform/ti/omap3isp/ispvideo.h @@ -195,6 +195,12 @@ struct isp_video_fh { }; =20 #define to_isp_video_fh(fh) container_of(fh, struct isp_video_fh, vfh) + +static inline struct isp_video_fh *file_to_isp_video_fh(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct isp_video_fh, vfh); +} + #define isp_video_queue_to_isp_video_fh(q) \ container_of(q, struct isp_video_fh, queue) =20 diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/pl= atform/verisilicon/hantro.h index 81328c63b796f30be4736c8f263ce72548ed3a24..0f10714f1953945472e11d8c8ad= 87f8ec009b39f 100644 --- a/drivers/media/platform/verisilicon/hantro.h +++ b/drivers/media/platform/verisilicon/hantro.h @@ -387,6 +387,11 @@ static __always_inline struct hantro_ctx *fh_to_ctx(st= ruct v4l2_fh *fh) return container_of(fh, struct hantro_ctx, fh); } =20 +static __always_inline struct hantro_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct hantro_ctx, fh); +} + /* Register accessors. */ static __always_inline void vepu_write_relaxed(struct hantro_dev *vpu, u32 val, u32 reg) diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/medi= a/platform/verisilicon/hantro_drv.c index 8542238e0fb1d21576f87b8ebb37585a0144c949..b20b9c7f41319e1d9586d641200= aeeebbd1ee761 100644 --- a/drivers/media/platform/verisilicon/hantro_drv.c +++ b/drivers/media/platform/verisilicon/hantro_drv.c @@ -687,8 +687,7 @@ static int hantro_open(struct file *filp) =20 static int hantro_release(struct file *filp) { - struct hantro_ctx *ctx =3D - container_of(filp->private_data, struct hantro_ctx, fh); + struct hantro_ctx *ctx =3D file_to_ctx(filp); =20 /* * No need for extra locking because this was the last reference diff --git a/drivers/staging/media/imx/imx-media-csc-scaler.c b/drivers/sta= ging/media/imx/imx-media-csc-scaler.c index 19fd31cb9bb0354b310d40da1f116bb96fd9b0c8..05a54242356c53d19770086dfcc= 2ed81e1cda4c1 100644 --- a/drivers/staging/media/imx/imx-media-csc-scaler.c +++ b/drivers/staging/media/imx/imx-media-csc-scaler.c @@ -66,6 +66,11 @@ struct ipu_csc_scaler_ctx { unsigned int sequence; }; =20 +static inline struct ipu_csc_scaler_ctx *file_to_ctx(struct file *filp) +{ + return container_of(file_to_v4l2_fh(filp), struct ipu_csc_scaler_ctx, fh); +} + static struct ipu_csc_scaler_q_data *get_q_data(struct ipu_csc_scaler_ctx = *ctx, enum v4l2_buf_type type) { @@ -797,7 +802,7 @@ static int ipu_csc_scaler_open(struct file *file) static int ipu_csc_scaler_release(struct file *file) { struct ipu_csc_scaler_priv *priv =3D video_drvdata(file); - struct ipu_csc_scaler_ctx *ctx =3D fh_to_ctx(file->private_data); + struct ipu_csc_scaler_ctx *ctx =3D file_to_ctx(file); =20 dev_dbg(priv->dev, "Releasing instance %p\n", ctx); =20 diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/medi= a/meson/vdec/vdec.c index 6d34a482492e8838cf9dbb104315b87abf3f3e3b..f1ee53f9f29868ae7cb02ce0076= 4631f821ee74b 100644 --- a/drivers/staging/media/meson/vdec/vdec.c +++ b/drivers/staging/media/meson/vdec/vdec.c @@ -558,8 +558,7 @@ vdec_try_fmt_common(struct amvdec_session *sess, u32 si= ze, =20 static int vdec_try_fmt(struct file *file, void *fh, struct v4l2_format *f) { - struct amvdec_session *sess =3D - container_of(file->private_data, struct amvdec_session, fh); + struct amvdec_session *sess =3D file_to_amvdec_session(file); =20 vdec_try_fmt_common(sess, sess->core->platform->num_formats, f); =20 @@ -568,8 +567,7 @@ static int vdec_try_fmt(struct file *file, void *fh, st= ruct v4l2_format *f) =20 static int vdec_g_fmt(struct file *file, void *fh, struct v4l2_format *f) { - struct amvdec_session *sess =3D - container_of(file->private_data, struct amvdec_session, fh); + struct amvdec_session *sess =3D file_to_amvdec_session(file); struct v4l2_pix_format_mplane *pixmp =3D &f->fmt.pix_mp; =20 if (f->type =3D=3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) @@ -596,8 +594,7 @@ static int vdec_g_fmt(struct file *file, void *fh, stru= ct v4l2_format *f) =20 static int vdec_s_fmt(struct file *file, void *fh, struct v4l2_format *f) { - struct amvdec_session *sess =3D - container_of(file->private_data, struct amvdec_session, fh); + struct amvdec_session *sess =3D file_to_amvdec_session(file); struct v4l2_pix_format_mplane *pixmp =3D &f->fmt.pix_mp; u32 num_formats =3D sess->core->platform->num_formats; const struct amvdec_format *fmt_out; @@ -658,8 +655,7 @@ static int vdec_s_fmt(struct file *file, void *fh, stru= ct v4l2_format *f) =20 static int vdec_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc = *f) { - struct amvdec_session *sess =3D - container_of(file->private_data, struct amvdec_session, fh); + struct amvdec_session *sess =3D file_to_amvdec_session(file); const struct vdec_platform *platform =3D sess->core->platform; const struct amvdec_format *fmt_out; =20 @@ -688,8 +684,7 @@ static int vdec_enum_fmt(struct file *file, void *fh, s= truct v4l2_fmtdesc *f) static int vdec_enum_framesizes(struct file *file, void *fh, struct v4l2_frmsizeenum *fsize) { - struct amvdec_session *sess =3D - container_of(file->private_data, struct amvdec_session, fh); + struct amvdec_session *sess =3D file_to_amvdec_session(file); const struct amvdec_format *formats =3D sess->core->platform->formats; const struct amvdec_format *fmt; u32 num_formats =3D sess->core->platform->num_formats; @@ -713,8 +708,7 @@ static int vdec_enum_framesizes(struct file *file, void= *fh, static int vdec_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) { - struct amvdec_session *sess =3D - container_of(file->private_data, struct amvdec_session, fh); + struct amvdec_session *sess =3D file_to_amvdec_session(file); struct amvdec_codec_ops *codec_ops =3D sess->fmt_out->codec_ops; struct device *dev =3D sess->core->dev; int ret; @@ -773,8 +767,7 @@ static int vdec_subscribe_event(struct v4l2_fh *fh, static int vdec_g_pixelaspect(struct file *file, void *fh, int type, struct v4l2_fract *f) { - struct amvdec_session *sess =3D - container_of(file->private_data, struct amvdec_session, fh); + struct amvdec_session *sess =3D file_to_amvdec_session(file); =20 if (type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) return -EINVAL; @@ -930,8 +923,7 @@ static int vdec_open(struct file *file) =20 static int vdec_close(struct file *file) { - struct amvdec_session *sess =3D - container_of(file->private_data, struct amvdec_session, fh); + struct amvdec_session *sess =3D file_to_amvdec_session(file); =20 v4l2_m2m_ctx_release(sess->m2m_ctx); v4l2_m2m_release(sess->m2m_dev); diff --git a/drivers/staging/media/meson/vdec/vdec.h b/drivers/staging/medi= a/meson/vdec/vdec.h index 2586851777000ef4afaf91824ea3f32168a94dd1..7a5d8e871d708db9639563c056b= a4b3fe9930eec 100644 --- a/drivers/staging/media/meson/vdec/vdec.h +++ b/drivers/staging/media/meson/vdec/vdec.h @@ -282,6 +282,11 @@ struct amvdec_session { void *priv; }; =20 +static inline struct amvdec_session *file_to_amvdec_session(struct file *f= ilp) +{ + return container_of(file_to_v4l2_fh(filp), struct amvdec_session, fh); +} + u32 amvdec_get_output_size(struct amvdec_session *sess); =20 #endif diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/= media/sunxi/cedrus/cedrus.c index 52a9588462ce5898705cc351fa461f3c49600ad2..80b43187f6eef827c7212a601aa= 2056dbc606bd4 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -401,8 +401,7 @@ static int cedrus_open(struct file *file) static int cedrus_release(struct file *file) { struct cedrus_dev *dev =3D video_drvdata(file); - struct cedrus_ctx *ctx =3D container_of(file->private_data, - struct cedrus_ctx, fh); + struct cedrus_ctx *ctx =3D cedrus_file2ctx(file); =20 mutex_lock(&dev->dev_mutex); =20 diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/= media/sunxi/cedrus/cedrus.h index 522c184e2afc99c195a39889893b3d4dfc2bfad9..c4b1217c14b6464b5b730c2af40= 83c58c36c0edf 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.h +++ b/drivers/staging/media/sunxi/cedrus/cedrus.h @@ -155,6 +155,11 @@ struct cedrus_ctx { } codec; }; =20 +static inline struct cedrus_ctx *cedrus_file2ctx(struct file *file) +{ + return container_of(file_to_v4l2_fh(file), struct cedrus_ctx, fh); +} + struct cedrus_dec_ops { void (*irq_clear)(struct cedrus_ctx *ctx); void (*irq_disable)(struct cedrus_ctx *ctx); diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/st= aging/media/sunxi/cedrus/cedrus_video.c index 9fae2c7493d090878a9f4f0f3923b1c6fd96dbe3..ad4ec349077547ea3428c7341f1= 52d729d775bb2 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c @@ -83,11 +83,6 @@ static struct cedrus_format cedrus_formats[] =3D { =20 #define CEDRUS_FORMATS_COUNT ARRAY_SIZE(cedrus_formats) =20 -static inline struct cedrus_ctx *cedrus_file2ctx(struct file *file) -{ - return container_of(file->private_data, struct cedrus_ctx, fh); -} - static struct cedrus_format *cedrus_find_format(struct cedrus_ctx *ctx, u32 pixelformat, u32 directions) { --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 3949D224891; Sat, 2 Aug 2025 09:25:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126732; cv=none; b=in/z1/dNzS7pj1laqgEXT78T48w3MNXa+ael0fe7j4EED2MlxSSMz8MJ+381+Lw/J3O3D1d+O2CZcsEC8LiMvSz+GoqEFXf+E/isY9YG8jbBJ9Fq+0smPGtbW5Aw6cvqQhMf9zc1T1BiJHcowcEftFe9aq1zsodXkBvvPZ2usqo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126732; c=relaxed/simple; bh=h5udZ1SzPumXnE7xu2zWQT6vfdKtMoA3NyZ01lPUHuA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k2/cttjHGI3lWhgQHO3z6Pan0nFLpo0oUYn0brZuyAClPbgvZPa4RxpsLCrusNafxE3HngnJDYKnYBKpf4e45K1FZFl0FQYB1blSfPMj9ZOfCLOkJJR8hAGdpSo6AB9xF5guOtweJDGZ1+CrrQi8vYoCHbYmFkQ6IHd3BNs/KUc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=iM9OfLxj; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="iM9OfLxj" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A80C42F0D; Sat, 2 Aug 2025 11:24:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126683; bh=h5udZ1SzPumXnE7xu2zWQT6vfdKtMoA3NyZ01lPUHuA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=iM9OfLxjFezRevsFSM+DHzmuj7nNeL7ocIFelwKtOOkub03t9gmFJnj5/MndtBa1u 1XukpB+YRy0Co1GOWWW3SG+Dxx0BaUMXn+oMf3Bj0kz24biyJYcQAGPxrgLXbniG5N a+YY9PwN+Cv72yF31/RICanxWaiXB8p++jEUVsBE= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:34 +0200 Subject: [PATCH 12/65] media: pci: ivtv: Don't create fake v4l2_fh Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-12-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6700; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=2/+7JKVHQ0FUPAMFvnWgDgM7Mra+DCKmELJTQXBkvDA=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj4n5+bYKeplnUHvNaRht9BxmiwNfWLvjFfp RrwjLb0lYOJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+AAKCRByNAaPFqFW PAmHD/4mhFhl/805WB3JLxIhy7zUPvIxr2/l7bll6BZb+Uwp4egXUM6l3Wr+RH/zsD/o7f2JO4p IKeuRxRQTW4A6Tbfa0RzfC6hysVeMWcv3mjkcBug3surPW4kuftKxbMbnm1t5Jk5jwN+j3H3q3P eCxZdeV65ONT4MJT2N8YblptRqH6aV9BdTdCP6b30dJwQy1e14T37qbNRtfHQBhxT7rML4K1DDj c6Qj1hrlyc/CkG07XT9hZUhGcwB7ra0b/2L7bp+8ijuhR0q7KGvXTKZ/Oq8SrINLvVgisiFfWKw iRc7K8Q7Rqk7503ezMkGbAskIlbn4kPaaSrCYUFQOGooexgaAGuevht3vw0PkMxW+lO+z3eqh1e hKtEbNAhnjZA5t0fxtpBNZK5XJqjsYLeEpSizSVzVVuEcMvMry+oTTLbhGcPrgRWtnqoh29L8QD YcRbxMcnzpw2+buRGdOHPm+9CUTmz71/80mKyigU7RFsBLwYY3+YIMBxSOu+l7XCVNKgq6AQ2ev hxXxr6rTciajnOManNEKxiWuM90o5SjS5WjkGDvJp+2GlRuEP0Hbq1HYXPjvSzbg11HgjbEHwfl o3wfhk1v6eO4g7gbV9Q4Z6NtQC7PxdjPkPVdcJC9akSlAlM/jjzolxFItGYzjltOT6bmjh193f3 Dpt/CwXPkT8LQTA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart The ivtv driver has a structure named ivtv_open_id that models an open file handle for the device. It embeds a v4l2_fh instance for file handles that correspond to a V4L2 video device, and stores a pointer to that v4l2_fh in struct ivtv_stream to identify which open file handle owns a particular stream. In addition to video devices, streams can be owned by ALSA PCM devices. Those devices do not make use of the v4l2_fh instance for obvious reasons, but the snd_ivtv_pcm_capture_open() function still initializes a "fake" v4l2_fh for the sole purpose of using it as an open file handle identifier. The v4l2_fh is not properly destroyed when the ALSA PCM device is closed, leading to possible resource leaks. Fortunately, the v4l2_fh instance pointed to by ivtv_stream is not accessed, only the pointer value is used for comparison. Replace it with a pointer to the ivtv_open_id structure that embeds the v4l2_fh, and don't initialize the v4l2_fh for ALSA PCM devices. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/pci/ivtv/ivtv-alsa-pcm.c | 2 -- drivers/media/pci/ivtv/ivtv-driver.h | 3 ++- drivers/media/pci/ivtv/ivtv-fileops.c | 18 +++++++++--------- drivers/media/pci/ivtv/ivtv-irq.c | 4 ++-- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/media/pci/ivtv/ivtv-alsa-pcm.c b/drivers/media/pci/ivt= v/ivtv-alsa-pcm.c index 8f346d7da9c8defb12191c3addb12a118547b9a0..269a799ec046c67265484945acf= 89a5fbd40a3f4 100644 --- a/drivers/media/pci/ivtv/ivtv-alsa-pcm.c +++ b/drivers/media/pci/ivtv/ivtv-alsa-pcm.c @@ -148,14 +148,12 @@ static int snd_ivtv_pcm_capture_open(struct snd_pcm_s= ubstream *substream) =20 s =3D &itv->streams[IVTV_ENC_STREAM_TYPE_PCM]; =20 - v4l2_fh_init(&item.fh, &s->vdev); item.itv =3D itv; item.type =3D s->type; =20 /* See if the stream is available */ if (ivtv_claim_stream(&item, item.type)) { /* No, it's already in use */ - v4l2_fh_exit(&item.fh); snd_ivtv_unlock(itvsc); return -EBUSY; } diff --git a/drivers/media/pci/ivtv/ivtv-driver.h b/drivers/media/pci/ivtv/= ivtv-driver.h index cad548b28e360ecfe2bcb9fcb5d12cd8823c3727..38c4ceb04cf834906ed877b57c2= 0fcbdb390da13 100644 --- a/drivers/media/pci/ivtv/ivtv-driver.h +++ b/drivers/media/pci/ivtv/ivtv-driver.h @@ -322,6 +322,7 @@ struct ivtv_queue { }; =20 struct ivtv; /* forward reference */ +struct ivtv_open_id; =20 struct ivtv_stream { /* These first four fields are always set, even if the stream @@ -331,7 +332,7 @@ struct ivtv_stream { const char *name; /* name of the stream */ int type; /* stream type */ =20 - struct v4l2_fh *fh; /* pointer to the streaming filehandle */ + struct ivtv_open_id *id; /* pointer to the streaming ivtv_open_id */ spinlock_t qlock; /* locks access to the queues */ unsigned long s_flags; /* status flags, see above */ int dma; /* can be PCI_DMA_TODEVICE, PCI_DMA_FROMDEVICE or PCI_DMA_NONE= */ diff --git a/drivers/media/pci/ivtv/ivtv-fileops.c b/drivers/media/pci/ivtv= /ivtv-fileops.c index cc91695a5b7605dcd964bd2c68bb12f645dc302f..67964a3c382c6627a7b3ce6380a= 2da97dcc47c3d 100644 --- a/drivers/media/pci/ivtv/ivtv-fileops.c +++ b/drivers/media/pci/ivtv/ivtv-fileops.c @@ -39,16 +39,16 @@ int ivtv_claim_stream(struct ivtv_open_id *id, int type) =20 if (test_and_set_bit(IVTV_F_S_CLAIMED, &s->s_flags)) { /* someone already claimed this stream */ - if (s->fh =3D=3D &id->fh) { + if (s->id =3D=3D id) { /* yes, this file descriptor did. So that's OK. */ return 0; } - if (s->fh =3D=3D NULL && (type =3D=3D IVTV_DEC_STREAM_TYPE_VBI || + if (s->id =3D=3D NULL && (type =3D=3D IVTV_DEC_STREAM_TYPE_VBI || type =3D=3D IVTV_ENC_STREAM_TYPE_VBI)) { /* VBI is handled already internally, now also assign the file descriptor to this stream for external reading of the stream. */ - s->fh =3D &id->fh; + s->id =3D id; IVTV_DEBUG_INFO("Start Read VBI\n"); return 0; } @@ -56,7 +56,7 @@ int ivtv_claim_stream(struct ivtv_open_id *id, int type) IVTV_DEBUG_INFO("Stream %d is busy\n", type); return -EBUSY; } - s->fh =3D &id->fh; + s->id =3D id; if (type =3D=3D IVTV_DEC_STREAM_TYPE_VBI) { /* Enable reinsertion interrupt */ ivtv_clear_irq_mask(itv, IVTV_IRQ_DEC_VBI_RE_INSERT); @@ -94,7 +94,7 @@ void ivtv_release_stream(struct ivtv_stream *s) struct ivtv *itv =3D s->itv; struct ivtv_stream *s_vbi; =20 - s->fh =3D NULL; + s->id =3D NULL; if ((s->type =3D=3D IVTV_DEC_STREAM_TYPE_VBI || s->type =3D=3D IVTV_ENC_S= TREAM_TYPE_VBI) && test_bit(IVTV_F_S_INTERNAL_USE, &s->s_flags)) { /* this stream is still in use internally */ @@ -126,7 +126,7 @@ void ivtv_release_stream(struct ivtv_stream *s) /* was already cleared */ return; } - if (s_vbi->fh) { + if (s_vbi->id) { /* VBI stream still claimed by a file descriptor */ return; } @@ -359,7 +359,7 @@ static ssize_t ivtv_read(struct ivtv_stream *s, char __= user *ubuf, size_t tot_co size_t tot_written =3D 0; int single_frame =3D 0; =20 - if (atomic_read(&itv->capturing) =3D=3D 0 && s->fh =3D=3D NULL) { + if (atomic_read(&itv->capturing) =3D=3D 0 && s->id =3D=3D NULL) { /* shouldn't happen */ IVTV_DEBUG_WARN("Stream %s not initialized before read\n", s->name); return -EIO; @@ -831,7 +831,7 @@ void ivtv_stop_capture(struct ivtv_open_id *id, int gop= _end) id->type =3D=3D IVTV_ENC_STREAM_TYPE_VBI) && test_bit(IVTV_F_S_INTERNAL_USE, &s->s_flags)) { /* Also used internally, don't stop capturing */ - s->fh =3D NULL; + s->id =3D NULL; } else { ivtv_stop_v4l2_encode_stream(s, gop_end); @@ -915,7 +915,7 @@ int ivtv_v4l2_close(struct file *filp) v4l2_fh_exit(fh); =20 /* Easy case first: this stream was never claimed by us */ - if (s->fh !=3D &id->fh) + if (s->id !=3D id) goto close_done; =20 /* 'Unclaim' this stream */ diff --git a/drivers/media/pci/ivtv/ivtv-irq.c b/drivers/media/pci/ivtv/ivt= v-irq.c index 748c14e879632ae6f62c3cc1981a168b01ed060d..20ba5ae9c6d1d0e6e4d856d1f08= 3e30a0f9be321 100644 --- a/drivers/media/pci/ivtv/ivtv-irq.c +++ b/drivers/media/pci/ivtv/ivtv-irq.c @@ -305,7 +305,7 @@ static void dma_post(struct ivtv_stream *s) ivtv_process_vbi_data(itv, buf, 0, s->type); s->q_dma.bytesused +=3D buf->bytesused; } - if (s->fh =3D=3D NULL) { + if (s->id =3D=3D NULL) { ivtv_queue_move(s, &s->q_dma, NULL, &s->q_free, 0); return; } @@ -330,7 +330,7 @@ static void dma_post(struct ivtv_stream *s) set_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags); } =20 - if (s->fh) + if (s->id) wake_up(&s->waitq); } =20 --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 342C3224891; Sat, 2 Aug 2025 09:25:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126741; cv=none; b=chUv8kUqu6lm5PFevsgEJg1EigDZw36affNhEa+O9yhkcDeBxe8jsj1VNjT/DkwuNI1ofo6dYOwMky6z2znuJBRA4sl48gilJabHj5pbJqJy+jYErAzO1HPwtwX86MWG5Q0lO4N7sDUGnZRPhsNT1i8ck/GNos5eg+HjP8y9IV0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126741; c=relaxed/simple; bh=b7RMG5gKbuuF6gv8S+Uj2KKTs6XM6lsobaqxn6pl4VQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=J/2ZgNFRQgiFp7mhxO11PTyErtukZLf5H+uIpM7AkiggpXaPBPOy2bA6Ya+dRy3l6Cry8woYHaXSWGqkWycmYlvEAkZ23A50YDS/gWwK6qC/5oUwqN1uDJpb2PG9DPDQXwky1uLBG9ykEMjHNISXc/hr4JfECsu3GCPSB5nlf04= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=gk3w0dlg; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="gk3w0dlg" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E2D6730FB; Sat, 2 Aug 2025 11:24:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126692; bh=b7RMG5gKbuuF6gv8S+Uj2KKTs6XM6lsobaqxn6pl4VQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gk3w0dlgcofaVXob0cmxl8yMO31aZvlLIP5dNDbKo5GN+5wPIeTV9Lm2ORxzAXc9q k5+FLvQAYlaUUa1kJh1WvioDAY3R/ZOTICtyWirY7Lq96AUzlXpK4qPEiJ/GIWg5RP 8w8iLIua6QiOS0uuC7UD/aR2bOMEvGLDOuD/wwGE= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:35 +0200 Subject: [PATCH 13/65] media: amphion: Make some vpu_v4l2 functions static Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-13-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3584; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=xoIDFBRhMGMv4oe8TS+uJUoPhd8rKNXueeGPvdsLtfY=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj4frLXYwpCxfo4ZpqKpoU9LXTbFeqaHunMr /yn/7NHhzqJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+AAKCRByNAaPFqFW PPryEACXh4Keg40awBycOCQweW9WKXDN0UhcSzNg8faLq0NIOsrCU3oYLR3dMz4vYAhlzfGSFi0 vqn6qO2LPe+ZmXjSVyJaJXyDjNDo+pzRTWl2toKrWplPdzOgk+cgtZX9MhTZs2edrBLCepiGmMm Nu4xsweyLEsP3us9ZxhJy6L5X1FVv5a6yVoy85WIbBAp+nHxjoGDxP6SUDoBrpk8Pfyl6+cIwzO rJty3YmxpSIB2JX0lum9rKPxO4UckOXnbDEP2WwP92vME5ewnUURSnfBS/NNRETxzt4oQHb4Zk4 GgEjqxl4NnGf/cu7L2xTlfHwtVcagda/LbUnAkjCkak7NvCibfzhpqdNAQplgQj96yxQaTDGItx lr4YhKx916rR2nU0B+GKKQnMnapP+21PSUI/nHrc7LFvre4WStF38IVTTWMaVfIYnRUny5I4UZ+ yhxg/qC2K27wR+PlqKw6ZoH7hit/PjiUZfQSzvKj4M6D2NV4B8D7lQB22k/2kMfA7ShJkI4u3HX YsfjXe0txPZ07xUZuMpwf93yl86YrU31oY0Fu9UlWLvINmMwBjLhiHeMvmwaANWSSUwfCgjb2VD 4ohbl6n/IEG0oLZvqHlTD5on65ODc8rJFC3MmECELJ7oRJUG/keEolT9Sv39sWLZ6auuIdu8mU2 0EofLwM3RKG2hrg== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Some functions defined in vpu_v4l2.c are never used outside of that compilation unit. Make them static. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/platform/amphion/vpu_v4l2.c | 12 +++++++++--- drivers/media/platform/amphion/vpu_v4l2.h | 8 -------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/plat= form/amphion/vpu_v4l2.c index 74668fa362e24fd34829b500e99c8455a9413fc1..306d94e0f8e79faaacfa35b28e5= 786860f7bd1ca 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -24,6 +24,11 @@ #include "vpu_msgs.h" #include "vpu_helpers.h" =20 +static char *vpu_type_name(u32 type) +{ + return V4L2_TYPE_IS_OUTPUT(type) ? "output" : "capture"; +} + void vpu_inst_lock(struct vpu_inst *inst) { mutex_lock(&inst->lock); @@ -42,7 +47,7 @@ dma_addr_t vpu_get_vb_phy_addr(struct vb2_buffer *vb, u32= plane_no) vb->planes[plane_no].data_offset; } =20 -unsigned int vpu_get_vb_length(struct vb2_buffer *vb, u32 plane_no) +static unsigned int vpu_get_vb_length(struct vb2_buffer *vb, u32 plane_no) { if (plane_no >=3D vb->num_planes) return 0; @@ -81,7 +86,7 @@ void vpu_v4l2_set_error(struct vpu_inst *inst) vpu_inst_unlock(inst); } =20 -int vpu_notify_eos(struct vpu_inst *inst) +static int vpu_notify_eos(struct vpu_inst *inst) { static const struct v4l2_event ev =3D { .id =3D 0, @@ -573,7 +578,8 @@ static void vpu_vb2_buf_finish(struct vb2_buffer *vb) call_void_vop(inst, on_queue_empty, q->type); } =20 -void vpu_vb2_buffers_return(struct vpu_inst *inst, unsigned int type, enum= vb2_buffer_state state) +static void vpu_vb2_buffers_return(struct vpu_inst *inst, unsigned int typ= e, + enum vb2_buffer_state state) { struct vb2_v4l2_buffer *buf; =20 diff --git a/drivers/media/platform/amphion/vpu_v4l2.h b/drivers/media/plat= form/amphion/vpu_v4l2.h index 56f2939fa84d07b7ea07e889ab5ad3bb7ca9ab5c..4a87b06ae520306ede356b6f330= 9d8b4a67c204a 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.h +++ b/drivers/media/platform/amphion/vpu_v4l2.h @@ -26,15 +26,12 @@ void vpu_skip_frame(struct vpu_inst *inst, int count); struct vb2_v4l2_buffer *vpu_find_buf_by_sequence(struct vpu_inst *inst, u3= 2 type, u32 sequence); struct vb2_v4l2_buffer *vpu_find_buf_by_idx(struct vpu_inst *inst, u32 typ= e, u32 idx); void vpu_v4l2_set_error(struct vpu_inst *inst); -int vpu_notify_eos(struct vpu_inst *inst); int vpu_notify_source_change(struct vpu_inst *inst); int vpu_set_last_buffer_dequeued(struct vpu_inst *inst, bool eos); -void vpu_vb2_buffers_return(struct vpu_inst *inst, unsigned int type, enum= vb2_buffer_state state); int vpu_get_num_buffers(struct vpu_inst *inst, u32 type); bool vpu_is_source_empty(struct vpu_inst *inst); =20 dma_addr_t vpu_get_vb_phy_addr(struct vb2_buffer *vb, u32 plane_no); -unsigned int vpu_get_vb_length(struct vb2_buffer *vb, u32 plane_no); static inline struct vpu_format *vpu_get_format(struct vpu_inst *inst, u32= type) { if (V4L2_TYPE_IS_OUTPUT(type)) @@ -43,11 +40,6 @@ static inline struct vpu_format *vpu_get_format(struct v= pu_inst *inst, u32 type) return &inst->cap_format; } =20 -static inline char *vpu_type_name(u32 type) -{ - return V4L2_TYPE_IS_OUTPUT(type) ? "output" : "capture"; -} - static inline int vpu_vb_is_codecconfig(struct vb2_v4l2_buffer *vbuf) { #ifdef V4L2_BUF_FLAG_CODECCONFIG --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 A43B4227EA4; Sat, 2 Aug 2025 09:25:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126750; cv=none; b=C/4zUXQYm7pwno0mGsM1ghIE4WYjzrqb4L3ueerTkly6SV5s6X3H6BhPMKqO1cBZQrrS44lyobb7EVzxTFK5qQDbFNXGziL0gpQvsoGqkxJazLoSVOTcP6Gfe4mEZCxgb29Cwv2iXUB9a5bm6QQn/huREgckEBGuWsqzGgviE5E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126750; c=relaxed/simple; bh=J8TTwhJddKQQCi/2/sZ0CDO0sHlrqQEKhYX28Jwyu0w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=I8RQ8gMj86FeuiJCd+jMC0soaT/ChjPePx2QTsfhefJGsuiHMFxz6+L2xYtiOJq9X1x4Ki440N/mcZSH9ajijge5dUY38wC1PLEB2KzZBNK4yanyNbJP3T7GGlhYC90KSQfpg7eJ/7NxzISU8WFVZW3Qa4SKzU3mupHPTDgYoS4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=tM1rKmPr; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tM1rKmPr" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AFB0232DD; Sat, 2 Aug 2025 11:24:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126702; bh=J8TTwhJddKQQCi/2/sZ0CDO0sHlrqQEKhYX28Jwyu0w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tM1rKmPr+fH2WfgPtZCZkJjqcu/w7/G+w6cz92yWycqLT5VpOjmPaMdaJfqzClFxZ 5ClT7kBVW481USto1xQwyh7d2yBzFeZ57f9JBGoGwhKuk1y/tiNNcIzdVEmbigKo+i EUoFs8UzINRMjvZZz5Sw6nhUJny7Gin1ywKuJ6B0= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:36 +0200 Subject: [PATCH 14/65] media: amphion: Delete v4l2_fh synchronously in .release() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-14-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3037; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=hzBP7yKh2YjUysXVlLoN8hpVPYpgEzv7aW1XCIBS1I0=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj4AOSO5FBCFS9eBnS6KgpFdnr2VL0H2UfS/ DqQ0HfrHvGJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+AAKCRByNAaPFqFW PMm3D/oDVbxrw1/iCgPXqStUx8dfqUJ7S6vGmdOYo0/z1iksjHzSYi48UbwtNPUG7fuHA21WJ1+ kiPRiGKCdr7IvMGFPn+j/bFV9E/BXMYyPGvHFiWXtgSOqAJotOWsw8+b5INDo9uPZMDDeMOFy0C zLQcJ3eXtVeuSokKmLg35b4Wrd+FPqOMgjTOLd34T47bVZpmQoDbBQIfCm7CXbW4gE3j9D64rMC odNDo8AGXh8fTYMNENAeaX8+x5JZ0aWkkTxhu4OZ/dlnmjhSj73sELzFd0fXHcaMhaMakMrK/iL zokSPIqRSpg0tDyguHqphECalSY8+YnokUIspV0vSEyhl7stnE4cLs3mlbY4+dh6QlNaSmlAf3l 64oz6QQbIt20Gpbq8xnXVgNweOalGy4qJ4QEcrx5XDGMYZbVZ5GY44CbagDYuC5Zj/CrI0eN4O5 MfKakB5B6wFkn+t+p20yWBTnCDW2MFBuQVeHNCCJcm0vs6G8FgrBiMrueeIYm4ejGumx2u+je3Y WoQxW0Cb9mtc6ZDqQfo0qZSej9IbCTT/UPvbcjJuLxbmi4zZn9yYpAZR5AVslfu8ZAXjvw4k/wh FznYp7H1Ps4G02wLUtxgZNLFh9Jl/HWXlDKawTwpi1Y9HJXZPnI7IbQZ3dd7nGmJEpFneZx4LR+ Q6bzQiwDKqZ7sEA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart The v4l2_fh initialized and added in vpu_v4l2_open() is delete and cleaned up when the last reference to the vpu_inst is released. This may happen later than at vpu_v4l2_close() time. Not deleting and cleaning up the v4l2_fh when closing the file handle to the video device is not ideal, as the v4l2_fh will still be present in the video device's fh_list, and will store a copy of events queued to the video device. There may also be other side effects of keeping alive an object that represents an open file handle after the file handle is closed. The v4l2_fh instance is embedded in the vpu_inst structure, and is accessed in two different ways: - in vpu_notify_eos() and vpu_notify_source_change(), to queue V4L2 events to the file handle ; and - through the driver to access the v4l2_fh.m2m_ctx pointer. The v4l2_fh.m2m_ctx pointer is not touched by v4l2_fh_del() and v4l2_fh_exit(). It is set to NULL by the driver when closing the file handle, in vpu_v4l2_close(). The vpu_notify_eos() and vpu_notify_source_change() functions are called in vpu_set_last_buffer_dequeued() and vdec_handle_resolution_change() respectively, only if the v4l2_fh.m2m_ctx pointer is not NULL. There is therefore a guarantee that no new event will be queued to the v4l2_fh after vpu_v4l2_close() destroys the m2m_ctx. The vpu_notify_eos() function is also called from vpu_vb2_buf_finish(), which is guaranteed to be called for all queued buffers when vpu_v4l2_close() calls v4l2_m2m_ctx_release(), and will not be called later. It is therefore safe to assume that the driver will not touch the v4l2_fh, except to check the m2m_ctx pointer, after vpu_v4l2_close() destroys the m2m_ctx. We can safely delete and cleanup the v4l2_fh synchronously in vpu_v4l2_close(). Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/platform/amphion/vpu_v4l2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/plat= form/amphion/vpu_v4l2.c index 306d94e0f8e79faaacfa35b28e5786860f7bd1ca..57ca6262bb04b356a85e217ef51= cfb13cb9a0a36 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -724,8 +724,6 @@ static int vpu_v4l2_release(struct vpu_inst *inst) =20 v4l2_ctrl_handler_free(&inst->ctrl_handler); mutex_destroy(&inst->lock); - v4l2_fh_del(&inst->fh); - v4l2_fh_exit(&inst->fh); =20 call_void_vop(inst, cleanup); =20 @@ -794,6 +792,8 @@ int vpu_v4l2_open(struct file *file, struct vpu_inst *i= nst) =20 return 0; error: + v4l2_fh_del(&inst->fh); + v4l2_fh_exit(&inst->fh); vpu_inst_put(inst); return ret; } @@ -813,6 +813,9 @@ int vpu_v4l2_close(struct file *file) call_void_vop(inst, release); vpu_inst_unlock(inst); =20 + v4l2_fh_del(&inst->fh); + v4l2_fh_exit(&inst->fh); + vpu_inst_unregister(inst); vpu_inst_put(inst); =20 --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 6A5D4229B2E; Sat, 2 Aug 2025 09:25:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126759; cv=none; b=XbkKuRNEnY6Fl3VItci97bSgnqaMK69TfibJ/japcO5Eic8VZx/xwd+rrdVnLyZVP9w55Wzy0Ox5tAPucB05rX1gtPYeTqbmJuKkqaA71n/uWt9NaooXa0CuX1w/mi8/ZUBNUxgbzPQTBIJC3vNsrR8X9hGrsd2ry+LApZ/jtBc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126759; c=relaxed/simple; bh=dO9x6/VIVj6bTEsPK3lsquc2JUWgPxCjD+OB8gyY8EI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gOV35DHXi4Ly8nb3BGcG9/Q2W4qrmbDT9kFE6x7PquQ3rLmgmK510MmKK4phwbfAAE7Y2/txWEwXFidVTsU78w/+qM2U3NdM/e8jQA/mrroXO7GXRNEWzXFzymW8gwfN5etfUt9CTUyT242211yl6ICsdMzNUnf52Dmt9vbqsCg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=kMU4Dgdm; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="kMU4Dgdm" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 39A70330B; Sat, 2 Aug 2025 11:25:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126710; bh=dO9x6/VIVj6bTEsPK3lsquc2JUWgPxCjD+OB8gyY8EI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=kMU4DgdmjQKEw5APBDTpC7/xsmKu4JDUI/gfBamVSR4hVRyM6IzMlC5+RXI5DwMu9 dIgl0Xdc1+ZeL7bWgDQKKc3vqcqeRucizw8huGBTW6ZcjIv7CRc3vnPV6hFo5V1DhW oUk0q7by7K/kLWQOfaXN01E8fmJjaym0xSbTUjhg= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:37 +0200 Subject: [PATCH 15/65] media: visl: Drop visl_v4l2fh_to_ctx() function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-15-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1073; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=0VP/r2vlVhnFVYKofY26Y91mhgecgJPyrhx9vTNdS8M=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj52mJZbEKi2xzPTCbRBAU/vdaACQYQlG+Xy SMzPz1qhe2JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+QAKCRByNAaPFqFW PB2GEADA7hMCuMVfeDlEpQ62CtlmzW48xyXjOFzVROOd3wLvASETZNeK3+0Q6FLDTI6TGFb/zco lm6i6s+vWnrcZXkABPvZ8X3GyoNhSEZt8omQCyWjX+JN0x3DtRaHfIbluyIrSUL3MlIX17uG86e 8VoqzaLuLF9026rG4XoVdFawhCO+LTD2NjKYSvnLJ+7pTYmPAvHYGyrG/jWZqOSAYHQStI5IRSr RJnkUgRuvf55ehCgVhwg5t4Py74KWzCXU9qzjCszWEgyx5nyRb+/DSRVtx/vvwNjf9k7A9q8aTU 6oR2TIlPV6Xo6VEzJJLlhvpjpbyzOhbDx8lcWtHNH/dm98xNWPB96alwum/oP1n+8bwObfjDq/Q g1fhdUfYPTsRj3HftB0ACQ1GUc6M1IB49/f54llbyQB/DL4Aljr79EG5+LjJfhmv+vj4P0Zz0SQ FftkiNVi7VY6Z0ZOx4rC2oyyCSb+8DF9AnUVqZb/ArUZZGesBqVEy0U3OazFNeAOhTryUCDEGV9 BoMDZ3I5B3vBt6UGMDhq6T7lpEPz5WV3HdjiU+uJev+S8HUL7Yn3OAblvyv7ItfIgMdw5SFmRld aqHQOX5LVKQbyRI2QukK/0Imm58hWZQFye8fdAG39IMFR8AacdA3nP+YmKSqOFc6DHUwR89p72O gxMmoyNTVU3+8LA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart The visl_v4l2fh_to_ctx() function is unused. Drop it. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/test-drivers/visl/visl.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/media/test-drivers/visl/visl.h b/drivers/media/test-dr= ivers/visl/visl.h index ad3d0ab791d6aec4fb120dcfe86000e498f6713d..2971e8b37ff6660f68b5f4bbf19= 9e0f8657f6686 100644 --- a/drivers/media/test-drivers/visl/visl.h +++ b/drivers/media/test-drivers/visl/visl.h @@ -166,11 +166,6 @@ static inline struct visl_ctx *visl_file_to_ctx(struct= file *file) return container_of(file_to_v4l2_fh(file), struct visl_ctx, fh); } =20 -static inline struct visl_ctx *visl_v4l2fh_to_ctx(struct v4l2_fh *v4l2_fh) -{ - return container_of(v4l2_fh, struct visl_ctx, fh); -} - void *visl_find_control_data(struct visl_ctx *ctx, u32 id); struct v4l2_ctrl *visl_find_control(struct visl_ctx *ctx, u32 id); u32 visl_control_num_elems(struct visl_ctx *ctx, u32 id); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 EB8C91FBE87; Sat, 2 Aug 2025 09:26:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126770; cv=none; b=NsZjmClagKoTj/Dw22im29FCkFCW/2e8HZ5ijsrRhADa/CgAuWZxlgdCwOwVojwQsPkuaYDGyXx4zBl3qnUZ6n2nE/TxsZ+wIg3rs9rpw75oI4XlfFawc+zWaw13kyO/xJ2dUJCGBp7mBrOkQa5ozL3UF1Z8JIO7TjHRP5gXFvg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126770; c=relaxed/simple; bh=PZJ1dtH8nmhfLvI56JLBdPdVDA0PB4szlI4XA3Wq6yw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ap8zmDdpyOdiIEeDYiUE0WKzo4y0bVj6U8+JZVVXlaz8VU52pngmMmxoj/at7JRZvrrrIRJpB8gfVr4cuyxlURB/LpbpsWgcIrhjNnKLAx5LysHPdB8LQpUg+IenONWJJWc66roMKdbxbe6jreuPtXGG6nREGYeLyC6Yem2TsC4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=OTFLVa01; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="OTFLVa01" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B634132CE; Sat, 2 Aug 2025 11:25:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126720; bh=PZJ1dtH8nmhfLvI56JLBdPdVDA0PB4szlI4XA3Wq6yw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OTFLVa011NnEd62Pg03uYC4ijQ+I7C7eKlpJ/1lEAKQn52ln5poN59ByaM1OP/BJJ 1bGZzAQl8d3H7dkSml1kQTy9Mv+ol4VjnBH3vkVhOgfYLCUFuf44EaIzs77SisC9gp 9NTv3iC0LTAsfBWAeEubFS1vkreWcTWYo8AiEHoc= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:38 +0200 Subject: [PATCH 16/65] media: v4l2-fh: Move piece of documentation to correct function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-16-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1332; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=3mdLRukve15yg0XhGTxj6WeSGHvr7vlZ9xqEhBw1Ap8=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj5Aqu9VSv4VW4JgzhkKv4IejFT1+wHP4iEB k8A3tbKR0+JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+QAKCRByNAaPFqFW PMs+D/95ql+AofdksJ9+zTLY+7aOcDVLMQvYbA3pgfKJARD2L8GaSgT26Bs+muoW5SxO55NXUua M1AsJL8/xTGUpkmb9QB6bqbkIQqfW0MAU/R6prYbSr2QVa7palsTZqZuzU1Ngf/aJWjOMes52Hg FEqpmzq1bF+rXHMuiK4CKcExsn3a5ww/jpd1mJQ2dKh44gRYjXhv+JEsMUBsXfF8bjZsjHKBEdR xiGrMTt07gugBQDNa0zaJIV9bvYRqzDBh6zrx6VG9cCqltgdvn6qa4E5xuD2wJNOYo5f8jHzICK jzkTlBzDRuJ9pyNfQwcPM2CucUdG6ESpU38FP080jZnPDHGqOEOpZSPTNi1r6lkQyBZov0Oidmh AFDsX3+1yLe/Q36ytvuP/eRkK0QCU3T0AreReNKzLe/MkxA9MOs8v8n5Jg+hO60DSPMhzyIOzF8 TTUgxC1Rv7kDtLKhwRVAgFmypxz+Yl7XdTm7v5nA8aqCQJTHjNzPSMZbDP4mIlzCVNWGztU2CKb OF8H9KNqJaiUO3BJPX1eqCOacTSvtuI/Z3y9X0/HTPfwXXZNSkaLm1Wp2oPcWu4T8H6XTH9dO4t JIh7O8nImH8gE4dCTNvxjXypvMugfjCkwL4iM/yXf0Ilmp25VoACwNJCB3vA67AyhaVa+5Pd786 vgFeamTgOOjrY+A== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart The paragraph in the v4l2_fh_del() documentation that indicates the function sets filp->private_data was added in the wrong place. It is meant for v4l2_fh_open(). Move it to where it belongs. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- include/media/v4l2-fh.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h index 823fa8ebeb8fbe36f05a1c31d3d3a9b7bba4de4d..14e7136e693f0a7b8b259592006= 03028e0db36ac 100644 --- a/include/media/v4l2-fh.h +++ b/include/media/v4l2-fh.h @@ -101,6 +101,9 @@ void v4l2_fh_add(struct v4l2_fh *fh); * * It allocates a v4l2_fh and inits and adds it to the &struct video_device * associated with the file pointer. + * + * On error filp->private_data will be %NULL, otherwise it will point to + * the &struct v4l2_fh. */ int v4l2_fh_open(struct file *filp); =20 @@ -109,9 +112,6 @@ int v4l2_fh_open(struct file *filp); * * @fh: pointer to &struct v4l2_fh * - * On error filp->private_data will be %NULL, otherwise it will point to - * the &struct v4l2_fh. - * * .. note:: * Must be called in v4l2_file_operations->release\(\) handler if the d= river * uses &struct v4l2_fh. --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 9B5A92192E1; Sat, 2 Aug 2025 09:26:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126781; cv=none; b=RL3mW5Jiy33RSyYYhaFcgXURmg/CHhhtUA7U1aesQV1b9VNFKGfQQmBhhFB/jIGdYit5CEigMgH6knN9Y0mIMNI3siuAq8jIU6XVaxca2/e9Np+sWE+4q8UlvtCf5zrwtoP4CX96otGJjB3gTpF1hBzUb5zGgQq/JDk3pOqr/xs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126781; c=relaxed/simple; bh=zpnIwVYIp7ypZ1fcLHzyPvjh8rTKeT+VELtoNeP7zPc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eep6FsNyVtvBSrLp/WQQKiSU8PP3adKa4406LVfHSXQhgTlL1R0m6msexY3bUbfu9cXcIHEy3XbYmceAG/pIAeA1b9IPQAlXTJIgM+lkTpLwdH0Izh2eYWltzeoOJd/FeuJPymQM4t/l6jQUdEzHNJtEW9UhY+ZELnmkW3tadKA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Aq19Q2nr; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Aq19Q2nr" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7ED6732A6; Sat, 2 Aug 2025 11:25:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126731; bh=zpnIwVYIp7ypZ1fcLHzyPvjh8rTKeT+VELtoNeP7zPc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Aq19Q2nrPXf6402OKOWFm8otA0CLAkk8S1RrOtGTySgQYBF2fg4rJCODH8bW16FNL pVgq3zitoHUeNFytnfbtbBBgd9E5Q5Bdy/8WtYlDbVA/Jz3CVHIP253xgfEAfa70Za oPRzuCj4TIjDImKku1Uj/Od/PKd2Gg/gU8ccslXQ= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:39 +0200 Subject: [PATCH 17/65] media: rcar-vin: Do not set file->private_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-17-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=936; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=zpnIwVYIp7ypZ1fcLHzyPvjh8rTKeT+VELtoNeP7zPc=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj5qAvM1W11y3eYPTqi4SdtrYyBxO2xYiR+h or9E17Q/iGJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+QAKCRByNAaPFqFW PN2tD/0RGqTPdqW8RlaR9z1IRhg8ScsmdFRh/ZMQE2VtOzJ94v7+xB2dliSExPo9x7ySaLIYI1f LwLSeI+X1RMPjTK+lN3mVhG/LbQf0Z8+NsEE6GEe+L4faXhbBL/vfddlGjgMHYGZXvYoISOP6rb KC2/r9tsW8n0VY+X7Tv3yWkksNugzetOMqAe/kbdIOpGg/zFwgGM50hjZnL5qaUUN9qF/bPqQ/R irtg2ynJVsxkxn9JK7XA3NTPxlTQTrh9LUhuMAwDowSqRZ2S4ij7l2PiLUgxcHIz7kjUm9MFPJY 8223+FLQRPI0l7exJgDkLe5Te6yvPg/pmGgRlipYufbF8ZOaA2Eu+nGdYbxvQu+4yEqEmVDP34M lNTnm+YWFa717LA1btjXhdQeUxzGYlH+/ST3yFGWczrxr4cAAsnJth2pZ1zVZMUyTQUjGpG9VAR qmEIBwJudVBfoSmzM71uajLl3fBbysQPX5MARM8q9r2RaS8nUM8+hoTrKOQKERxy/U1Ny2Y/sbu FD+m5FALVJT7xpmYCH4/aSpaU/icTmbFUaxMNlUCBPeMj0k8dN7M2uffS4Ce/jJ7ph3AgvX7OQE E9KLB86w2mijIE71MOjEY1QhNEFeoF+UNjiiUimmNL4YZXqHmOXLaLQoD5qZixbfvO0xo5FLtPP sclGwxTMJHMLRgw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The R-Car VIN driver sets file->private_data to the driver-specific structure, but the following call to v4l2_fh_open() overwrites it with a pointer to the just allocated v4l2_fh. Remove the mis-leading assignment in the driver. Signed-off-by: Jacopo Mondi --- drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c b/drivers/= media/platform/renesas/rcar-vin/rcar-v4l2.c index 62eddf3a35fc91434cb2e584a01819380a7a6dd8..079dbaf016c25139e2ac82be63d= 8fce0d11fd208 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c @@ -588,8 +588,6 @@ static int rvin_open(struct file *file) if (ret) goto err_pm; =20 - file->private_data =3D vin; - ret =3D v4l2_fh_open(file); if (ret) goto err_unlock; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 14E6A2192E1; Sat, 2 Aug 2025 09:26:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126793; cv=none; b=i4wGDEcq8Ja1k52jRbJREWASXMu3jD9SF9jSK70oX3ZIOuE8Tg4/dJqi6Xs8mX0k80rHuv2zdNIWqZklphEOhsjF2g/k3JhYdQ2rMu7Gu8Tz4a9SWQUI9F3W1JGO0VhenEQiwSfG8142FVg88/HlwRlrkXLSuZAKhI3DUa1mJFQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126793; c=relaxed/simple; bh=w27FBrYuy5luuq8sfLJhkAyXcxYLO6q6OgUGzOvjXCg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fxtn9N4YM0ZDU3CDN0P6ewbICzTGw1m5I36fLEtpuXkFDYRfuFJWs7636C9hFl4j7hU9XOZXqOC2vN81r/b0shSA1IjILapwvtAXctU8gN7lGDpF2ZEU4mSx2KFQ7s8b5+rMbfmR6Ix198zYoju0lhA0qywAasjMOdxfRY45nHU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=KfCGdKe1; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="KfCGdKe1" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5C5733382; Sat, 2 Aug 2025 11:25:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126745; bh=w27FBrYuy5luuq8sfLJhkAyXcxYLO6q6OgUGzOvjXCg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KfCGdKe1K3Fc0zAQ4xzG9+N4gRTgUX7hp2XSLsiS8QJYWuuBMu/dxj1woEa4oaDSG ePa2piLt7m4G65UgqLGBXtTVqiJuzfB5hKjMmfZtMDLqdf2V+hRecSUEVTop8muZJ9 6AtH6ZyFsW2g9mm1rqXW6sWXRXQIwCNR02B0Uaeg= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:40 +0200 Subject: [PATCH 18/65] media: rzg2l-cru: Do not set file->private_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-18-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=954; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=w27FBrYuy5luuq8sfLJhkAyXcxYLO6q6OgUGzOvjXCg=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj5leh6NZr7YBb5F3lUqdPDVAoAv/E+Apn8a VdBJqbYhJOJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+QAKCRByNAaPFqFW PDjxEACcu4vUKoDreIA9sdrRv0rPntbmVcO2EIY5HI+PZ7TWdXhWtE/uwJnsTBw8XW8YyxFL1Ko B7edSHJtyHk7hhRiCEQshw3WA5B3rs82kRtrhLR3zwlgcyLE96k1J2SJQpEzrtt9p9E51UWfD0U BqcZAisqTFozP7zQW0WGKc8lEyJt0/F2RNj3Ic0vjqTjBg90DgZsPtueqxNGkinh50/AXDKsZxA +HMqE2gTktb4hQIXKTjZpa+e+3ILeB5U0Mnrz1/6EBcONhc0haAuWp1Vf5xRpZkQxJXpVtBEi47 RusW/FbWHWez/uMc68lFdXOe005GtLsYoP9jbKJmi9am2yQGdjulGsavfIHnnwNdSSwhRFKyeEj Frh8FHbh6zi6N/2qZQqS2HLKV0PQvUit8vqN86W8YqZ30843b51yZ1uMMqXDa4JpeJV+5by9KaL XXbn9tYid9Mu+NVhfQxXxTiUFZRRWTUMhKJ/fb+7d6Ckohv/KfMZT2NCIIsQQNLzJb7V9iR5jJT Qw6Q2Yr6GB/yGn+78O8+pyIAfOS1/O36Otr4bdVWOkjkBzfXrJ/RksX8plhoJE390pM1Wbd0GC2 9ByBL0oNCt/Vvv8CMMv1vO87h4lAeh3jTbr5YVmfD3+1X/gXXOZRR1GBpkDZJLW8ctFkCmxHueY fs0wBGy3WUnSD6w== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The RZ G2/L CRU driver sets file->private_data to the driver-specific structure, but the following call to v4l2_fh_open() overwrites it with a pointer to the just allocated v4l2_fh. Remove the mis-leading assignment in the driver. Signed-off-by: Jacopo Mondi --- drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drive= rs/media/platform/renesas/rzg2l-cru/rzg2l-video.c index a8817a7066b22f8a8dd1fdab50efabc486e4dfdb..941badc90ff55c5225644f88de1= d70239eb3a247 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -1078,7 +1078,6 @@ static int rzg2l_cru_open(struct file *file) if (ret) return ret; =20 - file->private_data =3D cru; ret =3D v4l2_fh_open(file); if (ret) goto err_unlock; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 D118B231A51; Sat, 2 Aug 2025 09:26:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126804; cv=none; b=OY6idXrS7lSiS6xpI0Yp95Vf+K1SIq7SQZjux64CSF7AniInb84spMo4CmiqiCpREyG7kaHKnJdDWvqWmFEIyu7FusgbzVCi1INQGxylUMwp5zFz0cpXArWNfCJ/egs3MHiNVVQ2GBSbe6HnWF0LVLxwcjQtm3nKtxex4CFMaYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126804; c=relaxed/simple; bh=W7Xf+mYBvYt6o9va9RI60UvIC8rElGReU++HhnCmVfg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QAE8KuvMdAYE50HcY+R82G7fmAIJe2Cjb/WV1zZwJC3j6N0zdSgoL7AKO7wMbWPWjZl1gqe1RFmMg3E9kThKEaBV6M1tltH+LVZW8lyLgUpnF4mBRQbMPl6P2Xvz/SFbugKNOvi6AW11rvz5OauCh7IbD2pLM+8CBFf15SM7muw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=FmxGWJBO; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FmxGWJBO" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 92F0C3484; Sat, 2 Aug 2025 11:25:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126756; bh=W7Xf+mYBvYt6o9va9RI60UvIC8rElGReU++HhnCmVfg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=FmxGWJBO4E5gfmQ58+RSnlUN52ZRP+BEdoqkKtsfvQR6jjDAnirS/9gNoOYc57lfI RexzJSryXfalvYWYRWKmdwZ8L2tq10eTyRsJFwKGBOzBN7fqkrTHkfy8UsCflim1KR F/nX+wFryQEtYqk1VrqnVMHTDoDHwqd89mcMY3hM= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:41 +0200 Subject: [PATCH 19/65] media: camss: Replace .open() file operation with v4l2_fh_open() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-19-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2008; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=UzWhpz4xRfaNWR/lEJP22EOtdoViE3HjL6eKhJD+k4E=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj5QI9RGxRjTZ4i0/Oxsr0jsuAyLpLtzBDRp lLra/Ptx/+JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+QAKCRByNAaPFqFW PLxcD/9DQ1eh+7ORvSewCGfbUsdvwcusgLEdfimWMtixIHeb8GHjJBgZDHWANs4tzRhizZXc00D eB14EgzGTuYSfBh+SeiIQc2W821bIB4AF47VJ7paLr+6Ehpkjta3Z9R8684aE4hVEiozkIjYbTm YDe7CD5rgm8Jxkr6rX3dnXVv3MwvobNjhi4ZLVj6k9GQi4Knz4hcfrM/vftFhzLuQJ7iO0z72Pt kNNyNzwedzcS25WOSLeBekAuKEUA5on008vbsIrI+w6ZkD1g3nPmRoK0ak2y8wZBKOFoxpWVg41 hHb++Y41ZeyaCZqGPftDkbkZiTaN/mlWTMoxSmxYGEQK98fuyUmJlocZW7DqkRmRr+0QaBXBuUX 2P/KOa1ID1yyoeGLNOtc/IJoi0NMW/2fxW504y5sisWA36Esidq6GNT+5Brx9IwS98eXy8ujgHC OeQ9v8xXeq/kiAy1xvlranHBEXkvrjxMJrC+Mh8Q075Ps5z2MIKmHxhkZ3hp3a0UEtZOHnSr1w3 e++lQSZIhkz5edb0mFzoBAz4eZuAcMxacVvDKu6o0H//a5qBlxcGCrWKfBGmMCamzv5ClbFVnOg WvJO6KxSYl0EQPtZIbie3YGK/346Ea3AjdRLlWbUUCy1XZ+IuhfreqtwvYzPbTByCucwYBv86xb RdlrEzhdk+VnUcg== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart The custom video_open() function in the camss driver open-codes the v4l2_fh_open() helper, with an additional mutex that protects the whole function. Given that the function does not modify any data guarded by the lock, there's no need for using the mutex and the function can be replaced by v4l2_fh_open(). Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/platform/qcom/camss/camss-video.c | 32 +--------------------= ---- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/medi= a/platform/qcom/camss/camss-video.c index 8d05802d1735a35cb1a1a0a81c6666b1517dd2e6..c5d02f9ebc6aa9bfd6910944f3d= 40a2e5f0a908f 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -604,36 +604,6 @@ static const struct v4l2_ioctl_ops msm_vid_ioctl_ops = =3D { * V4L2 file operations */ =20 -static int video_open(struct file *file) -{ - struct video_device *vdev =3D video_devdata(file); - struct camss_video *video =3D video_drvdata(file); - struct v4l2_fh *vfh; - int ret; - - mutex_lock(&video->lock); - - vfh =3D kzalloc(sizeof(*vfh), GFP_KERNEL); - if (vfh =3D=3D NULL) { - ret =3D -ENOMEM; - goto error_alloc; - } - - v4l2_fh_init(vfh, vdev); - v4l2_fh_add(vfh); - - file->private_data =3D vfh; - - mutex_unlock(&video->lock); - - return 0; - -error_alloc: - mutex_unlock(&video->lock); - - return ret; -} - static int video_release(struct file *file) { vb2_fop_release(file); @@ -646,7 +616,7 @@ static int video_release(struct file *file) static const struct v4l2_file_operations msm_vid_fops =3D { .owner =3D THIS_MODULE, .unlocked_ioctl =3D video_ioctl2, - .open =3D video_open, + .open =3D v4l2_fh_open, .release =3D video_release, .poll =3D vb2_fop_poll, .mmap =3D vb2_fop_mmap, --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 A173B207DEE; Sat, 2 Aug 2025 09:26:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126815; cv=none; b=dhAJUBH9v2KB8Qc3/mmRQO0sOVmIo3Q91ewq1HqaaOvs+J93m34nRqSHzjwa+3ULqPFsBwVjTXk87MvmuN/ZnkPTWZU4u23eCoeWIbT8AlUtBPaVXUSz0n8EU0Wis0IvdgjfBA1ykHPs6LBE4Nrq3E4H1vJ0wnDLlN187Bfxgv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126815; c=relaxed/simple; bh=plDKQLiwBIj0x8r/FQG+sxFHvp8nFgmjt6T8+cGPkZI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AyXaPc7Lt/sTBuc/ptTtNbup5MAORHsWGchLYwKVpgHo0q7Fm4lXcZbcgVAHKB9cawUu8GAXKQ0EiYvp9j57nJgn9ABwtAs5RYunvbqXuhXj1uor1orxQ0KfIOsK7bmlRcDphPKRVbktUkgL2mg3jhJF+9ogqn/Z5tAF4+oLLHE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Yg7mSLXy; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Yg7mSLXy" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7C7583997; Sat, 2 Aug 2025 11:25:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126766; bh=plDKQLiwBIj0x8r/FQG+sxFHvp8nFgmjt6T8+cGPkZI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Yg7mSLXywEATs7NdZAo/15CRPyv1tSknSnoBACCZsbidd3zRcjyh5s7g5TNfPXgb9 gUhe1Tm6jpa01d4o5M2x6RA6R1VZl63+VBHlceA7hW5Fvnepymmk7TyYyDGBnQ6TTA Sw6wC1k5m0p9lWqybBEcYlPRZH86WPer4t5vumTM= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:42 +0200 Subject: [PATCH 20/65] media: camss: Remove custom .release fop() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-20-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1305; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=plDKQLiwBIj0x8r/FQG+sxFHvp8nFgmjt6T8+cGPkZI=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj5cxYW858SCw6LTG+aHwiW1liG/P/5haVZ9 0mzExpmUPCJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+QAKCRByNAaPFqFW PHhwEACP6/NBzk7i6VJN72Jn8/7oEe8k4hjRvq0+0ovO2wCFUpNc5OX+ZqalxcHnw8QWm9aZoBX cthgY0YADO91eZH63UwrNZViYnp2K+RtXE89BkRMKucikIDs/zTZr9+wHcPCGbbw7Ue+q1HuWh3 4gVRKZ7fbAXbp3R244W2ws9cxUElPjUZzgiPmQqHurk6/MxXXC2MU7AgVMc80OAUyGeAODZwwmJ wfVDsO5348pe+cK6lIPs8PbtbOyXTzrP+qAA1+0EraPxa5RW7DJTG2+OZRvqJ2bxfWQl6EGqx0Y 4WIL25OQyMoRYTiak2eEHRH5de8cfpPxTqzix6noCSKq8dHwYleqMhG0F/Uhsw8SGP33AzYmhNu LKYAEM03Uh3l7qmXVqBDHnZOvBcenlAd9RGHeFJmDdcXyzC84PVQVKHHbQbGZWpMa3XCHcwqB6r dyTqw36hcSnIGas5cBvTAfz1puBJYHqsdthf3soOfaYgYWsgZnt0Wl9cIYbkJiV7BfcZgpbhqF8 cf/WNrSpBF3AnjeYXdbvfwB2GbgLK2U2ocbsCWGGsrsv89ej4XYypUVse+T+uox6Dh+nUj+w375 sTcNMNGfzONapg7E8wydsqThpj3t8+rIufCWwqaBcMobAYyhE0VrXzs+5ThA40cwY/dLD0VM6A/ RxrM2yMXPUqLZUw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The 'file->private_data' pointer is reset in the vb2_fop_release() call path. For this reason a custom handler for the .release file operation is not needed and the driver can use vb2_fop_release() directly. Signed-off-by: Jacopo Mondi --- drivers/media/platform/qcom/camss/camss-video.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/medi= a/platform/qcom/camss/camss-video.c index c5d02f9ebc6aa9bfd6910944f3d40a2e5f0a908f..831486e14754ab3a24b077e21be= 14ea3169220a4 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -604,20 +604,11 @@ static const struct v4l2_ioctl_ops msm_vid_ioctl_ops = =3D { * V4L2 file operations */ =20 -static int video_release(struct file *file) -{ - vb2_fop_release(file); - - file->private_data =3D NULL; - - return 0; -} - static const struct v4l2_file_operations msm_vid_fops =3D { .owner =3D THIS_MODULE, .unlocked_ioctl =3D video_ioctl2, .open =3D v4l2_fh_open, - .release =3D video_release, + .release =3D vb2_fop_release, .poll =3D vb2_fop_poll, .mmap =3D vb2_fop_mmap, .read =3D vb2_fop_read, --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 6C9EF207DEE; Sat, 2 Aug 2025 09:27:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126823; cv=none; b=U+jODViItz5DqsJwxZ6e5jeXOzZ3BTy3Ta7lB3rrQbOx2GADJGLRbQGefWIf1Q2Llpq4nsw/mcnwoSicVURkbEmnQi0d5M+o/pFTi3A6x23jXq5XcY0sa+8vhvBhs6XmIJNAomsMir6lM6hYPZs5qNIF4YvBq+RZRYHlj5zKnWY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126823; c=relaxed/simple; bh=YeeZiet6PqHm7IlGh7t3GZOdydEI6jy4AdesJo+UFJ8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LVXT65AUeD4WkCNtL9klI2tEBHwtaGhYLv4eBEjC6CVzZFEXTeqUIvUWaRDtq1akz4IG26C0ENX0q1qRlgdqiX9Oq9rIjJxlJZNtOIS+tUp3nQgREn/5Q56Im59AMvELEUQwRowOk+/CMIqBxY5diHXb6L6ZD8tUJcpzqn/lCgY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=efEEkJTn; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="efEEkJTn" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4C35D330E; Sat, 2 Aug 2025 11:26:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126774; bh=YeeZiet6PqHm7IlGh7t3GZOdydEI6jy4AdesJo+UFJ8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=efEEkJTnS1kS5gUzaXOmI/yYslA+2pJMaHIkGKProANNbr8dxKaCBtqnVHS7MQhUm 5O2inCnrkmxZUR7Sb/afzgyTKrbaPNf/CC1zw3zEX7ePOorKxhty47n27+ZtwThhbW xJ9x9IaW2d+ETCWGrE3pPgiKenybAl/eZ+xNKYmQ= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:43 +0200 Subject: [PATCH 21/65] media: chips-media: wave5: Pass file pointer to wave5_cleanup_instance() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-21-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3292; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=sFLeSeZ18AiPz7TNtzZuErYTeuXEDyYERBW9KVUCez8=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj5Ab8WMNqTk1vrNJmzEF9fusCZ5AJs5tg8p ikoDaHa4TGJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+QAKCRByNAaPFqFW PIGXD/9X1mdSs4tmw4s1JTfYvMbuDI1kxi3A97kXvrt+El+sQRTisOHlSxLE9USoyAGm9PnoFPY icrGza2HD8EwUhtANb4EwK4SX8gRpvg5DXsHiY+BzBm4ZVvbrn4YKQ8EspQAqrqPqNpRCC3jLzn 0GRaHqxDXvUIkwHB48fJQ6GV3QDhI0wZH4KOeyPYnI+UAT/tN3QLKewQVSIxCvc+x44Uz1UIfYt kdVvO1fp4phNaCAUHr+TNYEglxeQRmyTjF7EFg8glg2DIQvarhZjR2idgNmJRc32RfKKlrWhLLG qsc3G5XT4rTHdpVwmtUQZodlMjwJIMrLeeq3gmQLcuVkPx7WrqJFWrykMYjVSJW9boC6wQNseOL g/jwwARgjsbT4VVBTM34U4UGM25/qXegXPcvFArnizqPHj2jNKsfNiwqCk9hQvsaZb0hejeg2C6 PIHxrsXkFRQdQNuT5CuoeTdUazuF9Y8PozrVwKktzkTD3iCYWR6uVAZwa5j/+W0fWDzMJe3etdR iL0DtcbzUnBRXuciDmUfTXXz4QqjEoF7LYYGV9gHpobdDmtnG6aN+YRDMpFr8/cXnc76JpLWK1O iZ4WMJ6IpVenQcUxz2evwcVueKdYxxj8eIkzeEvX3GLQmspDOksNr43SNDrl2k/d9vKpDQ7djH2 UWeorQDKZwyuLsQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart In preparation for a tree-wide rework automated with coccinelle that will need to access a struct file pointer in the wave5_cleanup_instance() function, pass it from the callers. There is not functional change yet. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/platform/chips-media/wave5/wave5-helper.c | 4 ++-- drivers/media/platform/chips-media/wave5/wave5-helper.h | 2 +- drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c | 2 +- drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/chips-media/wave5/wave5-helper.c b/driv= ers/media/platform/chips-media/wave5/wave5-helper.c index 031dea0ee61c6c5afddf7ff47d67d85826f16d8d..ed8ff04a899da0a3c9e0f037dac= 2c9548c98920f 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-helper.c +++ b/drivers/media/platform/chips-media/wave5/wave5-helper.c @@ -27,7 +27,7 @@ const char *state_to_str(enum vpu_instance_state state) } } =20 -void wave5_cleanup_instance(struct vpu_instance *inst) +void wave5_cleanup_instance(struct vpu_instance *inst, struct file *filp) { int i; =20 @@ -78,7 +78,7 @@ int wave5_vpu_release_device(struct file *filp, } } =20 - wave5_cleanup_instance(inst); + wave5_cleanup_instance(inst, filp); =20 return ret; } diff --git a/drivers/media/platform/chips-media/wave5/wave5-helper.h b/driv= ers/media/platform/chips-media/wave5/wave5-helper.h index 9937fce553fc33000bd31abcfc6d7345f6f7e485..976a402e426ff329490717925a0= 8a76d777cbe3e 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-helper.h +++ b/drivers/media/platform/chips-media/wave5/wave5-helper.h @@ -14,7 +14,7 @@ #define MAX_FMTS 12 =20 const char *state_to_str(enum vpu_instance_state state); -void wave5_cleanup_instance(struct vpu_instance *inst); +void wave5_cleanup_instance(struct vpu_instance *inst, struct file *filp); int wave5_vpu_release_device(struct file *filp, int (*close_func)(struct vpu_instance *inst, u32 *fail_res), char *name); diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c b/dri= vers/media/platform/chips-media/wave5/wave5-vpu-dec.c index fd71f0c43ac37a0bb56f669d4b89d6054cb181d5..f3188d720ed3e183f3400816a9c= 939014213711d 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c @@ -1840,7 +1840,7 @@ static int wave5_vpu_open_dec(struct file *filp) return 0; =20 cleanup_inst: - wave5_cleanup_instance(inst); + wave5_cleanup_instance(inst, filp); return ret; } =20 diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/dri= vers/media/platform/chips-media/wave5/wave5-vpu-enc.c index 1e5fc5f8b856c5329b2c6007649285a28749b6aa..b69a1206fa12c2ff5f3a32d269b= 8fd3b80a597aa 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c @@ -1784,7 +1784,7 @@ static int wave5_vpu_open_enc(struct file *filp) return 0; =20 cleanup_inst: - wave5_cleanup_instance(inst); + wave5_cleanup_instance(inst, filp); return ret; } =20 --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 BA09721D3F8; Sat, 2 Aug 2025 09:27:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126832; cv=none; b=d9/HnGfJNqeC1WtSG+tPs55liLqN+mhszjhl18lJNakm3EwOH5b9ZZbcryse4H3uCbAgT0kNkh88P7Rk1r/Uqso7f8X5dKe4mGygF0ql94d05yaIslLO+sGeJsw52EOcSoXX1MNHgyt4bm0qnywGaT3wwwFmonumQj8+02u7xM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126832; c=relaxed/simple; bh=PZLQVaI1vZKi0WIr3Q878QLqEaTr0uij9E9KhgQTBLY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rLcTpAQSSdQO/sNRfsKkISjIQeZwrhfwFmqzBfOvSiBdpLbxb3aFEwkOGwZCSWHMT3HruHWx3C4F/knXItPq/PTfPqcy9pQYEQn2+BduatjqX23jf33ZD+xzvlgzEj1Fe0U5Yr7iSVJsyqt3GDEIEwYarpBm7O3bbeXYdAWEo8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=glpozsiM; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="glpozsiM" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CEC0B3AC8; Sat, 2 Aug 2025 11:26:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126784; bh=PZLQVaI1vZKi0WIr3Q878QLqEaTr0uij9E9KhgQTBLY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=glpozsiMSkAdE8qk8DV+qPeB3taW375MoVrWdOB4cufVoZ/iT2/9a/sHUU6CS0d5I riolvMj1G/tGQ7S2/0rHQQjGwNysQGwANruXqaKpTG39MMXBMknM5lc8YSPrjUgIai 9jDndo/hQZm6gNe2reNXZU/1z+kKk7B/biiUSd+U= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:44 +0200 Subject: [PATCH 22/65] media: qcom: iris: Pass file pointer to iris_v4l2_fh_(de)init() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-22-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2406; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=T7tnvhAAkedHKQQVRtKCkxG+wcLOyWF1XErsaMtfBYY=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj59XaFL/Sd0BVhJH0Xfg7Vmb1RhxbHsvp6x 5ltEdCDgMOJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+QAKCRByNAaPFqFW PCwcEACdclKr4oR/Yg45NonSfNvh7MFckOXskhI7d8HCP6X6W2mxvMN2af258eUD0Po2k7UJAdg yhzWebC08rW11AJ0yJ3BPh7FKCi1eL6HmLvL6gUYdf/HFCIzVRaXRBIrvgCE9Z7XiMpZOvHml3U PH+YUa/VZZd/SLAZtNbWr1356EBCqBLxuvqCV9B0zyLAgNGvv1CoyeO3pbvl2oNL7OJyn7v2mof YqY9cFeaIDMIhiDfZ4xNa4r/eQ1DT43YITKFB8bZmFcojlHmuByILVOj+o9uOTJWeMFIl2UC5F/ YZxhB+yQInGuMlJVYQkGvBp06TE3kgE3NjJyhV52/FwlfnUdSo0d1/HxG4QxVaoAUp9BsuJKAwS eJ4eo9xwhHWzs06HcHx1Kt/YmtN/QJJd6Ukjby5WdtpRpmAARIgr5LwfiYuysqD9N3VRbKq+9fZ kLJ0e40lPrCJaeDc36gAl0dUgo8OeDcuHcWRiUL3uOHxA9+U0oRdQ15nEgmGY1MxnBeO/hLMLkI G3PtZs8kgWlBW8b/bMN28rvvgm9rR7VUuvAk/4f9p+dgDkhu4ZTPyheBI2V4JRgGlleR7vVeSTm UZvbPhAiM16/87VqLg31yijDZzm1Zn8du/yPyJN8U7+HyQIBTjVVhYTrY9eD0NO9TTEdkwfHdsx 5RIsN9qBKPBFCrw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart In preparation for a tree-wide rework automated with coccinelle that will need to access a struct file pointer in the iris_v4l2_fh_init() and iris_v4l2_fh_deinit() functions, pass it from the callers. There is not functional change yet. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/platform/qcom/iris/iris_vidc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_vidc.c b/drivers/media/p= latform/qcom/iris/iris_vidc.c index 0c3b47b9958aa3388d91ffda9b2acfbb53f09f59..d5f99519def45d1c5859e641eed= 490ec9ad5784a 100644 --- a/drivers/media/platform/qcom/iris/iris_vidc.c +++ b/drivers/media/platform/qcom/iris/iris_vidc.c @@ -21,14 +21,14 @@ #define STEP_WIDTH 1 #define STEP_HEIGHT 1 =20 -static void iris_v4l2_fh_init(struct iris_inst *inst) +static void iris_v4l2_fh_init(struct iris_inst *inst, struct file *filp) { v4l2_fh_init(&inst->fh, inst->core->vdev_dec); inst->fh.ctrl_handler =3D &inst->ctrl_handler; v4l2_fh_add(&inst->fh); } =20 -static void iris_v4l2_fh_deinit(struct iris_inst *inst) +static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp) { v4l2_fh_del(&inst->fh); inst->fh.ctrl_handler =3D NULL; @@ -164,7 +164,7 @@ int iris_open(struct file *filp) init_completion(&inst->completion); init_completion(&inst->flush_completion); =20 - iris_v4l2_fh_init(inst); + iris_v4l2_fh_init(inst, filp); =20 inst->m2m_dev =3D v4l2_m2m_init(&iris_m2m_ops); if (IS_ERR_OR_NULL(inst->m2m_dev)) { @@ -194,7 +194,7 @@ int iris_open(struct file *filp) fail_m2m_release: v4l2_m2m_release(inst->m2m_dev); fail_v4l2_fh_deinit: - iris_v4l2_fh_deinit(inst); + iris_v4l2_fh_deinit(inst, filp); mutex_destroy(&inst->ctx_q_lock); mutex_destroy(&inst->lock); kfree(inst); @@ -259,7 +259,7 @@ int iris_close(struct file *filp) iris_vdec_inst_deinit(inst); iris_session_close(inst); iris_inst_change_state(inst, IRIS_INST_DEINIT); - iris_v4l2_fh_deinit(inst); + iris_v4l2_fh_deinit(inst, filp); iris_destroy_all_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE= ); iris_destroy_all_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLAN= E); iris_check_num_queued_internal_buffers(inst, V4L2_BUF_TYPE_VIDEO_OUTPUT_M= PLANE); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 230F523875D; Sat, 2 Aug 2025 09:27:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126843; cv=none; b=ejBV+XglpqTfinKSAgXrHf5T/Fzgr9yThnPK2ag9AMFTp6+/n5QsbnK6h7U/fmrBn43dkNiNZYK+GWUiWgh9moBx8HbFToBR2HjVPmAbqXB0lUXUTEBFm7HiwkK8KHrt8aXE5YNAO+3LIXi+OHwYBu6pmoTZa68gXXCCie2N/nc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126843; c=relaxed/simple; bh=rizlCTL3Kt0Hf0axm/Qmz2Cg8LZmpWFMmM2fmmL3vuU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A5Rm/1bfVo2KoO+oaEHGXDlzvjiz+z4tC+AB0tzzwGDEEOn8NN85EMTGmfMaEvNNuIQ0JJt9h/+lzke+WlDtY/jBW8KZ1CAJ1xH/rBbfeA/SZ7XExTivF8gcE/KSg8ZqLEAgQ9dNZwS79pcGRnyEfa9PCB+wIeE9PUjIoO4mHKs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=h56Mr/7t; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="h56Mr/7t" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 60F9E3B4D; Sat, 2 Aug 2025 11:26:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126795; bh=rizlCTL3Kt0Hf0axm/Qmz2Cg8LZmpWFMmM2fmmL3vuU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=h56Mr/7tp64+ZUhXR58WHpxs6lTXlvIdWjSre1q0GxY0AMddJguHdhZYEOteHkdeS CBgbgSTk/vlVrlmR0hdREsQR6fwfP5gkZc9sUwWCIPIUHQcbqSPnfLz/3itJS7qh03 keO6FDaO/hOqJ+zbi8EnAsSQX573NZTL3KgY3IRE= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:45 +0200 Subject: [PATCH 23/65] media: qcom: iris: Set file->private_data in iris_v4l2_fh_(de)init() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-23-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1678; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=VFmrROMakbnqJAC4dcjyTjUYRV1GRcf+sO37WGrNLcg=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj6i6wiSBh9v/UN9HA32pPRH6ApLAr4OEu5V Jmtrtm6bUSJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+gAKCRByNAaPFqFW PP3WD/9aG4apNvm9piPJBuxrdRZiK04I5I+fGvAE8sc6cPA2ebtyKA/1vW4z17ikyaAXLSfj+XZ e+QhTIIgGHBQxP95xByIpTkMEJQzV26c3v2FCazou0nFI2a5rlgyDMb80UGI7eDeH2TZV+NuKYm 3gvu+Z2pvEFpnfPIgPjKHJYuSYR0tTuEkXnOwKuBPASdT9lbdclnSvqENlUB3RYFENXKdDsJV3r vEmDioX9y5CbnHaNXZ3bazhmprLRP50X+HnqzPZYPJQ0pwS9NkhoEeIX/gg4My1a81hy0s2rj3p QQKtoBkF8ugKa2Cl8vElby1slbn8GWdWhUX6XKj0PF/EbHFoMX0WpL6MNz7627PHesJBFkCSj3V pKa928ZrOZlEnqLoCwpNeK0g8trbUg57fCg8+AptrrtOT7Vl4tcbRuseBA2fnm+LNxFhi4jSKFS Oy+eHwc3b+O6RWSWp42qu0WvbZ3R5UlgAGG/TxRbys5spBYfEhWS2ea+e7g5QP0X3EC/96IGpwA 1Aid4Grvx67Ighft5mH6q/oEC3SJWJY/8hy3nfbluwXHzFDxeL6qPSFQ0CkAgijSO3+/MsYF/Om 3lW783CSzxb/dv4pC/MFVIZzz0HUrusA0EoYhNrW3ctLJ2apvab3fv5V4uJ32uDrR6/F/QNkmDA xEw42OCIaIk6GOg== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart In preparation for a tree-wide rework automated with coccinelle that will affect file->private_data, v4l2_fh_add() and v4l2_fh_del(), move setting file->private_data from the callers to the iris_v4l2_fh_init() and iris_v4l2_fh_deinit() functions. There is not functional change yet. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/platform/qcom/iris/iris_vidc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_vidc.c b/drivers/media/p= latform/qcom/iris/iris_vidc.c index d5f99519def45d1c5859e641eed490ec9ad5784a..73c96498759cbde8e1d98703360= 23e7773f6f28b 100644 --- a/drivers/media/platform/qcom/iris/iris_vidc.c +++ b/drivers/media/platform/qcom/iris/iris_vidc.c @@ -26,10 +26,12 @@ static void iris_v4l2_fh_init(struct iris_inst *inst, s= truct file *filp) v4l2_fh_init(&inst->fh, inst->core->vdev_dec); inst->fh.ctrl_handler =3D &inst->ctrl_handler; v4l2_fh_add(&inst->fh); + filp->private_data =3D &inst->fh; } =20 static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp) { + filp->private_data =3D NULL; v4l2_fh_del(&inst->fh); inst->fh.ctrl_handler =3D NULL; v4l2_fh_exit(&inst->fh); @@ -185,7 +187,6 @@ int iris_open(struct file *filp) iris_add_session(inst); =20 inst->fh.m2m_ctx =3D inst->m2m_ctx; - filp->private_data =3D &inst->fh; =20 return 0; =20 @@ -269,7 +270,6 @@ int iris_close(struct file *filp) mutex_destroy(&inst->ctx_q_lock); mutex_destroy(&inst->lock); kfree(inst); - filp->private_data =3D NULL; =20 return 0; } --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 36C652397A4; Sat, 2 Aug 2025 09:27:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126856; cv=none; b=jOfKCIiCa5C19yMYSUSGPMfd5pilcm03c2cXNawcevgWNkx3Weya8dyqNuFYjGdXOuViUCWquvThK2ZEEM/dPlmIqQITxA5KcpSxc2XX/LFV8j5rlPw4saU19vGdBjL+MdimVb2oYRKBXp9lkOwyscx2A1gqQtqjy6p/OMytwUI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126856; c=relaxed/simple; bh=8wi3ERfqhNF0n7Qty7pg2iRliLtnhljmMkGSJfQ6Hsg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kohLVjpN3kl/U6ES5POhm0aEiR6O9deS5e1T7mfC9I5hSdW46Sx4R1kyg7baIffF1ZGeaz1EojtLB3w4xKi+Vofh/6XxbwC3a6JEzJFu8SqqZkNuAel9iTsC8ugmVGaLVduPAU9/BRjWX7dTyVZ1phT2PeIsyPi81I7KEvJ8RFw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=DkuGu4xR; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DkuGu4xR" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B8B6E3BA3; Sat, 2 Aug 2025 11:26:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126807; bh=8wi3ERfqhNF0n7Qty7pg2iRliLtnhljmMkGSJfQ6Hsg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=DkuGu4xRR6LJyt/BrWYiHj5iOqv5dhewfJ3hwKWatqKNWw5aye9NwZagv3kmssPOE CrfWdtKhJm9DcJj5g5CzQoYrcgh3RGvIuF70mp5W3SdrzZoyvluCyQ+wrLAQhg/E1L kIcY0MpBFSbqgFuWM94vhNjwhFsmlkdbx86x8gLE= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:46 +0200 Subject: [PATCH 24/65] media: qcom: iris: Drop unused argument to iris_get_inst() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-24-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3646; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=9GluRJsNYGFG25N0tAt2DCmvfQ/RCr9Ew1fkTJNt5v4=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj6pttk4jyKbwjBxeL0idYh0vr/bLr00peVD JUZKh9W0+eJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+gAKCRByNAaPFqFW PGDoEAC13XyW/5FISnksj3XUPDtzKAE0wQOpV6Bci/1SfoKU0HQM/iCHDx/sMO0qeSd99+64lGr gJRtPOLtn6N8BKObyNPsfUp+mWuBnx5vmSe1Pbde63K6+drX2xvFoiAzbIXnfK/fP2jlpBnAICK iZ7dRTBReQ8v0opu20jNW6evMyN4a342ga3+7vMBOf1np9sErNiaYIRsx2+Mq0B1KKNt4GwPE9b /YHZKp48kNiJwFv7WAuSZ8wYIXV3GYqG1YO06xSSauUp59H7rcKz5wKKjIZ5cHdAXPgZ1wM6Akr NQxbA8bQhpJaT0rDQsMXokHC3odLdwITPD51wRddL6FhZUMxNbvaKJFhf3wkgf6WZYxqM+i+7rf X7+lGVUksiq9uD+OSHUXhpHdk/H1zA/StHIrmyB7hKWi0ZEePGrRi/aSWxmlmrq1BGxSZ5l2S/s PN0iJUN26Xym+8+JpsmsyKda1QyFgIcOSURmg2inMwMEv/ZOM+pQf3GLCsWUCJ1HY9NP0U1GOq2 Sp2PJ7STeJ8BbL0TKF0XPsE5gpeUaSL7Lf++MdERh/p3bzNfElGYTtAOI/KyrGFjriYijVcxmG4 cVjjRgPCaqBajc6c6NNGpl61zEF0t1FzWrpJ3QcYADnGeyIHJ3WMiAyfCjoJfptKbkkoVeX3w2Y 56CTWDdhVyiViXw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart The second argument to the iris_get_inst() function is never used. Drop it. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/platform/qcom/iris/iris_vidc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_vidc.c b/drivers/media/p= latform/qcom/iris/iris_vidc.c index 73c96498759cbde8e1d9870336023e7773f6f28b..64ebec2ca6b3d58118ac1a6f4dd= eed2e43de6d5b 100644 --- a/drivers/media/platform/qcom/iris/iris_vidc.c +++ b/drivers/media/platform/qcom/iris/iris_vidc.c @@ -69,7 +69,7 @@ static void iris_remove_session(struct iris_inst *inst) mutex_unlock(&core->lock); } =20 -static inline struct iris_inst *iris_get_inst(struct file *filp, void *fh) +static inline struct iris_inst *iris_get_inst(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct iris_inst, fh); } @@ -251,7 +251,7 @@ static void iris_check_num_queued_internal_buffers(stru= ct iris_inst *inst, u32 p =20 int iris_close(struct file *filp) { - struct iris_inst *inst =3D iris_get_inst(filp, NULL); + struct iris_inst *inst =3D iris_get_inst(filp); =20 v4l2_ctrl_handler_free(&inst->ctrl_handler); v4l2_m2m_ctx_release(inst->m2m_ctx); @@ -276,14 +276,14 @@ int iris_close(struct file *filp) =20 static int iris_enum_fmt(struct file *filp, void *fh, struct v4l2_fmtdesc = *f) { - struct iris_inst *inst =3D iris_get_inst(filp, NULL); + struct iris_inst *inst =3D iris_get_inst(filp); =20 return iris_vdec_enum_fmt(inst, f); } =20 static int iris_try_fmt_vid_mplane(struct file *filp, void *fh, struct v4l= 2_format *f) { - struct iris_inst *inst =3D iris_get_inst(filp, NULL); + struct iris_inst *inst =3D iris_get_inst(filp); int ret; =20 mutex_lock(&inst->lock); @@ -295,7 +295,7 @@ static int iris_try_fmt_vid_mplane(struct file *filp, v= oid *fh, struct v4l2_form =20 static int iris_s_fmt_vid_mplane(struct file *filp, void *fh, struct v4l2_= format *f) { - struct iris_inst *inst =3D iris_get_inst(filp, NULL); + struct iris_inst *inst =3D iris_get_inst(filp); int ret; =20 mutex_lock(&inst->lock); @@ -307,7 +307,7 @@ static int iris_s_fmt_vid_mplane(struct file *filp, voi= d *fh, struct v4l2_format =20 static int iris_g_fmt_vid_mplane(struct file *filp, void *fh, struct v4l2_= format *f) { - struct iris_inst *inst =3D iris_get_inst(filp, NULL); + struct iris_inst *inst =3D iris_get_inst(filp); int ret =3D 0; =20 mutex_lock(&inst->lock); @@ -326,7 +326,7 @@ static int iris_g_fmt_vid_mplane(struct file *filp, voi= d *fh, struct v4l2_format static int iris_enum_framesizes(struct file *filp, void *fh, struct v4l2_frmsizeenum *fsize) { - struct iris_inst *inst =3D iris_get_inst(filp, NULL); + struct iris_inst *inst =3D iris_get_inst(filp); struct platform_inst_caps *caps; =20 if (fsize->index) @@ -359,7 +359,7 @@ static int iris_querycap(struct file *filp, void *fh, s= truct v4l2_capability *ca =20 static int iris_g_selection(struct file *filp, void *fh, struct v4l2_selec= tion *s) { - struct iris_inst *inst =3D iris_get_inst(filp, NULL); + struct iris_inst *inst =3D iris_get_inst(filp); =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; @@ -394,7 +394,7 @@ static int iris_subscribe_event(struct v4l2_fh *fh, con= st struct v4l2_event_subs static int iris_dec_cmd(struct file *filp, void *fh, struct v4l2_decoder_cmd *dec) { - struct iris_inst *inst =3D iris_get_inst(filp, NULL); + struct iris_inst *inst =3D iris_get_inst(filp); int ret =3D 0; =20 mutex_lock(&inst->lock); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 A1D0823AE9B; Sat, 2 Aug 2025 09:27:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126865; cv=none; b=patxSZS57uBjjFsUMlieLIlhfBRDpKZfmX3rAk2SJdfXR6UVZm+5UYEFKZYj4DhZJUwy0evtHEtlnZnuhnijm/8MvRIvomVm7fjh/RT1iecCQkzFkttJN5AzsKs+b3Xn4M4NMu767VC+5L9e5PeRd6mZqsnUSVHkdnk00E4XhPE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126865; c=relaxed/simple; bh=HdqTV2TqVG3xTLfbGl4o6SpK144p9tcquExNTCVb3xM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Tv2+/xS1IEDq0+JEtmgS4q1C4ee1ywWbGUD8XgzC7w1CUu5mSkOPjr4roFzwnyJ01XnAriNpzksM0R+vSOYJOUEUH8/wei7NJorylWE3Dukaus9EP1iKfb5edcq1gtQ3oPFqH1kz/kerAaXY2AuLMq+JGO5FPGW/iZEN5e8UOcY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=OO9QOTbl; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="OO9QOTbl" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6DEE23BEE; Sat, 2 Aug 2025 11:26:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126816; bh=HdqTV2TqVG3xTLfbGl4o6SpK144p9tcquExNTCVb3xM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OO9QOTblMAkgskUy9NhCVy0rjAHmPgQWM6bWuLzw+9LAaGvQ5G5uak5fPUmzhc7a9 U8l+E3KmF0b6LaMQA8JyLVCe4CA+V7nChInx7pw0vuXg6l2VpK1VeL7TesBhH5vZxX FEBSpY2WzWZICRwjwoWsJEx0izyRDjWL/w+Imr7I= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:47 +0200 Subject: [PATCH 25/65] media: qcom: venus: Pass file pointer to venus_close_common() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-25-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2903; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=SNuZtVIHrmVcr3R5kH7o/uJRVzpsSbXGwYD4D6selm0=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj6LaQa+SLFMOTKITynXBcDjBhVc17MupIYb m/EanNcskSJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+gAKCRByNAaPFqFW PH3ZEADDppWwmExeUaZboalbNKoFooUHo9mTZl3latfywSJFDQ4vKntNlu00f4TKpCHVCwPNYRP Jiz1VpEQNWWP/8tTszTLomUHNLhN80IfvRgEP/vN++8yjDDsugo8zjCpAf9YfS6my9rktj/SXkd qQTWkXPNrQXBQVN5uOHhAvuyRdtIt+VHOW5aogelbOMqKQv3g7vR+TRA/ftwXJ6YPMMlhBV/b+7 B+LqJb41YcYDNKUAsPofBRsxRQ434U5RvYcDdnRO0eXk0a1x+y58SDSGOKEwcynOP1MXixu/5Od TlCb/lGu+kk5xgEr2dH9Csu7JVE6L2sFPTBJBg65824ZKnnnhHGYTrfqxG2s1xg3r9r3eaAlGJI 5rwR+wk5vSzWgP1u70D39Gjt2nCCscrRr6RHYBYU43RCQEoVhAhCRQiMykSwofmOSfbjgXg91Z0 z/Ala4dhgnUg2k9Vz9of64qtWHMqcIPrCNFaQGcVg4mfO36qDhOxvHoF+RV9rAj/QMEVdBi5Qno Y8wJH5mSgLpxBiUBOogCbEM/+YAiAgkMc4LfbF5d8r7FarwwlxlJaHNgC7pyVWnDqmqZrpZORkC tIs5GgZnv4eFPwhfrgfk3Lvhwvy+YwAZxY+6OXPSN3YQPQ3uWOVn8GNec0s92fRPLT8JFpESPji GgD9+aeYwi+/80Q== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart In preparation for a tree-wide rework automated with coccinelle that will need to access a struct file pointer in the venus_close_common() function, pass it from the callers. There is not functional change yet. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/platform/qcom/venus/core.c | 2 +- drivers/media/platform/qcom/venus/core.h | 2 +- drivers/media/platform/qcom/venus/vdec.c | 2 +- drivers/media/platform/qcom/venus/venc.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platf= orm/qcom/venus/core.c index 4c049c694d9c43845c4c0eb51e260808dc9136ac..5e1ace16a4903999c7fd7a98531= 7dae8dd2410ba 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -596,7 +596,7 @@ static __maybe_unused int venus_runtime_suspend(struct = device *dev) return ret; } =20 -void venus_close_common(struct venus_inst *inst) +void venus_close_common(struct venus_inst *inst, struct file *filp) { /* * Make sure we don't have IRQ/IRQ-thread currently running diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platf= orm/qcom/venus/core.h index 3c0c5f9dbe7bd54975e44ae87ee3df442305c0fe..db7b69b91db5649bbd9cad0866f= 0853f796897ac 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -573,5 +573,5 @@ is_fw_rev_or_older(struct venus_core *core, u32 vmajor,= u32 vminor, u32 vrev) (core)->venus_ver.rev <=3D vrev); } =20 -void venus_close_common(struct venus_inst *inst); +void venus_close_common(struct venus_inst *inst, struct file *filp); #endif diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platf= orm/qcom/venus/vdec.c index 29b0d6a5303d7ae08ac25a10e402ba65120eb666..d10ca6d89f6d76c052b27b1154c= 8dd9c49466e23 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -1755,7 +1755,7 @@ static int vdec_close(struct file *file) =20 vdec_pm_get(inst); cancel_work_sync(&inst->delayed_process_work); - venus_close_common(inst); + venus_close_common(inst, file); ida_destroy(&inst->dpb_ids); vdec_pm_put(inst, false); =20 diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platf= orm/qcom/venus/venc.c index c0a0ccdded8015bf3c99ab2dff404a64afca8dff..0838d64ce8fee5dd8299d5c394e= 97910f10f7ee3 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1537,7 +1537,7 @@ static int venc_close(struct file *file) struct venus_inst *inst =3D to_inst(file); =20 venc_pm_get(inst); - venus_close_common(inst); + venus_close_common(inst, file); inst->enc_state =3D VENUS_ENC_STATE_DEINIT; venc_pm_put(inst, false); =20 --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 EA3AE23BCEF; Sat, 2 Aug 2025 09:27:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126877; cv=none; b=toYUd4kB/0rcXKRJrGJB9r9Jp41qNGdqZ3zEdu8uFJy52WnPbgxHdI9tEetCU9nEtZ9xYTHdHTLujgKyRaGGgKJPthOIq4Dk0aui7xBs8Iku2iAgxL8wFCLhV4Vuh7WoEHNbHmQYVnDM8v4Od3qTSDv6b8RgpM15Th9ZuF2s05U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126877; c=relaxed/simple; bh=Yobm/1MGg7bPFLQtQWEvVqLgOCfJr7HoqcnOsRBfzUY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uOsH5k4wY3OciaXDWPDifMJuRw/emMwRJ55et1wJ7T+9zBMCRHZ/079L69Bkw8ghNP0Z1WNX758cq3TlQA9e0+D/VFxoKj8LTeFsYqm0o0k9PtS5S0hpDFlosBBIV4Uo0IMXMsL+tmYgfGhZ2X0eiezx30eCXD2rLD2xmIE+djM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=tb0X9eBI; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tb0X9eBI" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F3FB23B05; Sat, 2 Aug 2025 11:26:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126827; bh=Yobm/1MGg7bPFLQtQWEvVqLgOCfJr7HoqcnOsRBfzUY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tb0X9eBIOaImES639/omP3+bgTrW7SC2+A3C4hbXWza6N9MZX4V1hAY9CmkS/1Y0Y grEbDaabanOy+dRjK8cWvnSqPGGq52yv4RPUTWCubgtks/3ccnM9HJxoLrgX5EylfZ 2QJtUQkALJrbXmmQtnj//lbFfnb0ZVJcW6mp53aE= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:48 +0200 Subject: [PATCH 26/65] media: Set file->private_data in v4l2_fh_add() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-26-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=49506; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=AjjOw1FEkl+flV1iD9X3J3U+zDgZ+uBJPuJ8D/AKRho=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj60moBa2sYWifVD3BYJyFsFLUsO8YipbF7Q mObETTgb6aJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+gAKCRByNAaPFqFW PNh0EACisCJhsBqYBnUT08VIyZS01ltJOUhjGNP1Q5VtcSV4zCPWF17wgA1TxN2Vpu3+4qrnMhs WK9B0bE7SSSeEXux7YTqyULe2Z1FjPXhx+m2031K6HROtTGpLj4AHf1yJvUwlsif7SheIKi0Rqu hOcoUkNRGSyrgcUVMMC62m4E9nq4ficNkp6ku/bcuFjscF/EWcoCSNAGOy1PHYIjdMnddT/VviX 634F7yAfxHPz7YhZKQfDyncRkrZ5j0tml3nFz9CF0LPNqwSvmf+hIjkekcUr9Y8T8g+xhiv4v/2 6JhLMLMZa3D12gj4RtcoJcpfBTl7d/y8FILCw5lvmuasUdqUVPyZa7gF6fAkFDpINullW5pYZoh boqLyuoXsQ+1W39xA7Q1STAAzf2tsSCx29o8pfJggjgmB9sVZPKJ2uhAW4Kv7eBLFmDHU7oFXEy K5vDz1CPD7fxV+ivNLgUKCqF1wEVvvTMGdPmmrVyuy4Frh+g00TiqlZV4U78PnzQpvGUNn6vTYL MYzyvP/OqBvyIMuhnAeeq8dFm6gSMVTVNSwvQ5MvM2nNuEjA3hdNmo5IoRceRNeHWYuDtGgjKU3 KibUlxWu7pO7j1Exjb5PgLWw4zhhlux+8YKKdiB+rfYmeBGbhfqjHrFbfYx0LN+2p3ttuwQ1ZUB REQPI37HstKsoug== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart All the drivers that use v4l2_fh and call v4l2_fh_add() manually store a pointer to the v4l2_fh instance in file->private_data in their video device .open() file operation handler. Move the code to the v4l2_fh_add() function to avoid direct access to file->private_data in drivers. This requires adding a file pointer argument to the function. Changes to drivers have been generated with the following coccinelle semantic patch: @@ expression fh; identifier filp; identifier open; type ret; @@ ret open(..., struct file *filp, ...) { <... - filp->private_data =3D fh; ... - v4l2_fh_add(fh); + v4l2_fh_add(fh, filp); ...> } @@ expression fh; identifier filp; identifier open; type ret; @@ ret open(..., struct file *filp, ...) { <... - v4l2_fh_add(fh); + v4l2_fh_add(fh, filp); ... - filp->private_data =3D fh; ...> } Manual changes have been applied to Documentation/ to update the usage patterns, to drivers/media/v4l2-core/v4l2-fh.c to update the v4l2_fh_add() prototype set file->private_data, and to include/media/v4l2-fh.h to update the v4l2_fh_add() function prototype and its documentation. Additionally, white space issues have been fixed manually in drivers/media/platform/nvidia/tegra-vde/v4l2.c, drivers/media/platform/rockchip/rkvdec/rkvdec.c, drivers/media/v4l2-core/v4l2-fh.c and drivers/staging/most/video/video.c. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- Documentation/driver-api/media/v4l2-fh.rst | 46 +++++++++++-------= ---- .../zh_CN/video4linux/v4l2-framework.txt | 5 +-- drivers/media/pci/cx18/cx18-fileops.c | 3 +- drivers/media/pci/ivtv/ivtv-fileops.c | 4 +- drivers/media/pci/saa7164/saa7164-encoder.c | 3 +- drivers/media/pci/saa7164/saa7164-vbi.c | 3 +- drivers/media/platform/allegro-dvt/allegro-core.c | 3 +- drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 3 +- drivers/media/platform/amphion/vpu_v4l2.c | 3 +- .../media/platform/chips-media/coda/coda-common.c | 3 +- .../platform/chips-media/wave5/wave5-vpu-dec.c | 3 +- .../platform/chips-media/wave5/wave5-vpu-enc.c | 3 +- .../media/platform/imagination/e5010-jpeg-enc.c | 3 +- drivers/media/platform/m2m-deinterlace.c | 3 +- .../media/platform/mediatek/jpeg/mtk_jpeg_core.c | 3 +- drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c | 3 +- .../media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 3 +- .../mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 3 +- .../mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c | 3 +- drivers/media/platform/nvidia/tegra-vde/v4l2.c | 3 +- drivers/media/platform/nxp/dw100/dw100.c | 3 +- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 3 +- drivers/media/platform/nxp/imx-pxp.c | 3 +- drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 3 +- drivers/media/platform/nxp/mx2_emmaprp.c | 3 +- drivers/media/platform/qcom/iris/iris_vidc.c | 3 +- drivers/media/platform/qcom/venus/vdec.c | 3 +- drivers/media/platform/qcom/venus/venc.c | 3 +- drivers/media/platform/renesas/rcar_fdp1.c | 3 +- drivers/media/platform/renesas/rcar_jpu.c | 3 +- drivers/media/platform/renesas/vsp1/vsp1_video.c | 4 +- drivers/media/platform/rockchip/rga/rga.c | 3 +- drivers/media/platform/rockchip/rkvdec/rkvdec.c | 3 +- .../media/platform/samsung/exynos-gsc/gsc-m2m.c | 3 +- .../media/platform/samsung/exynos4-is/fimc-m2m.c | 3 +- drivers/media/platform/samsung/s5p-g2d/g2d.c | 3 +- .../media/platform/samsung/s5p-jpeg/jpeg-core.c | 3 +- drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 3 +- drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c | 3 +- drivers/media/platform/st/sti/delta/delta-v4l2.c | 3 +- drivers/media/platform/st/sti/hva/hva-v4l2.c | 3 +- drivers/media/platform/st/stm32/dma2d/dma2d.c | 3 +- drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 3 +- .../platform/sunxi/sun8i-rotate/sun8i_rotate.c | 3 +- drivers/media/platform/ti/omap3isp/ispvideo.c | 3 +- drivers/media/platform/ti/vpe/vpe.c | 3 +- drivers/media/platform/verisilicon/hantro_drv.c | 3 +- drivers/media/test-drivers/vicodec/vicodec-core.c | 3 +- drivers/media/test-drivers/vim2m.c | 3 +- drivers/media/test-drivers/visl/visl-core.c | 3 +- drivers/media/usb/hdpvr/hdpvr-video.c | 3 +- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 3 +- drivers/media/usb/uvc/uvc_v4l2.c | 3 +- drivers/media/v4l2-core/v4l2-fh.c | 7 ++-- drivers/media/v4l2-core/v4l2-subdev.c | 3 +- drivers/staging/media/imx/imx-media-csc-scaler.c | 3 +- drivers/staging/media/meson/vdec/vdec.c | 3 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 3 +- drivers/staging/most/video/video.c | 4 +- drivers/usb/gadget/function/uvc_v4l2.c | 3 +- include/media/v4l2-fh.h | 5 ++- 61 files changed, 91 insertions(+), 146 deletions(-) diff --git a/Documentation/driver-api/media/v4l2-fh.rst b/Documentation/dri= ver-api/media/v4l2-fh.rst index 2c87b74578d97a171ad06d3eb60a02cd58b557b1..a7393067f5db2183aa677e15ece= 512296455e23b 100644 --- a/Documentation/driver-api/media/v4l2-fh.rst +++ b/Documentation/driver-api/media/v4l2-fh.rst @@ -11,25 +11,22 @@ data that is used by the V4L2 framework. since it is also used to implement priority handling (:ref:`VIDIOC_G_PRIORITY`). =20 -The users of :c:type:`v4l2_fh` (in the V4L2 framework, not the driver) know -whether a driver uses :c:type:`v4l2_fh` as its ``file->private_data`` poin= ter -by testing the ``V4L2_FL_USES_V4L2_FH`` bit in :c:type:`video_device`->fla= gs. -This bit is set whenever :c:func:`v4l2_fh_init` is called. - -struct v4l2_fh is allocated as a part of the driver's own file handle -structure and ``file->private_data`` is set to it in the driver's ``open()= `` -function by the driver. The :c:type:`v4l2_fh` file handle can be retrieved -from the :c:type:`file` using :c:func:`file_to_v4l2_fh`. Drivers must not -access ``file->private_data`` directly. - -In many cases the struct v4l2_fh will be embedded in a larger -structure. In that case you should call: - -#) :c:func:`v4l2_fh_init` and :c:func:`v4l2_fh_add` in ``open()`` -#) :c:func:`v4l2_fh_del` and :c:func:`v4l2_fh_exit` in ``release()`` - -Drivers can extract their own file handle structure by using the container= _of -macro. +struct v4l2_fh is allocated in the driver's ``open()`` file operation hand= ler. +It is typically embedded in a larger driver-specific structure. The +:c:type:`v4l2_fh` must be initialized with a call to :c:func:`v4l2_fh_init= `, +and added to the video device with :c:func:`v4l2_fh_add`. This associates = the +:c:type:`v4l2_fh` with the :c:type:`file` by setting ``file->private_data`= ` to +point to the :c:type:`v4l2_fh`. + +Similarly, the struct v4l2_fh is freed in the driver's ``release()`` file +operation handler. It must be removed from the video device with +:c:func:`v4l2_fh_del` and cleaned up with :c:func:`v4l2_fh_exit` before be= ing +freed. + +Drivers must not access ``file->private_data`` directly. They can retrieve= the +:c:type:`v4l2_fh` associated with a :c:type:`file` by calling +:c:func:`file_to_v4l2_fh`. Drivers can extract their own file handle struc= ture +by using the container_of macro. =20 Example: =20 @@ -58,8 +55,7 @@ Example: =20 ... =20 - file->private_data =3D &my_fh->fh; - v4l2_fh_add(&my_fh->fh); + v4l2_fh_add(&my_fh->fh, file); return 0; } =20 @@ -84,7 +80,7 @@ Below is a short description of the :c:type:`v4l2_fh` fun= ctions used: :c:type:`v4l2_file_operations`->open() handler. =20 :c:func:`v4l2_fh_add ` -(:c:type:`fh `) +(:c:type:`fh `, struct file \*filp) =20 - Add a :c:type:`v4l2_fh` to :c:type:`video_device` file handle list. Must be called once the file handle is completely initialized. @@ -138,6 +134,12 @@ associated device node: =20 - Same, but it calls v4l2_fh_is_singular with filp->private_data. =20 +.. note:: + The V4L2 framework knows whether a driver uses :c:type:`v4l2_fh` a= s its + ``file->private_data`` pointer by testing the ``V4L2_FL_USES_V4L2_= FH`` + bit in :c:type:`video_device`->flags. This bit is set whenever + :c:func:`v4l2_fh_init` is called. + =20 V4L2 fh functions and data structures ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Documentation/translations/zh_CN/video4linux/v4l2-framework.tx= t b/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt index a9eb62fa1531c69110ff17945fa2fcfa596f4df8..2d38ae17d9404d9d40c63bc8329= f3cc6999b7a11 100644 --- a/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt +++ b/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt @@ -812,8 +812,7 @@ int my_open(struct file *file) =20 ... =20 - file->private_data =3D &my_fh->fh; - v4l2_fh_add(&my_fh->fh); + v4l2_fh_add(&my_fh->fh, file); return 0; } =20 @@ -836,7 +835,7 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_devi= ce *vdev) =E5=88=9D=E5=A7=8B=E5=8C=96=E6=96=87=E4=BB=B6=E5=8F=A5=E6=9F=84=E3=80=82= =E8=BF=99*=E5=BF=85=E9=A1=BB*=E5=9C=A8=E9=A9=B1=E5=8A=A8=E7=9A=84 v4l2_file= _operations->open() =E5=87=BD=E6=95=B0=E4=B8=AD=E6=89=A7=E8=A1=8C=E3=80=82 =20 -void v4l2_fh_add(struct v4l2_fh *fh) +void v4l2_fh_add(struct v4l2_fh *fh, struct file *filp) =20 =E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA v4l2_fh =E5=88=B0 video_device =E6= =96=87=E4=BB=B6=E5=8F=A5=E6=9F=84=E5=88=97=E8=A1=A8=E3=80=82=E4=B8=80=E6=97= =A6=E6=96=87=E4=BB=B6=E5=8F=A5=E6=9F=84 =E5=88=9D=E5=A7=8B=E5=8C=96=E5=AE=8C=E6=88=90=E5=B0=B1=E5=BF=85=E9=A1=BB= =E8=B0=83=E7=94=A8=E3=80=82 diff --git a/drivers/media/pci/cx18/cx18-fileops.c b/drivers/media/pci/cx18= /cx18-fileops.c index 89e38b3036309af0747362bafad5024413c2c5bd..f90b547f5d676308ed5c7956a8d= a02e208b9446e 100644 --- a/drivers/media/pci/cx18/cx18-fileops.c +++ b/drivers/media/pci/cx18/cx18-fileops.c @@ -743,8 +743,7 @@ static int cx18_serialized_open(struct cx18_stream *s, = struct file *filp) item->type =3D s->type; =20 item->open_id =3D cx->open_id++; - filp->private_data =3D &item->fh; - v4l2_fh_add(&item->fh); + v4l2_fh_add(&item->fh, filp); =20 if (item->type =3D=3D CX18_ENC_STREAM_TYPE_RAD && v4l2_fh_is_singular_file(filp)) { diff --git a/drivers/media/pci/ivtv/ivtv-fileops.c b/drivers/media/pci/ivtv= /ivtv-fileops.c index 67964a3c382c6627a7b3ce6380a2da97dcc47c3d..aa5f5f16427c48123cd314932a7= d8bc48f07c031 100644 --- a/drivers/media/pci/ivtv/ivtv-fileops.c +++ b/drivers/media/pci/ivtv/ivtv-fileops.c @@ -998,9 +998,7 @@ static int ivtv_open(struct file *filp) v4l2_fh_init(&item->fh, &s->vdev); item->itv =3D itv; item->type =3D s->type; - - filp->private_data =3D &item->fh; - v4l2_fh_add(&item->fh); + v4l2_fh_add(&item->fh, filp); =20 if (item->type =3D=3D IVTV_ENC_STREAM_TYPE_RAD && v4l2_fh_is_singular_file(filp)) { diff --git a/drivers/media/pci/saa7164/saa7164-encoder.c b/drivers/media/pc= i/saa7164/saa7164-encoder.c index 296f50b6b8d38e0ab617f0990d8f697ba96b0016..e6e353a251cf548525c44e87695= f7d45bde302a6 100644 --- a/drivers/media/pci/saa7164/saa7164-encoder.c +++ b/drivers/media/pci/saa7164/saa7164-encoder.c @@ -725,8 +725,7 @@ static int fops_open(struct file *file) =20 fh->port =3D port; v4l2_fh_init(&fh->fh, video_devdata(file)); - v4l2_fh_add(&fh->fh); - file->private_data =3D &fh->fh; + v4l2_fh_add(&fh->fh, file); =20 return 0; } diff --git a/drivers/media/pci/saa7164/saa7164-vbi.c b/drivers/media/pci/sa= a7164/saa7164-vbi.c index a7e398f304725c7fa5aa4cf1edf0deb0df059641..181442fcb43b08cd96f29c2357b= cfadd3ddcedb4 100644 --- a/drivers/media/pci/saa7164/saa7164-vbi.c +++ b/drivers/media/pci/saa7164/saa7164-vbi.c @@ -428,8 +428,7 @@ static int fops_open(struct file *file) =20 fh->port =3D port; v4l2_fh_init(&fh->fh, video_devdata(file)); - v4l2_fh_add(&fh->fh); - file->private_data =3D &fh->fh; + v4l2_fh_add(&fh->fh, file); =20 return 0; } diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/me= dia/platform/allegro-dvt/allegro-core.c index 74977f3ae4844022c04de877f31b4fc6aaac0749..8c30f3cd4fc545133f697973b0f= 002ea888a3a4a 100644 --- a/drivers/media/platform/allegro-dvt/allegro-core.c +++ b/drivers/media/platform/allegro-dvt/allegro-core.c @@ -3219,8 +3219,7 @@ static int allegro_open(struct file *file) } =20 list_add(&channel->list, &dev->channels); - file->private_data =3D &channel->fh; - v4l2_fh_add(&channel->fh); + v4l2_fh_add(&channel->fh, file); =20 allegro_channel_adjust(channel); =20 diff --git a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c b/drivers/med= ia/platform/amlogic/meson-ge2d/ge2d.c index c7df29a2d82012b7fc290edf3f629a0c3ed7bcc8..d36891b546bca417e8b98c5e045= 8ebb15e24c213 100644 --- a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c +++ b/drivers/media/platform/amlogic/meson-ge2d/ge2d.c @@ -860,8 +860,7 @@ static int ge2d_open(struct file *file) return ret; } v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 ge2d_setup_ctrls(ctx); =20 diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/plat= form/amphion/vpu_v4l2.c index 57ca6262bb04b356a85e217ef51cfb13cb9a0a36..e13bfe09af1bf0926bf6005b83a= 8aae7e34a2122 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -760,7 +760,7 @@ int vpu_v4l2_open(struct file *file, struct vpu_inst *i= nst) inst->min_buffer_cap =3D 2; inst->min_buffer_out =3D 2; v4l2_fh_init(&inst->fh, func->vfd); - v4l2_fh_add(&inst->fh); + v4l2_fh_add(&inst->fh, file); =20 ret =3D call_vop(inst, ctrl_init); if (ret) @@ -774,7 +774,6 @@ int vpu_v4l2_open(struct file *file, struct vpu_inst *i= nst) } =20 inst->fh.ctrl_handler =3D &inst->ctrl_handler; - file->private_data =3D &inst->fh; inst->state =3D VPU_CODEC_STATE_DEINIT; inst->workqueue =3D alloc_ordered_workqueue("vpu_inst", WQ_MEM_RECLAIM); if (inst->workqueue) { diff --git a/drivers/media/platform/chips-media/coda/coda-common.c b/driver= s/media/platform/chips-media/coda/coda-common.c index 92fb24cace8ef75e70eb2aae96bc169a7cf97563..9d8a1c9bea6e9f4d9fc2c2ae165= d587e3b3b9650 100644 --- a/drivers/media/platform/chips-media/coda/coda-common.c +++ b/drivers/media/platform/chips-media/coda/coda-common.c @@ -2642,8 +2642,7 @@ static int coda_open(struct file *file) if (ctx->ops->seq_end_work) INIT_WORK(&ctx->seq_end_work, ctx->ops->seq_end_work); v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); ctx->dev =3D dev; ctx->idx =3D idx; =20 diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c b/dri= vers/media/platform/chips-media/wave5/wave5-vpu-dec.c index f3188d720ed3e183f3400816a9c939014213711d..88eb933a51448788373775e423a= e2ac5042cf8b6 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c @@ -1761,8 +1761,7 @@ static int wave5_vpu_open_dec(struct file *filp) return -ENOMEM; =20 v4l2_fh_init(&inst->v4l2_fh, vdev); - filp->private_data =3D &inst->v4l2_fh; - v4l2_fh_add(&inst->v4l2_fh); + v4l2_fh_add(&inst->v4l2_fh, filp); =20 INIT_LIST_HEAD(&inst->list); =20 diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/dri= vers/media/platform/chips-media/wave5/wave5-vpu-enc.c index b69a1206fa12c2ff5f3a32d269b8fd3b80a597aa..322c1498758a0a569eb94cab0d6= 612ce18cd4c7b 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c @@ -1587,8 +1587,7 @@ static int wave5_vpu_open_enc(struct file *filp) return -ENOMEM; =20 v4l2_fh_init(&inst->v4l2_fh, vdev); - filp->private_data =3D &inst->v4l2_fh; - v4l2_fh_add(&inst->v4l2_fh); + v4l2_fh_add(&inst->v4l2_fh, filp); =20 INIT_LIST_HEAD(&inst->list); =20 diff --git a/drivers/media/platform/imagination/e5010-jpeg-enc.c b/drivers/= media/platform/imagination/e5010-jpeg-enc.c index 295461325862fb2bcac755cf815955955b37e6f0..1da00ff4b1e36a6486ce54e0213= 9f6489d6acf22 100644 --- a/drivers/media/platform/imagination/e5010-jpeg-enc.c +++ b/drivers/media/platform/imagination/e5010-jpeg-enc.c @@ -742,8 +742,7 @@ static int e5010_open(struct file *file) } =20 v4l2_fh_init(&ctx->fh, vdev); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 ctx->e5010 =3D e5010; ctx->fh.m2m_ctx =3D v4l2_m2m_ctx_init(e5010->m2m_dev, ctx, queue_init); diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platf= orm/m2m-deinterlace.c index 1812c07837ad33e10db9005fd2009b4ea2a799d0..a343dffd19f03c68557415afae2= a8db4b3614d2e 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c @@ -847,7 +847,6 @@ static int deinterlace_open(struct file *file) return -ENOMEM; =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; ctx->dev =3D pcdev; =20 ctx->fh.m2m_ctx =3D v4l2_m2m_ctx_init(pcdev->m2m_dev, ctx, &queue_init); @@ -866,7 +865,7 @@ static int deinterlace_open(struct file *file) } =20 ctx->colorspace =3D V4L2_COLORSPACE_REC709; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 dprintk(pcdev, "Created instance %p, m2m_ctx: %p\n", ctx, ctx->fh.m2m_ctx); diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers= /media/platform/mediatek/jpeg/mtk_jpeg_core.c index bf7cae1993d5e21975bc9dffcbcfb3fe1843d575..4bf52e9d960431194c05870743c= c628e4e4293e2 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1176,8 +1176,7 @@ static int mtk_jpeg_open(struct file *file) INIT_LIST_HEAD(&ctx->dst_done_queue); spin_lock_init(&ctx->done_queue_lock); v4l2_fh_init(&ctx->fh, vfd); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 ctx->jpeg =3D jpeg; ctx->fh.m2m_ctx =3D v4l2_m2m_ctx_init(jpeg->m2m_dev, ctx, diff --git a/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c b/drivers/me= dia/platform/mediatek/mdp/mtk_mdp_m2m.c index e3e01a9a0f78cb2fe665132bd1bde66afa63bddb..25efd76f290e4f29a60d326e92a= 5bcb05c2bbd1e 100644 --- a/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c +++ b/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c @@ -1070,14 +1070,13 @@ static int mtk_mdp_m2m_open(struct file *file) mutex_init(&ctx->slock); ctx->id =3D mdp->id_counter++; v4l2_fh_init(&ctx->fh, vfd); - file->private_data =3D &ctx->fh; ret =3D mtk_mdp_ctrls_create(ctx); if (ret) goto error_ctrls; =20 /* Use separate control handler per file handle */ ctx->fh.ctrl_handler =3D &ctx->ctrl_handler; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); INIT_LIST_HEAD(&ctx->list); =20 ctx->mdp_dev =3D mdp; diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c b/drivers/= media/platform/mediatek/mdp3/mtk-mdp3-m2m.c index 8ebab14c535bfe023d720964965d97f758e5eb63..18e542ad32e4fd0d0d262670b64= 40fb2e3661f7f 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c @@ -590,14 +590,13 @@ static int mdp_m2m_open(struct file *file) ctx->mdp_dev =3D mdp; =20 v4l2_fh_init(&ctx->fh, vdev); - file->private_data =3D &ctx->fh; ret =3D mdp_m2m_ctrls_create(ctx); if (ret) goto err_exit_fh; =20 /* Use separate control handler per file handle */ ctx->fh.ctrl_handler =3D &ctx->ctrl_handler; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 mutex_init(&ctx->ctx_lock); ctx->m2m_ctx =3D v4l2_m2m_ctx_init(mdp->m2m_dev, ctx, mdp_m2m_queue_init); diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_= drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c index 18801883c31a80b2179eb0d9280150eeb4aa3770..952a77c383bdb8dba94c7491667= 4e729ee5aba35 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c @@ -206,8 +206,7 @@ static int fops_vcodec_open(struct file *file) mutex_lock(&dev->dev_mutex); ctx->id =3D dev->id_counter++; v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); INIT_LIST_HEAD(&ctx->list); ctx->dev =3D dev; if (ctx->dev->vdec_pdata->is_subdev_supported) { diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_= drv.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c index e26a6c3ffa0cee17385575215b55b575b14e58f4..9cacb6cbcf28357826db2df7e15= c3588e7b4d4c8 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c @@ -129,8 +129,7 @@ static int fops_vcodec_open(struct file *file) */ ctx->id =3D dev->id_counter++; v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); INIT_LIST_HEAD(&ctx->list); ctx->dev =3D dev; init_waitqueue_head(&ctx->queue[0]); diff --git a/drivers/media/platform/nvidia/tegra-vde/v4l2.c b/drivers/media= /platform/nvidia/tegra-vde/v4l2.c index 393dc3f07d5c78ff5ab0ae7b6368914859564458..688b776b30107df4ec3642a4bc0= e896759ccf0fe 100644 --- a/drivers/media/platform/nvidia/tegra-vde/v4l2.c +++ b/drivers/media/platform/nvidia/tegra-vde/v4l2.c @@ -832,8 +832,7 @@ static int tegra_open(struct file *file) goto free_ctrls; } =20 - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 tegra_reset_coded_fmt(ctx); tegra_try_coded_fmt(file, &ctx->fh, &ctx->coded_fmt); diff --git a/drivers/media/platform/nxp/dw100/dw100.c b/drivers/media/platf= orm/nxp/dw100/dw100.c index 2460f09a6813a320f7637bc332e641b7741ced21..2bd30910ddf98401dfc9d8f2e3b= 19fe8672320e3 100644 --- a/drivers/media/platform/nxp/dw100/dw100.c +++ b/drivers/media/platform/nxp/dw100/dw100.c @@ -607,7 +607,6 @@ static int dw100_open(struct file *file) =20 mutex_init(&ctx->vq_mutex); v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; ctx->dw_dev =3D dw_dev; =20 ctx->q_data[DW100_QUEUE_SRC].fmt =3D &formats[0]; @@ -651,7 +650,7 @@ static int dw100_open(struct file *file) goto err; } =20 - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 return 0; =20 diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index a17a020ea4c698bfa57253f0f53a17230d52dea3..13e681a0ec0abcb49b14455773d= a3ab2f5dc372b 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -2205,8 +2205,7 @@ static int mxc_jpeg_open(struct file *file) } =20 v4l2_fh_init(&ctx->fh, mxc_vfd); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 ctx->mxc_jpeg =3D mxc_jpeg; =20 diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/= nxp/imx-pxp.c index 879b1803a2b38c6748fa4748f25504665f8106bb..9602409f3ecef7e2a77a58f9c33= 76823a72ec551 100644 --- a/drivers/media/platform/nxp/imx-pxp.c +++ b/drivers/media/platform/nxp/imx-pxp.c @@ -1660,7 +1660,6 @@ static int pxp_open(struct file *file) } =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; ctx->dev =3D dev; hdl =3D &ctx->hdl; v4l2_ctrl_handler_init(hdl, 4); @@ -1699,7 +1698,7 @@ static int pxp_open(struct file *file) goto open_unlock; } =20 - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); atomic_inc(&dev->num_inst); =20 dprintk(dev, "Created instance: %p, m2m_ctx: %p\n", diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c b/drivers/m= edia/platform/nxp/imx8-isi/imx8-isi-m2m.c index 9226e42b95fc91ed5490be1599a539f0fdeeb123..480669a2578ab2f4d6d5104658b= a56ea776a6639 100644 --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c @@ -673,7 +673,6 @@ static int mxc_isi_m2m_open(struct file *file) mutex_init(&ctx->vb2_lock); =20 v4l2_fh_init(&ctx->fh, vdev); - file->private_data =3D &ctx->fh; =20 ctx->fh.m2m_ctx =3D v4l2_m2m_ctx_init(m2m->m2m_dev, ctx, &mxc_isi_m2m_queue_init); @@ -694,7 +693,7 @@ static int mxc_isi_m2m_open(struct file *file) if (ret) goto err_ctrls; =20 - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 return 0; =20 diff --git a/drivers/media/platform/nxp/mx2_emmaprp.c b/drivers/media/platf= orm/nxp/mx2_emmaprp.c index 5c8c6285ec1e7b2e8df64132228e71e1b097183e..8c8f834e6250f5effcbb7f098f3= 88a9ccc96302c 100644 --- a/drivers/media/platform/nxp/mx2_emmaprp.c +++ b/drivers/media/platform/nxp/mx2_emmaprp.c @@ -730,7 +730,6 @@ static int emmaprp_open(struct file *file) return -ENOMEM; =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; ctx->dev =3D pcdev; =20 if (mutex_lock_interruptible(&pcdev->dev_mutex)) { @@ -752,7 +751,7 @@ static int emmaprp_open(struct file *file) clk_prepare_enable(pcdev->clk_emma_ahb); ctx->q_data[V4L2_M2M_SRC].fmt =3D &formats[1]; ctx->q_data[V4L2_M2M_DST].fmt =3D &formats[0]; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); mutex_unlock(&pcdev->dev_mutex); =20 dprintk(pcdev, "Created instance %p, m2m_ctx: %p\n", ctx, ctx->fh.m2m_ctx= ); diff --git a/drivers/media/platform/qcom/iris/iris_vidc.c b/drivers/media/p= latform/qcom/iris/iris_vidc.c index 64ebec2ca6b3d58118ac1a6f4ddeed2e43de6d5b..cdd34a3b71ff4309829f0f15924= 1c3815658bcb8 100644 --- a/drivers/media/platform/qcom/iris/iris_vidc.c +++ b/drivers/media/platform/qcom/iris/iris_vidc.c @@ -25,8 +25,7 @@ static void iris_v4l2_fh_init(struct iris_inst *inst, str= uct file *filp) { v4l2_fh_init(&inst->fh, inst->core->vdev_dec); inst->fh.ctrl_handler =3D &inst->ctrl_handler; - v4l2_fh_add(&inst->fh); - filp->private_data =3D &inst->fh; + v4l2_fh_add(&inst->fh, filp); } =20 static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platf= orm/qcom/venus/vdec.c index d10ca6d89f6d76c052b27b1154c8dd9c49466e23..55c27345b7d89bf400e216ed9aa= 59a871e501a44 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -1732,9 +1732,8 @@ static int vdec_open(struct file *file) v4l2_fh_init(&inst->fh, core->vdev_dec); =20 inst->fh.ctrl_handler =3D &inst->ctrl_handler; - v4l2_fh_add(&inst->fh); + v4l2_fh_add(&inst->fh, file); inst->fh.m2m_ctx =3D inst->m2m_ctx; - file->private_data =3D &inst->fh; =20 return 0; =20 diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platf= orm/qcom/venus/venc.c index 0838d64ce8fee5dd8299d5c394e97910f10f7ee3..fba07557a3996a55fcd6a4f6537= 6c418ec0c92a7 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1515,9 +1515,8 @@ static int venc_open(struct file *file) v4l2_fh_init(&inst->fh, core->vdev_enc); =20 inst->fh.ctrl_handler =3D &inst->ctrl_handler; - v4l2_fh_add(&inst->fh); + v4l2_fh_add(&inst->fh, file); inst->fh.m2m_ctx =3D inst->m2m_ctx; - file->private_data =3D &inst->fh; =20 return 0; =20 diff --git a/drivers/media/platform/renesas/rcar_fdp1.c b/drivers/media/pla= tform/renesas/rcar_fdp1.c index f11ea9dc5027bdd89262270f4e3979a06650d9bc..e0d12b579d87025e3f309f6593c= 068ad87f1856b 100644 --- a/drivers/media/platform/renesas/rcar_fdp1.c +++ b/drivers/media/platform/renesas/rcar_fdp1.c @@ -2093,7 +2093,6 @@ static int fdp1_open(struct file *file) } =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; ctx->fdp1 =3D fdp1; =20 /* Initialise Queues */ @@ -2142,7 +2141,7 @@ static int fdp1_open(struct file *file) if (ret < 0) goto error_pm; =20 - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 dprintk(fdp1, "Created instance: %p, m2m_ctx: %p\n", ctx, ctx->fh.m2m_ctx); diff --git a/drivers/media/platform/renesas/rcar_jpu.c b/drivers/media/plat= form/renesas/rcar_jpu.c index 3ee51f53b0cd1c221cefd0ce93acbcda55faa4a6..26c5c77e4a17b26c453e3ea80b0= f7c752e2f8029 100644 --- a/drivers/media/platform/renesas/rcar_jpu.c +++ b/drivers/media/platform/renesas/rcar_jpu.c @@ -1231,8 +1231,7 @@ static int jpu_open(struct file *file) =20 v4l2_fh_init(&ctx->fh, vfd); ctx->fh.ctrl_handler =3D &ctx->ctrl_handler; - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 ctx->jpu =3D jpu; ctx->encoder =3D vfd =3D=3D &jpu->vfd_encoder; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_video.c b/drivers/med= ia/platform/renesas/vsp1/vsp1_video.c index 656fb5e6cb303cfcde1d91c839a9aceca79c77f7..b6dc1ee3dc50ac8d0eb79408b06= c601cb501e9b8 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_video.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_video.c @@ -1079,9 +1079,7 @@ static int vsp1_video_open(struct file *file) return -ENOMEM; =20 v4l2_fh_init(vfh, &video->video); - v4l2_fh_add(vfh); - - file->private_data =3D vfh; + v4l2_fh_add(vfh, file); =20 ret =3D vsp1_device_get(video->vsp1); if (ret < 0) { diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/plat= form/rockchip/rga/rga.c index 8a6e618d605c216b5113062d90df03dc632dc7c8..d88817023996b29afc79cdd6fbd= d42dfc5829b13 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -395,8 +395,7 @@ static int rga_open(struct file *file) return ret; } v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 rga_setup_ctrls(ctx); =20 diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/medi= a/platform/rockchip/rkvdec/rkvdec.c index 41ab90cbcc0cdbe279f6512decc4301b6cff2dfa..2fbad685e92cee4916420565a28= c778b1a5e1a8e 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c @@ -938,8 +938,7 @@ static int rkvdec_open(struct file *filp) if (ret) goto err_cleanup_m2m_ctx; =20 - filp->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, filp); =20 return 0; =20 diff --git a/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c b/drivers/= media/platform/samsung/exynos-gsc/gsc-m2m.c index 968bb4327b7a1697641815dfb08dc64251f5e927..39d84ffd1b05990ba4b8af281ab= a09e3f9cc5340 100644 --- a/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c @@ -625,8 +625,7 @@ static int gsc_m2m_open(struct file *file) =20 /* Use separate control handler per file handle */ ctx->fh.ctrl_handler =3D &ctx->ctrl_handler; - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 ctx->gsc_dev =3D gsc; /* Default color format */ diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c b/drivers= /media/platform/samsung/exynos4-is/fimc-m2m.c index feedf60dad09bd413cb8fe65d965fd39b26b8764..b002b02a899efdd95df4ae8a5db= 59b9f144a61db 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c @@ -634,8 +634,7 @@ static int fimc_m2m_open(struct file *file) =20 /* Use separate control handler per file handle */ ctx->fh.ctrl_handler =3D &ctx->ctrls.handler; - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 /* Setup the device context for memory-to-memory mode */ ctx->state =3D FIMC_CTX_M2M; diff --git a/drivers/media/platform/samsung/s5p-g2d/g2d.c b/drivers/media/p= latform/samsung/s5p-g2d/g2d.c index 44fcedbbc90a9863827aacbcd5f56d850cb552ea..e34cae9c9cf65d3161822b68233= d28472171f917 100644 --- a/drivers/media/platform/samsung/s5p-g2d/g2d.c +++ b/drivers/media/platform/samsung/s5p-g2d/g2d.c @@ -257,8 +257,7 @@ static int g2d_open(struct file *file) return ret; } v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 g2d_setup_ctrls(ctx); =20 diff --git a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c b/drivers/= media/platform/samsung/s5p-jpeg/jpeg-core.c index a8d0dddb1fb5b5344ac9c96657fcf17a575d6a26..c4ad0196ed8f1bf579365a0a21d= d8c4a78bdaa10 100644 --- a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c @@ -970,8 +970,7 @@ static int s5p_jpeg_open(struct file *file) v4l2_fh_init(&ctx->fh, vfd); /* Use separate control handler per file handle */ ctx->fh.ctrl_handler =3D &ctx->ctrl_handler; - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 ctx->jpeg =3D jpeg; if (vfd =3D=3D jpeg->vfd_encoder) { diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c b/drivers/med= ia/platform/samsung/s5p-mfc/s5p_mfc.c index dd9761df59df5dd7b07b4e9afd2d7939c46cb2de..74629db05121ac9181af9daa471= c113876f9d323 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c @@ -801,8 +801,7 @@ static int s5p_mfc_open(struct file *file) } init_waitqueue_head(&ctx->queue); v4l2_fh_init(&ctx->fh, vdev); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); ctx->dev =3D dev; INIT_LIST_HEAD(&ctx->src_queue); INIT_LIST_HEAD(&ctx->dst_queue); diff --git a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c b/drivers/med= ia/platform/st/sti/bdisp/bdisp-v4l2.c index 26c4e48e5e84bcf315692515448ae615727c454f..57dcc625096b4b684cfde0051d2= 00bf8c18e4ba4 100644 --- a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c @@ -608,8 +608,7 @@ static int bdisp_open(struct file *file) =20 /* Use separate control handler per file handle */ ctx->fh.ctrl_handler =3D &ctx->ctrl_handler; - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 /* Default format */ ctx->src =3D bdisp_dflt_fmt; diff --git a/drivers/media/platform/st/sti/delta/delta-v4l2.c b/drivers/med= ia/platform/st/sti/delta/delta-v4l2.c index 8282e72af67084ddbb94ed78df87a07e1e8b860f..b2df94dcbe21709f5b31446c854= 08728e70d5bca 100644 --- a/drivers/media/platform/st/sti/delta/delta-v4l2.c +++ b/drivers/media/platform/st/sti/delta/delta-v4l2.c @@ -1639,8 +1639,7 @@ static int delta_open(struct file *file) ctx->dev =3D delta; =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 INIT_WORK(&ctx->run_work, delta_run_work); mutex_init(&ctx->lock); diff --git a/drivers/media/platform/st/sti/hva/hva-v4l2.c b/drivers/media/p= latform/st/sti/hva/hva-v4l2.c index 29142c806cb74a510b2f27e79c9e10ca4088b1e9..2f9413fa7318f42b390f96447dc= b1a905836703e 100644 --- a/drivers/media/platform/st/sti/hva/hva-v4l2.c +++ b/drivers/media/platform/st/sti/hva/hva-v4l2.c @@ -1174,8 +1174,7 @@ static int hva_open(struct file *file) =20 INIT_WORK(&ctx->run_work, hva_run_work); v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 ret =3D hva_ctrls_setup(ctx); if (ret) { diff --git a/drivers/media/platform/st/stm32/dma2d/dma2d.c b/drivers/media/= platform/st/stm32/dma2d/dma2d.c index f4c5d73447a7c3efb0ad5d9bb8a09432c1a8fa60..b2bced06a1e603f7479620d5db3= c12ee89e5149e 100644 --- a/drivers/media/platform/st/stm32/dma2d/dma2d.c +++ b/drivers/media/platform/st/stm32/dma2d/dma2d.c @@ -304,8 +304,7 @@ static int dma2d_open(struct file *file) } =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 dma2d_setup_ctrls(ctx); =20 diff --git a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c b/drivers/med= ia/platform/sunxi/sun8i-di/sun8i-di.c index e9c7c99fbc559de85c33736a8f459cd216b8cdbf..7823eb97faf7e9bd13286ab14db= 2b436fc5caf1f 100644 --- a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +++ b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c @@ -730,7 +730,6 @@ static int deinterlace_open(struct file *file) deinterlace_prepare_format(&ctx->dst_fmt); =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; ctx->dev =3D dev; =20 ctx->fh.m2m_ctx =3D v4l2_m2m_ctx_init(dev->m2m_dev, ctx, @@ -740,7 +739,7 @@ static int deinterlace_open(struct file *file) goto err_free; } =20 - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 mutex_unlock(&dev->dev_mutex); =20 diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/dri= vers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index 9ea65cb7187fee323051b1cb62b342e119f7bb3d..368a858b8c0fdea462b85c8c71e= 22058d10a6c05 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -659,7 +659,6 @@ static int rotate_open(struct file *file) rotate_set_cap_format(ctx, &ctx->dst_fmt, ctx->rotate); =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; ctx->dev =3D dev; =20 ctx->fh.m2m_ctx =3D v4l2_m2m_ctx_init(dev->m2m_dev, ctx, @@ -669,7 +668,7 @@ static int rotate_open(struct file *file) goto err_free; } =20 - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 ret =3D rotate_setup_ctrls(ctx); if (ret) diff --git a/drivers/media/platform/ti/omap3isp/ispvideo.c b/drivers/media/= platform/ti/omap3isp/ispvideo.c index b76d40aeca17cf5b8b7619cadf0afe66ff283a9d..d10a2b96c13cf1f5103504a8bd1= 0c65111392a1e 100644 --- a/drivers/media/platform/ti/omap3isp/ispvideo.c +++ b/drivers/media/platform/ti/omap3isp/ispvideo.c @@ -1297,7 +1297,7 @@ static int isp_video_open(struct file *file) return -ENOMEM; =20 v4l2_fh_init(&handle->vfh, &video->video); - v4l2_fh_add(&handle->vfh); + v4l2_fh_add(&handle->vfh, file); =20 /* If this is the first user, initialise the pipeline. */ if (omap3isp_get(video->isp) =3D=3D NULL) { @@ -1333,7 +1333,6 @@ static int isp_video_open(struct file *file) handle->timeperframe.denominator =3D 1; =20 handle->video =3D video; - file->private_data =3D &handle->vfh; =20 done: if (ret < 0) { diff --git a/drivers/media/platform/ti/vpe/vpe.c b/drivers/media/platform/t= i/vpe/vpe.c index 4b9b2bec7377d724c272ff76fb8116b65227c542..a47c5d31c47550cd9c6c8803b25= cda1253f906a9 100644 --- a/drivers/media/platform/ti/vpe/vpe.c +++ b/drivers/media/platform/ti/vpe/vpe.c @@ -2310,7 +2310,6 @@ static int vpe_open(struct file *file) init_adb_hdrs(ctx); =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; =20 hdl =3D &ctx->hdl; v4l2_ctrl_handler_init(hdl, 1); @@ -2364,7 +2363,7 @@ static int vpe_open(struct file *file) goto exit_fh; } =20 - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 /* * for now, just report the creation of the first instance, we can later diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/medi= a/platform/verisilicon/hantro_drv.c index b20b9c7f41319e1d9586d641200aeeebbd1ee761..aadc3d8fb3d1c1267b370edac67= 23b99bd00f9bf 100644 --- a/drivers/media/platform/verisilicon/hantro_drv.c +++ b/drivers/media/platform/verisilicon/hantro_drv.c @@ -663,8 +663,7 @@ static int hantro_open(struct file *filp) } =20 v4l2_fh_init(&ctx->fh, vdev); - filp->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, filp); =20 hantro_reset_fmts(ctx); =20 diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/me= dia/test-drivers/vicodec/vicodec-core.c index e27f6761cba18e78e1833745e77347f7405957e0..f20d9d9643f5e3d39f4807ad337= f05c957594e1e 100644 --- a/drivers/media/test-drivers/vicodec/vicodec-core.c +++ b/drivers/media/test-drivers/vicodec/vicodec-core.c @@ -1848,7 +1848,6 @@ static int vicodec_open(struct file *file) ctx->is_stateless =3D true; =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; ctx->dev =3D dev; hdl =3D &ctx->hdl; v4l2_ctrl_handler_init(hdl, 5); @@ -1932,7 +1931,7 @@ static int vicodec_open(struct file *file) goto open_unlock; } =20 - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 open_unlock: mutex_unlock(vfd->lock); diff --git a/drivers/media/test-drivers/vim2m.c b/drivers/media/test-driver= s/vim2m.c index 55d885be5bcc0541e4ea539a2fafeeb2d76680e3..24574025f58fc34a0b98e804829= 4624607e39e2a 100644 --- a/drivers/media/test-drivers/vim2m.c +++ b/drivers/media/test-drivers/vim2m.c @@ -1389,7 +1389,6 @@ static int vim2m_open(struct file *file) } =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; ctx->dev =3D dev; hdl =3D &ctx->hdl; v4l2_ctrl_handler_init(hdl, 4); @@ -1433,7 +1432,7 @@ static int vim2m_open(struct file *file) goto open_unlock; } =20 - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); atomic_inc(&dev->num_inst); =20 dprintk(dev, 1, "Created instance: %p, m2m_ctx: %p\n", diff --git a/drivers/media/test-drivers/visl/visl-core.c b/drivers/media/te= st-drivers/visl/visl-core.c index 5bf3136b36eb30be5cf6b7f65ca3ab7314d84f98..0f43ec23f40b40362979646b47b= 09b75b7786fb2 100644 --- a/drivers/media/test-drivers/visl/visl-core.c +++ b/drivers/media/test-drivers/visl/visl-core.c @@ -341,7 +341,6 @@ static int visl_open(struct file *file) ctx->tpg_str_buf =3D kzalloc(TPG_STR_BUF_SZ, GFP_KERNEL); =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; ctx->dev =3D dev; =20 rc =3D visl_init_ctrls(ctx); @@ -361,7 +360,7 @@ static int visl_open(struct file *file) if (rc) goto free_m2m_ctx; =20 - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 dprintk(dev, "Created instance: %p, m2m_ctx: %p\n", ctx, ctx->fh.m2m_ctx); diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpv= r/hdpvr-video.c index ea17f1a5f5b0a01d7ae159b7f00d65ce952f4974..6c6e467f85549e86598e73d2935= 2a84de7df2f4d 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -380,8 +380,7 @@ static int hdpvr_open(struct file *file) return -ENOMEM; fh->legacy_mode =3D true; v4l2_fh_init(&fh->fh, video_devdata(file)); - v4l2_fh_add(&fh->fh); - file->private_data =3D &fh->fh; + v4l2_fh_add(&fh->fh, file); return 0; } =20 diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/p= vrusb2/pvrusb2-v4l2.c index 481b03bbecf8134f75b3988e45fc392f07ae90fd..04c77af0c51ec21741933872530= 15383d6fac486 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -1003,10 +1003,9 @@ static int pvr2_v4l2_open(struct file *file) } =20 fhp->file =3D file; - file->private_data =3D &fhp->fh; =20 fhp->fw_mode_flag =3D pvr2_hdw_cpufw_get_enabled(hdw); - v4l2_fh_add(&fhp->fh); + v4l2_fh_add(&fhp->fh, file); =20 return 0; } diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v= 4l2.c index 6dd329a972fda5c2574231b8526105676df3d4a1..09677ed639ae9252a57ce09cdbc= fd567ad7aabc2 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -600,10 +600,9 @@ static int uvc_v4l2_open(struct file *file) return -ENOMEM; =20 v4l2_fh_init(&handle->vfh, &stream->vdev); - v4l2_fh_add(&handle->vfh); + v4l2_fh_add(&handle->vfh, file); handle->chain =3D stream->chain; handle->stream =3D stream; - file->private_data =3D &handle->vfh; =20 return 0; } diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4= l2-fh.c index 7a5f7aa5e25341df62bb4e3380bf19f46e2df955..b59b1084d8cdf1b62da12879e21= dbe56c2109648 100644 --- a/drivers/media/v4l2-core/v4l2-fh.c +++ b/drivers/media/v4l2-core/v4l2-fh.c @@ -41,10 +41,12 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_devi= ce *vdev) } EXPORT_SYMBOL_GPL(v4l2_fh_init); =20 -void v4l2_fh_add(struct v4l2_fh *fh) +void v4l2_fh_add(struct v4l2_fh *fh, struct file *filp) { unsigned long flags; =20 + filp->private_data =3D fh; + v4l2_prio_open(fh->vdev->prio, &fh->prio); spin_lock_irqsave(&fh->vdev->fh_lock, flags); list_add(&fh->list, &fh->vdev->fh_list); @@ -57,11 +59,10 @@ int v4l2_fh_open(struct file *filp) struct video_device *vdev =3D video_devdata(filp); struct v4l2_fh *fh =3D kzalloc(sizeof(*fh), GFP_KERNEL); =20 - filp->private_data =3D fh; if (fh =3D=3D NULL) return -ENOMEM; v4l2_fh_init(fh, vdev); - v4l2_fh_add(fh); + v4l2_fh_add(fh, filp); return 0; } EXPORT_SYMBOL_GPL(v4l2_fh_open); diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-cor= e/v4l2-subdev.c index 29d3b788b288675c9ec849bb14e1936356d95743..bf35ac436249fdbf218ed08a712= abf546a49b4eb 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -86,8 +86,7 @@ static int subdev_open(struct file *file) } =20 v4l2_fh_init(&subdev_fh->vfh, vdev); - v4l2_fh_add(&subdev_fh->vfh); - file->private_data =3D &subdev_fh->vfh; + v4l2_fh_add(&subdev_fh->vfh, file); =20 if (sd->v4l2_dev->mdev && sd->entity.graph_obj.mdev->dev) { struct module *owner; diff --git a/drivers/staging/media/imx/imx-media-csc-scaler.c b/drivers/sta= ging/media/imx/imx-media-csc-scaler.c index 05a54242356c53d19770086dfcc2ed81e1cda4c1..9dc0954ed9aac7088e42bea03c6= aada4ee8f2ae8 100644 --- a/drivers/staging/media/imx/imx-media-csc-scaler.c +++ b/drivers/staging/media/imx/imx-media-csc-scaler.c @@ -765,8 +765,7 @@ static int ipu_csc_scaler_open(struct file *file) ctx->rot_mode =3D IPU_ROTATE_NONE; =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); ctx->priv =3D priv; =20 ctx->fh.m2m_ctx =3D v4l2_m2m_ctx_init(priv->m2m_dev, ctx, diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/medi= a/meson/vdec/vdec.c index f1ee53f9f29868ae7cb02ce00764631f821ee74b..b92666ff50a15196de0143f2ba5= bf476c6f7729d 100644 --- a/drivers/staging/media/meson/vdec/vdec.c +++ b/drivers/staging/media/meson/vdec/vdec.c @@ -908,9 +908,8 @@ static int vdec_open(struct file *file) =20 v4l2_fh_init(&sess->fh, core->vdev_dec); sess->fh.ctrl_handler =3D &sess->ctrl_handler; - v4l2_fh_add(&sess->fh); + v4l2_fh_add(&sess->fh, file); sess->fh.m2m_ctx =3D sess->m2m_ctx; - file->private_data =3D &sess->fh; =20 return 0; =20 diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/= media/sunxi/cedrus/cedrus.c index 80b43187f6eef827c7212a601aa2056dbc606bd4..ebefd646dbdb4e998bf6a8a0f0b= e6d7e4bf7d28b 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -366,7 +366,6 @@ static int cedrus_open(struct file *file) } =20 v4l2_fh_init(&ctx->fh, video_devdata(file)); - file->private_data =3D &ctx->fh; ctx->dev =3D dev; ctx->bit_depth =3D 8; =20 @@ -383,7 +382,7 @@ static int cedrus_open(struct file *file) if (ret) goto err_m2m_release; =20 - v4l2_fh_add(&ctx->fh); + v4l2_fh_add(&ctx->fh, file); =20 mutex_unlock(&dev->dev_mutex); =20 diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/vide= o/video.c index 116331cead2a6676f2c018b3f8fc10b0716dfc3a..24a68e3e54195cf5f8952a35fe1= 03d93bb0fd3e5 100644 --- a/drivers/staging/most/video/video.c +++ b/drivers/staging/most/video/video.c @@ -96,9 +96,7 @@ static int comp_vdev_open(struct file *filp) =20 fh->mdev =3D mdev; v4l2_fh_init(&fh->fh, vdev); - filp->private_data =3D &fh->fh; - - v4l2_fh_add(&fh->fh); + v4l2_fh_add(&fh->fh, filp); =20 ret =3D most_start_channel(mdev->iface, mdev->ch_idx, &comp); if (ret) { diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/fu= nction/uvc_v4l2.c index 886300a29b908a6dda3e2dfcb6b3414f782b172b..680f25d17dc2c7b99529441de8f= 079abe3b3411f 100644 --- a/drivers/usb/gadget/function/uvc_v4l2.c +++ b/drivers/usb/gadget/function/uvc_v4l2.c @@ -672,10 +672,9 @@ uvc_v4l2_open(struct file *file) return -ENOMEM; =20 v4l2_fh_init(&handle->vfh, vdev); - v4l2_fh_add(&handle->vfh); + v4l2_fh_add(&handle->vfh, file); =20 handle->device =3D &uvc->video; - file->private_data =3D &handle->vfh; =20 return 0; } diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h index 14e7136e693f0a7b8b25959200603028e0db36ac..d8fcf49f10e09452b73499f4a9b= d1285bc2835a5 100644 --- a/include/media/v4l2-fh.h +++ b/include/media/v4l2-fh.h @@ -87,11 +87,14 @@ void v4l2_fh_init(struct v4l2_fh *fh, struct video_devi= ce *vdev); * v4l2_fh_add - Add the fh to the list of file handles on a video_device. * * @fh: pointer to &struct v4l2_fh + * @filp: pointer to &struct file associated with @fh + * + * The function sets filp->private_data to point to @fh. * * .. note:: * The @fh file handle must be initialised first. */ -void v4l2_fh_add(struct v4l2_fh *fh); +void v4l2_fh_add(struct v4l2_fh *fh, struct file *filp); =20 /** * v4l2_fh_open - Ancillary routine that can be used as the open\(\) op --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 2BD09221555; Sat, 2 Aug 2025 09:28:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126886; cv=none; b=uxriZxLknTBasO42KlQh4rsd/xyxkecHt1Yn2uzOjYmcZXOkjoGy80j1zMLB0QWUGpb3E9buH3W2QbNpgU0YY3QIZ98LxGvDuRuTqxvzQlq9y3Ha51jq4ekdyJZTNqyGhGrbk9Sckv3iITHXMLBLKojhYyBjsqjK81rFHPpn7Tc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126886; c=relaxed/simple; bh=UrDaiJtOb2B1pPWmD1UPpVK7+2xNQe8j53wpyciSH7E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NibkZh/FkHJHlNoLEl8qJVTppWqcd5b1OUo/ivE4ib9JK90846RhtaPLt/dsFvbs+9bjM01p4f+HJ0BbM34k6XAtNErOWYp+16OmWvF0SBgs5yLDziJjm7MqbFVneiNwpbEa4n/Cr1PkL6j8wzi+NAKqZQWA6TROw4KboOmhE0A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=ONm0yiqE; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ONm0yiqE" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4909C3C41; Sat, 2 Aug 2025 11:27:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126836; bh=UrDaiJtOb2B1pPWmD1UPpVK7+2xNQe8j53wpyciSH7E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ONm0yiqElSs3SBccrZIN4UIeyfiUjHalMHuiAVGr6Ca7VglBPElnuUQUKFP+FkC0+ X+aZTqmVbEVg4i8+FrSbw0hK8CBZb2B+8Dh9II+8IZ9xtDiNaSaBJy9ppoviEpnLOj 0Jw8Vy2hIpiqig8W8F+0B69EOMdnQyDDAST39FeM= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:49 +0200 Subject: [PATCH 27/65] media: Reset file->private_data to NULL in v4l2_fh_del() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-27-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=47312; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=uW01dA19EIG3zy3WR2ZDkpVBMP48NXn8Hl/F2uQgSyk=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj6uG1NSaJwha7+UeGPCjsgvmiL4vhFWvuTy 3pm/iUpvjWJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+gAKCRByNAaPFqFW PIyVEADGidlVwcbBoYApUrwhMUvWqtJZUc465SevVKV3VuhFxOqlmnLhdyjZ9eGgU+vzJa5E1oP Nb5fVLk8jEt4WuCKYWC3fZnySClZU4buKGpCPiLxGaEhhhZcGWURKc4o7jj+e9m1YhG/8Xy5e/B Wl0n8fok1FP+4BrRBG7ZK1emVPwsOJv/LwXxZPwrS6ouzJtywCNFi5bhM7F2cwsHQMYgkGX6jy3 ws3CPt3sLnwM5E4nxMEZvvQB1MLS3ZSh5Yr1Iy+LNivSB3OJeMvCnlSc+YRSuJlUIzm5qg2XJb4 kDFUBRY3Cyz8VAe8R+KqJM1m0BdOhCqbicNvFdiag1hox2Wft7vCOLEJHm7z9mWiP5Z+ga6oSWQ 860UfbDKGHPe27YOjo87cxVKVVAF9s9Nbylx+wvnCPh1GL3hIi1IkqyIJIJ68c2D2XMzE7qZFoz b3u46104BpoOthyIDtSYI2nuVNEUt0fAZsSfeVclp8oqzosxE+gKnG4q9TQ2uSa9S3veXlJCIRS MLros68Tjn2DaoIcROMCorTCUtTgDF7xfJXDvRWQZTqv1c2vpVQH9QNt+M5/GA5E3BJoWVIKsNw Smwax50fxz9BP9G2U0NjHX/hAyTWLAENWvqZTNt2UkB9CfEQjKzbQvICwjPPMq/iKMMUDxv2X4l BlCqdBHnvCwyN9Q== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Multiple drivers that use v4l2_fh and call v4l2_fh_del() manually reset the file->private_data pointer to NULL in their video device .release() file operation handler. Move the code to the v4l2_fh_del() function to avoid direct access to file->private_data in drivers. This requires adding a file pointer argument to the function. Changes to drivers have been generated with the following coccinelle semantic patch: @@ expression fh; identifier filp; identifier release; type ret; @@ ret release(..., struct file *filp, ...) { <... - filp->private_data =3D NULL; ... - v4l2_fh_del(fh); + v4l2_fh_del(fh, filp); ...> } @@ expression fh; identifier filp; identifier release; type ret; @@ ret release(..., struct file *filp, ...) { <... - v4l2_fh_del(fh); + v4l2_fh_del(fh, filp); ... - filp->private_data =3D NULL; ...> } @@ expression fh; identifier filp; identifier release; type ret; @@ ret release(..., struct file *filp, ...) { <... - v4l2_fh_del(fh); + v4l2_fh_del(fh, filp); ...> } Manual changes have been applied to Documentation/ to update the usage patterns, to drivers/media/v4l2-core/v4l2-fh.c to update the v4l2_fh_del() prototype and reset file->private_data, and to include/media/v4l2-fh.h to update the v4l2_fh_del() function prototype and its documentation. Additionally, white space issues have been fixed manually in drivers/usb/gadget/function/uvc_v4l2.c Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- Documentation/driver-api/media/v4l2-fh.rst | 4 ++-- Documentation/translations/zh_CN/video4linux/v4l2-framework.txt | 4 ++-- drivers/media/pci/cx18/cx18-fileops.c | 4 ++-- drivers/media/pci/ivtv/ivtv-fileops.c | 4 ++-- drivers/media/pci/saa7164/saa7164-encoder.c | 2 +- drivers/media/pci/saa7164/saa7164-vbi.c | 2 +- drivers/media/platform/allegro-dvt/allegro-core.c | 2 +- drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 2 +- drivers/media/platform/amphion/vpu_v4l2.c | 4 ++-- drivers/media/platform/chips-media/coda/coda-common.c | 4 ++-- drivers/media/platform/chips-media/wave5/wave5-helper.c | 2 +- drivers/media/platform/imagination/e5010-jpeg-enc.c | 4 ++-- drivers/media/platform/m2m-deinterlace.c | 2 +- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 4 ++-- drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c | 4 ++-- drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 4 ++-- .../media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 4 ++-- .../media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c | 4 ++-- drivers/media/platform/nvidia/tegra-vde/v4l2.c | 2 +- drivers/media/platform/nxp/dw100/dw100.c | 2 +- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 4 ++-- drivers/media/platform/nxp/imx-pxp.c | 2 +- drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 2 +- drivers/media/platform/nxp/mx2_emmaprp.c | 2 +- drivers/media/platform/qcom/iris/iris_vidc.c | 3 +-- drivers/media/platform/qcom/venus/core.c | 2 +- drivers/media/platform/renesas/rcar_fdp1.c | 2 +- drivers/media/platform/renesas/rcar_jpu.c | 4 ++-- drivers/media/platform/renesas/vsp1/vsp1_video.c | 2 +- drivers/media/platform/rockchip/rga/rga.c | 2 +- drivers/media/platform/rockchip/rkvdec/rkvdec.c | 2 +- drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c | 4 ++-- drivers/media/platform/samsung/exynos4-is/fimc-m2m.c | 4 ++-- drivers/media/platform/samsung/s5p-g2d/g2d.c | 2 +- drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c | 4 ++-- drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 4 ++-- drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c | 4 ++-- drivers/media/platform/st/sti/delta/delta-v4l2.c | 4 ++-- drivers/media/platform/st/sti/hva/hva-v4l2.c | 4 ++-- drivers/media/platform/st/stm32/dma2d/dma2d.c | 2 +- drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 2 +- drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +- drivers/media/platform/ti/omap3isp/ispvideo.c | 5 ++-= -- drivers/media/platform/ti/vpe/vpe.c | 2 +- drivers/media/platform/verisilicon/hantro_drv.c | 4 ++-- drivers/media/test-drivers/vicodec/vicodec-core.c | 2 +- drivers/media/test-drivers/vim2m.c | 2 +- drivers/media/test-drivers/visl/visl-core.c | 2 +- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 3 +-- drivers/media/v4l2-core/v4l2-fh.c | 7 +++= +--- drivers/media/v4l2-core/v4l2-subdev.c | 5 ++-= -- drivers/staging/media/imx/imx-media-csc-scaler.c | 4 ++-- drivers/staging/media/meson/vdec/vdec.c | 2 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 2 +- drivers/staging/most/video/video.c | 4 ++-- drivers/usb/gadget/function/uvc_v4l2.c | 3 +-- include/media/v4l2-fh.h | 5 +++= +- 57 files changed, 89 insertions(+), 90 deletions(-) diff --git a/Documentation/driver-api/media/v4l2-fh.rst b/Documentation/dri= ver-api/media/v4l2-fh.rst index a7393067f5db2183aa677e15ece512296455e23b..afcad22ead7c919a07475720058= ec1ab3a5d5494 100644 --- a/Documentation/driver-api/media/v4l2-fh.rst +++ b/Documentation/driver-api/media/v4l2-fh.rst @@ -65,7 +65,7 @@ Example: struct my_fh *my_fh =3D container_of(fh, struct my_fh, fh); =20 ... - v4l2_fh_del(&my_fh->fh); + v4l2_fh_del(&my_fh->fh, file); v4l2_fh_exit(&my_fh->fh); kfree(my_fh); return 0; @@ -86,7 +86,7 @@ Below is a short description of the :c:type:`v4l2_fh` fun= ctions used: Must be called once the file handle is completely initialized. =20 :c:func:`v4l2_fh_del ` -(:c:type:`fh `) +(:c:type:`fh `, struct file \*filp) =20 - Unassociate the file handle from :c:type:`video_device`. The file handle exit function may now be called. diff --git a/Documentation/translations/zh_CN/video4linux/v4l2-framework.tx= t b/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt index 2d38ae17d9404d9d40c63bc8329f3cc6999b7a11..1653c6e2cb4659c71bdb5001a0a= 3ba0b1c3c9411 100644 --- a/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt +++ b/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt @@ -822,7 +822,7 @@ int my_release(struct file *file) struct my_fh *my_fh =3D container_of(fh, struct my_fh, fh); =20 ... - v4l2_fh_del(&my_fh->fh); + v4l2_fh_del(&my_fh->fh, file); v4l2_fh_exit(&my_fh->fh); kfree(my_fh); return 0; @@ -840,7 +840,7 @@ void v4l2_fh_add(struct v4l2_fh *fh, struct file *filp) =E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA v4l2_fh =E5=88=B0 video_device =E6= =96=87=E4=BB=B6=E5=8F=A5=E6=9F=84=E5=88=97=E8=A1=A8=E3=80=82=E4=B8=80=E6=97= =A6=E6=96=87=E4=BB=B6=E5=8F=A5=E6=9F=84 =E5=88=9D=E5=A7=8B=E5=8C=96=E5=AE=8C=E6=88=90=E5=B0=B1=E5=BF=85=E9=A1=BB= =E8=B0=83=E7=94=A8=E3=80=82 =20 -void v4l2_fh_del(struct v4l2_fh *fh) +void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp) =20 =E4=BB=8E video_device() =E4=B8=AD=E8=A7=A3=E9=99=A4=E6=96=87=E4=BB=B6= =E5=8F=A5=E6=9F=84=E7=9A=84=E5=85=B3=E8=81=94=E3=80=82=E6=96=87=E4=BB=B6=E5= =8F=A5=E6=9F=84=E7=9A=84=E9=80=80=E5=87=BA=E5=87=BD=E6=95=B0=E4=B9=9F =E5=B0=86=E8=A2=AB=E8=B0=83=E7=94=A8=E3=80=82 diff --git a/drivers/media/pci/cx18/cx18-fileops.c b/drivers/media/pci/cx18= /cx18-fileops.c index f90b547f5d676308ed5c7956a8da02e208b9446e..d49fa4c4119b6e14843a01a73c9= 662839ecc6c05 100644 --- a/drivers/media/pci/cx18/cx18-fileops.c +++ b/drivers/media/pci/cx18/cx18-fileops.c @@ -713,7 +713,7 @@ int cx18_v4l2_close(struct file *filp) vb2_queue_release(vdev->queue); vdev->queue->owner =3D NULL; } - v4l2_fh_del(fh); + v4l2_fh_del(fh, filp); v4l2_fh_exit(fh); =20 /* 'Unclaim' this stream */ @@ -751,7 +751,7 @@ static int cx18_serialized_open(struct cx18_stream *s, = struct file *filp) if (atomic_read(&cx->ana_capturing) > 0) { /* switching to radio while capture is in progress is not polite */ - v4l2_fh_del(&item->fh); + v4l2_fh_del(&item->fh, filp); v4l2_fh_exit(&item->fh); kfree(item); return -EBUSY; diff --git a/drivers/media/pci/ivtv/ivtv-fileops.c b/drivers/media/pci/ivtv= /ivtv-fileops.c index aa5f5f16427c48123cd314932a7d8bc48f07c031..0040a5e7f654149eb429400dd1d= b7197a9a3b54e 100644 --- a/drivers/media/pci/ivtv/ivtv-fileops.c +++ b/drivers/media/pci/ivtv/ivtv-fileops.c @@ -911,7 +911,7 @@ int ivtv_v4l2_close(struct file *filp) ivtv_unmute(itv); } =20 - v4l2_fh_del(fh); + v4l2_fh_del(fh, filp); v4l2_fh_exit(fh); =20 /* Easy case first: this stream was never claimed by us */ @@ -1006,7 +1006,7 @@ static int ivtv_open(struct file *filp) if (atomic_read(&itv->capturing) > 0) { /* switching to radio while capture is in progress is not polite */ - v4l2_fh_del(&item->fh); + v4l2_fh_del(&item->fh, filp); v4l2_fh_exit(&item->fh); kfree(item); return -EBUSY; diff --git a/drivers/media/pci/saa7164/saa7164-encoder.c b/drivers/media/pc= i/saa7164/saa7164-encoder.c index e6e353a251cf548525c44e87695f7d45bde302a6..66d650b5f69af1eac9117b9c65a= c7c39883f6f21 100644 --- a/drivers/media/pci/saa7164/saa7164-encoder.c +++ b/drivers/media/pci/saa7164/saa7164-encoder.c @@ -746,7 +746,7 @@ static int fops_release(struct file *file) } } =20 - v4l2_fh_del(&fh->fh); + v4l2_fh_del(&fh->fh, file); v4l2_fh_exit(&fh->fh); kfree(fh); =20 diff --git a/drivers/media/pci/saa7164/saa7164-vbi.c b/drivers/media/pci/sa= a7164/saa7164-vbi.c index 181442fcb43b08cd96f29c2357bcfadd3ddcedb4..57e4362c0d19d0d3a5f0be1ee58= cd141fdf62462 100644 --- a/drivers/media/pci/saa7164/saa7164-vbi.c +++ b/drivers/media/pci/saa7164/saa7164-vbi.c @@ -449,7 +449,7 @@ static int fops_release(struct file *file) } } =20 - v4l2_fh_del(&fh->fh); + v4l2_fh_del(&fh->fh, file); v4l2_fh_exit(&fh->fh); kfree(fh); =20 diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/me= dia/platform/allegro-dvt/allegro-core.c index 8c30f3cd4fc545133f697973b0f002ea888a3a4a..5e3b1f5d7206d84b8ccb9ea3b3f= 3f1fe75becf99 100644 --- a/drivers/media/platform/allegro-dvt/allegro-core.c +++ b/drivers/media/platform/allegro-dvt/allegro-core.c @@ -3241,7 +3241,7 @@ static int allegro_release(struct file *file) =20 v4l2_ctrl_handler_free(&channel->ctrl_handler); =20 - v4l2_fh_del(&channel->fh); + v4l2_fh_del(&channel->fh, file); v4l2_fh_exit(&channel->fh); =20 kfree(channel); diff --git a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c b/drivers/med= ia/platform/amlogic/meson-ge2d/ge2d.c index d36891b546bca417e8b98c5e0458ebb15e24c213..b1b0b6535fb1931c74ae9b2da28= bea579cd1bc4c 100644 --- a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c +++ b/drivers/media/platform/amlogic/meson-ge2d/ge2d.c @@ -883,7 +883,7 @@ static int ge2d_release(struct file *file) v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); =20 v4l2_ctrl_handler_free(&ctx->ctrl_handler); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); =20 diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/plat= form/amphion/vpu_v4l2.c index e13bfe09af1bf0926bf6005b83a8aae7e34a2122..fcb2eff813ac456386ef163c53d= b8ac34a278dd7 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -791,7 +791,7 @@ int vpu_v4l2_open(struct file *file, struct vpu_inst *i= nst) =20 return 0; error: - v4l2_fh_del(&inst->fh); + v4l2_fh_del(&inst->fh, file); v4l2_fh_exit(&inst->fh); vpu_inst_put(inst); return ret; @@ -812,7 +812,7 @@ int vpu_v4l2_close(struct file *file) call_void_vop(inst, release); vpu_inst_unlock(inst); =20 - v4l2_fh_del(&inst->fh); + v4l2_fh_del(&inst->fh, file); v4l2_fh_exit(&inst->fh); =20 vpu_inst_unregister(inst); diff --git a/drivers/media/platform/chips-media/coda/coda-common.c b/driver= s/media/platform/chips-media/coda/coda-common.c index 9d8a1c9bea6e9f4d9fc2c2ae165d587e3b3b9650..a27d5a261a27fb78d4c7ca00814= 6780698386333 100644 --- a/drivers/media/platform/chips-media/coda/coda-common.c +++ b/drivers/media/platform/chips-media/coda/coda-common.c @@ -2725,7 +2725,7 @@ static int coda_open(struct file *file) err_clk_enable: pm_runtime_put_sync(dev->dev); err_pm_get: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); err_coda_name_init: ida_free(&dev->ida, ctx->idx); @@ -2763,7 +2763,7 @@ static int coda_release(struct file *file) clk_disable_unprepare(dev->clk_ahb); clk_disable_unprepare(dev->clk_per); pm_runtime_put_sync(dev->dev); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); ida_free(&dev->ida, ctx->idx); if (ctx->ops->release) diff --git a/drivers/media/platform/chips-media/wave5/wave5-helper.c b/driv= ers/media/platform/chips-media/wave5/wave5-helper.c index ed8ff04a899da0a3c9e0f037dac2c9548c98920f..0bce62f0c03902ae367182ee047= 74c79accc4712 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-helper.c +++ b/drivers/media/platform/chips-media/wave5/wave5-helper.c @@ -46,7 +46,7 @@ void wave5_cleanup_instance(struct vpu_instance *inst, st= ruct file *filp) wave5_vdi_free_dma_memory(inst->dev, &inst->bitstream_vbuf); v4l2_ctrl_handler_free(&inst->v4l2_ctrl_hdl); if (inst->v4l2_fh.vdev) { - v4l2_fh_del(&inst->v4l2_fh); + v4l2_fh_del(&inst->v4l2_fh, filp); v4l2_fh_exit(&inst->v4l2_fh); } list_del_init(&inst->list); diff --git a/drivers/media/platform/imagination/e5010-jpeg-enc.c b/drivers/= media/platform/imagination/e5010-jpeg-enc.c index 1da00ff4b1e36a6486ce54e02139f6489d6acf22..c4e0097cb8b7fa310c2c5519d7a= f4e6e3b378915 100644 --- a/drivers/media/platform/imagination/e5010-jpeg-enc.c +++ b/drivers/media/platform/imagination/e5010-jpeg-enc.c @@ -769,7 +769,7 @@ static int e5010_open(struct file *file) err_ctrls_setup: v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); exit: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); mutex_unlock(&e5010->mutex); free: @@ -786,7 +786,7 @@ static int e5010_release(struct file *file) mutex_lock(&e5010->mutex); v4l2_ctrl_handler_free(&ctx->ctrl_handler); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); mutex_unlock(&e5010->mutex); diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platf= orm/m2m-deinterlace.c index a343dffd19f03c68557415afae2a8db4b3614d2e..51c2f206cb1f601ec2f3d07fffb= f63c86f4cdc01 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c @@ -880,7 +880,7 @@ static int deinterlace_release(struct file *file) =20 dprintk(pcdev, "Releasing instance %p\n", ctx); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); kfree(ctx->xt); diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers= /media/platform/mediatek/jpeg/mtk_jpeg_core.c index 4bf52e9d960431194c05870743cc628e4e4293e2..8e1883d034f5c67d418f5607c59= 3c60f5d6ddbee 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1201,7 +1201,7 @@ static int mtk_jpeg_open(struct file *file) return 0; =20 error: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); mutex_unlock(&jpeg->lock); free: @@ -1217,7 +1217,7 @@ static int mtk_jpeg_release(struct file *file) mutex_lock(&jpeg->lock); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); v4l2_ctrl_handler_free(&ctx->ctrl_hdl); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); mutex_unlock(&jpeg->lock); diff --git a/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c b/drivers/me= dia/platform/mediatek/mdp/mtk_mdp_m2m.c index 25efd76f290e4f29a60d326e92a5bcb05c2bbd1e..3d836b5efa3807e4dc882956040= 014e244eeb660 100644 --- a/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c +++ b/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c @@ -1130,7 +1130,7 @@ static int mtk_mdp_m2m_open(struct file *file) error_m2m_ctx: v4l2_ctrl_handler_free(&ctx->ctrl_handler); error_ctrls: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); mutex_unlock(&mdp->lock); err_lock: @@ -1148,7 +1148,7 @@ static int mtk_mdp_m2m_release(struct file *file) mutex_lock(&mdp->lock); v4l2_m2m_ctx_release(ctx->m2m_ctx); v4l2_ctrl_handler_free(&ctx->ctrl_handler); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); mtk_mdp_vpu_deinit(&ctx->vpu); mdp->ctx_num--; diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c b/drivers/= media/platform/mediatek/mdp3/mtk-mdp3-m2m.c index 18e542ad32e4fd0d0d262670b6440fb2e3661f7f..2e0619542d2a9ad73457853e4f5= 008e6eb130cdd 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c @@ -633,7 +633,7 @@ static int mdp_m2m_open(struct file *file) v4l2_m2m_ctx_release(ctx->m2m_ctx); err_release_handler: v4l2_ctrl_handler_free(&ctx->ctrl_handler); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); err_exit_fh: v4l2_fh_exit(&ctx->fh); ida_free(&mdp->mdp_ida, ctx->id); @@ -657,7 +657,7 @@ static int mdp_m2m_release(struct file *file) mdp_vpu_put_locked(mdp); =20 v4l2_ctrl_handler_free(&ctx->ctrl_handler); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); ida_free(&mdp->mdp_ida, ctx->id); mutex_unlock(&mdp->m2m_lock); diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_= drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c index 952a77c383bdb8dba94c74916674e729ee5aba35..46d176e6de63e370693fe20cc04= c52cde81f4d73 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c @@ -282,7 +282,7 @@ static int fops_vcodec_open(struct file *file) err_m2m_ctx_init: v4l2_ctrl_handler_free(&ctx->ctrl_hdl); err_ctrls_setup: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); mutex_unlock(&dev->dev_mutex); @@ -307,7 +307,7 @@ static int fops_vcodec_release(struct file *file) v4l2_m2m_ctx_release(ctx->m2m_ctx); mtk_vcodec_dec_release(ctx); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->ctrl_hdl); =20 diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_= drv.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c index 9cacb6cbcf28357826db2df7e15c3588e7b4d4c8..fb1c3bdc2daeb4b439d29bb6bbe= cc1ad786e9eb0 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c @@ -191,7 +191,7 @@ static int fops_vcodec_open(struct file *file) err_m2m_ctx_init: v4l2_ctrl_handler_free(&ctx->ctrl_hdl); err_ctrls_setup: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); mutex_unlock(&dev->dev_mutex); @@ -209,7 +209,7 @@ static int fops_vcodec_release(struct file *file) =20 v4l2_m2m_ctx_release(ctx->m2m_ctx); mtk_vcodec_enc_release(ctx); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->ctrl_hdl); =20 diff --git a/drivers/media/platform/nvidia/tegra-vde/v4l2.c b/drivers/media= /platform/nvidia/tegra-vde/v4l2.c index 688b776b30107df4ec3642a4bc0e896759ccf0fe..0c50f4ff82e0a8f4935325d0069= 1c58072182926 100644 --- a/drivers/media/platform/nvidia/tegra-vde/v4l2.c +++ b/drivers/media/platform/nvidia/tegra-vde/v4l2.c @@ -856,7 +856,7 @@ static int tegra_release(struct file *file) struct tegra_ctx *ctx =3D fh_to_tegra_ctx(fh); struct tegra_vde *vde =3D ctx->vde; =20 - v4l2_fh_del(fh); + v4l2_fh_del(fh, file); v4l2_m2m_ctx_release(fh->m2m_ctx); v4l2_ctrl_handler_free(&ctx->hdl); v4l2_fh_exit(fh); diff --git a/drivers/media/platform/nxp/dw100/dw100.c b/drivers/media/platf= orm/nxp/dw100/dw100.c index 2bd30910ddf98401dfc9d8f2e3b19fe8672320e3..97744c7b7c034cadfdd3f6d7616= 5b4da85fa3d16 100644 --- a/drivers/media/platform/nxp/dw100/dw100.c +++ b/drivers/media/platform/nxp/dw100/dw100.c @@ -667,7 +667,7 @@ static int dw100_release(struct file *file) { struct dw100_ctx *ctx =3D dw100_file2ctx(file); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->hdl); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index 13e681a0ec0abcb49b14455773da3ab2f5dc372b..fa7d74d8c1aabd3bf74482e2141= 65d8c1a7e89da 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -2238,7 +2238,7 @@ static int mxc_jpeg_open(struct file *file) err_ctrls_setup: v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); error: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); mutex_unlock(&mxc_jpeg->lock); free: @@ -2751,7 +2751,7 @@ static int mxc_jpeg_release(struct file *file) ctx->slot); v4l2_ctrl_handler_free(&ctx->ctrl_handler); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); mutex_unlock(&mxc_jpeg->lock); diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/= nxp/imx-pxp.c index 9602409f3ecef7e2a77a58f9c3376823a72ec551..6cc9b07ea53a002c2eda0fd6062= 096f5527ad62c 100644 --- a/drivers/media/platform/nxp/imx-pxp.c +++ b/drivers/media/platform/nxp/imx-pxp.c @@ -1716,7 +1716,7 @@ static int pxp_release(struct file *file) =20 dprintk(dev, "Releasing instance %p\n", ctx); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->hdl); mutex_lock(&dev->dev_mutex); diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c b/drivers/m= edia/platform/nxp/imx8-isi/imx8-isi-m2m.c index 480669a2578ab2f4d6d5104658ba56ea776a6639..850dd8ae95841d4470ac6bd7cb1= e54a7510d6d5e 100644 --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c @@ -716,7 +716,7 @@ static int mxc_isi_m2m_release(struct file *file) v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); mxc_isi_m2m_ctx_ctrls_delete(ctx); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); =20 mutex_destroy(&ctx->vb2_lock); diff --git a/drivers/media/platform/nxp/mx2_emmaprp.c b/drivers/media/platf= orm/nxp/mx2_emmaprp.c index 8c8f834e6250f5effcbb7f098f388a9ccc96302c..d23da93304bd6f55898cfb96319= d2fa101036ca1 100644 --- a/drivers/media/platform/nxp/mx2_emmaprp.c +++ b/drivers/media/platform/nxp/mx2_emmaprp.c @@ -769,7 +769,7 @@ static int emmaprp_release(struct file *file) mutex_lock(&pcdev->dev_mutex); clk_disable_unprepare(pcdev->clk_emma_ahb); clk_disable_unprepare(pcdev->clk_emma_ipg); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); mutex_unlock(&pcdev->dev_mutex); diff --git a/drivers/media/platform/qcom/iris/iris_vidc.c b/drivers/media/p= latform/qcom/iris/iris_vidc.c index cdd34a3b71ff4309829f0f159241c3815658bcb8..541ae86f7892ab7ca89e9d5856e= f10d189b2fb32 100644 --- a/drivers/media/platform/qcom/iris/iris_vidc.c +++ b/drivers/media/platform/qcom/iris/iris_vidc.c @@ -30,8 +30,7 @@ static void iris_v4l2_fh_init(struct iris_inst *inst, str= uct file *filp) =20 static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp) { - filp->private_data =3D NULL; - v4l2_fh_del(&inst->fh); + v4l2_fh_del(&inst->fh, filp); inst->fh.ctrl_handler =3D NULL; v4l2_fh_exit(&inst->fh); } diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platf= orm/qcom/venus/core.c index 5e1ace16a4903999c7fd7a985317dae8dd2410ba..90de29f166ada7aa5afe611041d= f308b5dfe8312 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -607,7 +607,7 @@ void venus_close_common(struct venus_inst *inst, struct= file *filp) v4l2_m2m_ctx_release(inst->m2m_ctx); v4l2_m2m_release(inst->m2m_dev); hfi_session_destroy(inst); - v4l2_fh_del(&inst->fh); + v4l2_fh_del(&inst->fh, filp); v4l2_fh_exit(&inst->fh); v4l2_ctrl_handler_free(&inst->ctrl_handler); =20 diff --git a/drivers/media/platform/renesas/rcar_fdp1.c b/drivers/media/pla= tform/renesas/rcar_fdp1.c index e0d12b579d87025e3f309f6593c068ad87f1856b..e78d8fb104e9544d27c8ace3888= 8995ca170483f 100644 --- a/drivers/media/platform/renesas/rcar_fdp1.c +++ b/drivers/media/platform/renesas/rcar_fdp1.c @@ -2166,7 +2166,7 @@ static int fdp1_release(struct file *file) =20 dprintk(fdp1, "Releasing instance %p\n", ctx); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->hdl); mutex_lock(&fdp1->dev_mutex); diff --git a/drivers/media/platform/renesas/rcar_jpu.c b/drivers/media/plat= form/renesas/rcar_jpu.c index 26c5c77e4a17b26c453e3ea80b0f7c752e2f8029..058fcfb967bd98440f33272db42= f0d973299d572 100644 --- a/drivers/media/platform/renesas/rcar_jpu.c +++ b/drivers/media/platform/renesas/rcar_jpu.c @@ -1276,7 +1276,7 @@ static int jpu_open(struct file *file) device_prepare_rollback: mutex_unlock(&jpu->mutex); v4l_prepare_rollback: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); return ret; @@ -1289,7 +1289,7 @@ static int jpu_release(struct file *file) =20 v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); v4l2_ctrl_handler_free(&ctx->ctrl_handler); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); =20 diff --git a/drivers/media/platform/renesas/vsp1/vsp1_video.c b/drivers/med= ia/platform/renesas/vsp1/vsp1_video.c index b6dc1ee3dc50ac8d0eb79408b06c601cb501e9b8..75f9a1a85d558ff0afa2fdaf8c4= 3a22ddbd694a8 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_video.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_video.c @@ -1083,7 +1083,7 @@ static int vsp1_video_open(struct file *file) =20 ret =3D vsp1_device_get(video->vsp1); if (ret < 0) { - v4l2_fh_del(vfh); + v4l2_fh_del(vfh, file); v4l2_fh_exit(vfh); kfree(vfh); } diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/plat= form/rockchip/rga/rga.c index d88817023996b29afc79cdd6fbdd42dfc5829b13..45c42c7ad846fab985e573ef7ac= f4a5bc1a4cac1 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -418,7 +418,7 @@ static int rga_release(struct file *file) v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); =20 v4l2_ctrl_handler_free(&ctx->ctrl_handler); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); =20 diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/medi= a/platform/rockchip/rkvdec/rkvdec.c index 2fbad685e92cee4916420565a28c778b1a5e1a8e..481c2488f9ac64e70869ed21e50= 53cfbc4ed6e0e 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c @@ -954,7 +954,7 @@ static int rkvdec_release(struct file *filp) { struct rkvdec_ctx *ctx =3D file_to_rkvdec_ctx(filp); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, filp); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); v4l2_ctrl_handler_free(&ctx->ctrl_hdl); v4l2_fh_exit(&ctx->fh); diff --git a/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c b/drivers/= media/platform/samsung/exynos-gsc/gsc-m2m.c index 39d84ffd1b05990ba4b8af281aba09e3f9cc5340..2999fb2610f0f61b63d0331f948= 83469ff43d751 100644 --- a/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c @@ -654,7 +654,7 @@ static int gsc_m2m_open(struct file *file) =20 error_ctrls: gsc_ctrls_delete(ctx); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); error_fh: v4l2_fh_exit(&ctx->fh); kfree(ctx); @@ -675,7 +675,7 @@ static int gsc_m2m_release(struct file *file) =20 v4l2_m2m_ctx_release(ctx->m2m_ctx); gsc_ctrls_delete(ctx); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); =20 if (--gsc->m2m.refcnt <=3D 0) diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c b/drivers= /media/platform/samsung/exynos4-is/fimc-m2m.c index b002b02a899efdd95df4ae8a5db59b9f144a61db..609fd84f89d4ad189d0f367bb37= 693f15f3a618e 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c @@ -663,7 +663,7 @@ static int fimc_m2m_open(struct file *file) v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); error_c: fimc_ctrls_delete(ctx); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); error_fh: v4l2_fh_exit(&ctx->fh); kfree(ctx); @@ -684,7 +684,7 @@ static int fimc_m2m_release(struct file *file) =20 v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); fimc_ctrls_delete(ctx); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); =20 if (--fimc->m2m.refcnt <=3D 0) diff --git a/drivers/media/platform/samsung/s5p-g2d/g2d.c b/drivers/media/p= latform/samsung/s5p-g2d/g2d.c index e34cae9c9cf65d3161822b68233d28472171f917..922262f61e7b53baf1b5840d351= 49bf5b4b2e7ad 100644 --- a/drivers/media/platform/samsung/s5p-g2d/g2d.c +++ b/drivers/media/platform/samsung/s5p-g2d/g2d.c @@ -280,7 +280,7 @@ static int g2d_release(struct file *file) v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); mutex_unlock(&dev->mutex); v4l2_ctrl_handler_free(&ctx->ctrl_handler); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); v4l2_info(&dev->v4l2_dev, "instance closed\n"); diff --git a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c b/drivers/= media/platform/samsung/s5p-jpeg/jpeg-core.c index c4ad0196ed8f1bf579365a0a21dd8c4a78bdaa10..2a57efd181540183e7d2b66d51f= 9f2f274ddd100 100644 --- a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c @@ -1005,7 +1005,7 @@ static int s5p_jpeg_open(struct file *file) return 0; =20 error: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); mutex_unlock(&jpeg->lock); free: @@ -1021,7 +1021,7 @@ static int s5p_jpeg_release(struct file *file) mutex_lock(&jpeg->lock); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); v4l2_ctrl_handler_free(&ctx->ctrl_handler); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); mutex_unlock(&jpeg->lock); diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c b/drivers/med= ia/platform/samsung/s5p-mfc/s5p_mfc.c index 74629db05121ac9181af9daa471c113876f9d323..a5e756049620cdf35df4526b9a4= cb55985f6476e 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c @@ -955,7 +955,7 @@ static int s5p_mfc_open(struct file *file) err_bad_node: dev->ctx[ctx->num] =3D NULL; err_no_ctx: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); err_alloc: @@ -1010,7 +1010,7 @@ static int s5p_mfc_release(struct file *file) if (dev) dev->ctx[ctx->num] =3D NULL; s5p_mfc_dec_ctrls_delete(ctx); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); /* vdev is gone if dev is null */ if (dev) v4l2_fh_exit(&ctx->fh); diff --git a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c b/drivers/med= ia/platform/st/sti/bdisp/bdisp-v4l2.c index 57dcc625096b4b684cfde0051d200bf8c18e4ba4..fc7945d29bccc2fdf0fc48fc14d= 6698b321418d9 100644 --- a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c @@ -634,7 +634,7 @@ static int bdisp_open(struct file *file) =20 error_ctrls: bdisp_ctrls_delete(ctx); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); error_fh: v4l2_fh_exit(&ctx->fh); bdisp_hw_free_nodes(ctx); @@ -659,7 +659,7 @@ static int bdisp_release(struct file *file) =20 bdisp_ctrls_delete(ctx); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); =20 if (--bdisp->m2m.refcnt <=3D 0) diff --git a/drivers/media/platform/st/sti/delta/delta-v4l2.c b/drivers/med= ia/platform/st/sti/delta/delta-v4l2.c index b2df94dcbe21709f5b31446c85408728e70d5bca..adff43271b2dc059abbbf82d90c= d13482f6bca30 100644 --- a/drivers/media/platform/st/sti/delta/delta-v4l2.c +++ b/drivers/media/platform/st/sti/delta/delta-v4l2.c @@ -1684,7 +1684,7 @@ static int delta_open(struct file *file) return 0; =20 err_fh_del: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); err: @@ -1712,7 +1712,7 @@ static int delta_release(struct file *file) =20 v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); =20 /* disable ST231 clocks */ diff --git a/drivers/media/platform/st/sti/hva/hva-v4l2.c b/drivers/media/p= latform/st/sti/hva/hva-v4l2.c index 2f9413fa7318f42b390f96447dcb1a905836703e..3581b73a99b8ba5702e5d4d8d02= cd5c832fa1555 100644 --- a/drivers/media/platform/st/sti/hva/hva-v4l2.c +++ b/drivers/media/platform/st/sti/hva/hva-v4l2.c @@ -1218,7 +1218,7 @@ static int hva_open(struct file *file) err_ctrls: v4l2_ctrl_handler_free(&ctx->ctrl_handler); err_fh: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); out: @@ -1249,7 +1249,7 @@ static int hva_release(struct file *file) =20 v4l2_ctrl_handler_free(&ctx->ctrl_handler); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); =20 #ifdef CONFIG_VIDEO_STI_HVA_DEBUGFS diff --git a/drivers/media/platform/st/stm32/dma2d/dma2d.c b/drivers/media/= platform/st/stm32/dma2d/dma2d.c index b2bced06a1e603f7479620d5db3c12ee89e5149e..bc0f81e78018b20c38677eaea44= 358ddad7a9a52 100644 --- a/drivers/media/platform/st/stm32/dma2d/dma2d.c +++ b/drivers/media/platform/st/stm32/dma2d/dma2d.c @@ -326,7 +326,7 @@ static int dma2d_release(struct file *file) v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); mutex_unlock(&dev->mutex); v4l2_ctrl_handler_free(&ctx->ctrl_handler); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); =20 diff --git a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c b/drivers/med= ia/platform/sunxi/sun8i-di/sun8i-di.c index 7823eb97faf7e9bd13286ab14db2b436fc5caf1f..eb519afb30ca10c6f4370626d0d= ce9e7183b28e5 100644 --- a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +++ b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c @@ -759,7 +759,7 @@ static int deinterlace_release(struct file *file) =20 mutex_lock(&dev->dev_mutex); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); =20 diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/dri= vers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index 368a858b8c0fdea462b85c8c71e22058d10a6c05..89992feaab6082b438eec189c0d= e93568d09f911 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -695,7 +695,7 @@ static int rotate_release(struct file *file) mutex_lock(&dev->dev_mutex); =20 v4l2_ctrl_handler_free(&ctx->ctrl_handler); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); =20 diff --git a/drivers/media/platform/ti/omap3isp/ispvideo.c b/drivers/media/= platform/ti/omap3isp/ispvideo.c index d10a2b96c13cf1f5103504a8bd10c65111392a1e..2c0008444b7e2b532c9af061760= e7399cdf3e45d 100644 --- a/drivers/media/platform/ti/omap3isp/ispvideo.c +++ b/drivers/media/platform/ti/omap3isp/ispvideo.c @@ -1336,7 +1336,7 @@ static int isp_video_open(struct file *file) =20 done: if (ret < 0) { - v4l2_fh_del(&handle->vfh); + v4l2_fh_del(&handle->vfh, file); v4l2_fh_exit(&handle->vfh); kfree(handle); } @@ -1360,10 +1360,9 @@ static int isp_video_release(struct file *file) v4l2_pipeline_pm_put(&video->video.entity); =20 /* Release the file handle. */ - v4l2_fh_del(vfh); + v4l2_fh_del(vfh, file); v4l2_fh_exit(vfh); kfree(handle); - file->private_data =3D NULL; =20 omap3isp_put(video->isp); =20 diff --git a/drivers/media/platform/ti/vpe/vpe.c b/drivers/media/platform/t= i/vpe/vpe.c index a47c5d31c47550cd9c6c8803b25cda1253f906a9..6029d4e8e0bd34d60f1addb91a5= 1bf5fd0709341 100644 --- a/drivers/media/platform/ti/vpe/vpe.c +++ b/drivers/media/platform/ti/vpe/vpe.c @@ -2421,7 +2421,7 @@ static int vpe_release(struct file *file) vpdma_free_desc_buf(&ctx->sc_coeff_v); vpdma_free_desc_buf(&ctx->sc_coeff_h); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->hdl); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/medi= a/platform/verisilicon/hantro_drv.c index aadc3d8fb3d1c1267b370edac6723b99bd00f9bf..4cc9d00fd2936dcfaa4574d8bd9= a23b9ae9b5476 100644 --- a/drivers/media/platform/verisilicon/hantro_drv.c +++ b/drivers/media/platform/verisilicon/hantro_drv.c @@ -677,7 +677,7 @@ static int hantro_open(struct file *filp) return 0; =20 err_fh_free: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, filp); v4l2_fh_exit(&ctx->fh); err_ctx_free: kfree(ctx); @@ -693,7 +693,7 @@ static int hantro_release(struct file *filp) * to this file. */ v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, filp); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->ctrl_handler); kfree(ctx); diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/me= dia/test-drivers/vicodec/vicodec-core.c index f20d9d9643f5e3d39f4807ad337f05c957594e1e..c340fd2260403e1750d1d094f7b= 1567c05a8f08d 100644 --- a/drivers/media/test-drivers/vicodec/vicodec-core.c +++ b/drivers/media/test-drivers/vicodec/vicodec-core.c @@ -1946,7 +1946,7 @@ static int vicodec_release(struct file *file) mutex_lock(vfd->lock); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); mutex_unlock(vfd->lock); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->hdl); kvfree(ctx->state.compressed_frame); diff --git a/drivers/media/test-drivers/vim2m.c b/drivers/media/test-driver= s/vim2m.c index 24574025f58fc34a0b98e8048294624607e39e2a..d0e760118c822aa7696b1cde2a6= be5c9982ad639 100644 --- a/drivers/media/test-drivers/vim2m.c +++ b/drivers/media/test-drivers/vim2m.c @@ -1450,7 +1450,7 @@ static int vim2m_release(struct file *file) =20 dprintk(dev, 1, "Releasing instance %p\n", ctx); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->hdl); mutex_lock(&dev->dev_mutex); diff --git a/drivers/media/test-drivers/visl/visl-core.c b/drivers/media/te= st-drivers/visl/visl-core.c index 0f43ec23f40b40362979646b47b09b75b7786fb2..26c6c6835f793a6ac273856bc9b= 3336a06bae1cd 100644 --- a/drivers/media/test-drivers/visl/visl-core.c +++ b/drivers/media/test-drivers/visl/visl-core.c @@ -389,7 +389,7 @@ static int visl_release(struct file *file) dprintk(dev, "Releasing instance %p\n", ctx); =20 tpg_free(&ctx->tpg); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); v4l2_ctrl_handler_free(&ctx->hdl); mutex_lock(&dev->dev_mutex); diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/p= vrusb2/pvrusb2-v4l2.c index 04c77af0c51ec2174193387253015383d6fac486..f9535a484738a9ef25795daa11a= 74ccb0b914be9 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -900,9 +900,8 @@ static int pvr2_v4l2_release(struct file *file) fhp->rhp =3D NULL; } =20 - v4l2_fh_del(&fhp->fh); + v4l2_fh_del(&fhp->fh, file); v4l2_fh_exit(&fhp->fh); - file->private_data =3D NULL; =20 pvr2_channel_done(&fhp->channel); pvr2_trace(PVR2_TRACE_STRUCT, diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4= l2-fh.c index b59b1084d8cdf1b62da12879e21dbe56c2109648..df3ba9d4674bd25626cfcddc2d0= cb28c233e3cc3 100644 --- a/drivers/media/v4l2-core/v4l2-fh.c +++ b/drivers/media/v4l2-core/v4l2-fh.c @@ -67,7 +67,7 @@ int v4l2_fh_open(struct file *filp) } EXPORT_SYMBOL_GPL(v4l2_fh_open); =20 -void v4l2_fh_del(struct v4l2_fh *fh) +void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp) { unsigned long flags; =20 @@ -75,6 +75,8 @@ void v4l2_fh_del(struct v4l2_fh *fh) list_del_init(&fh->list); spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); v4l2_prio_close(fh->vdev->prio, fh->prio); + + filp->private_data =3D NULL; } EXPORT_SYMBOL_GPL(v4l2_fh_del); =20 @@ -94,10 +96,9 @@ int v4l2_fh_release(struct file *filp) struct v4l2_fh *fh =3D file_to_v4l2_fh(filp); =20 if (fh) { - v4l2_fh_del(fh); + v4l2_fh_del(fh, filp); v4l2_fh_exit(fh); kfree(fh); - filp->private_data =3D NULL; } return 0; } diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-cor= e/v4l2-subdev.c index bf35ac436249fdbf218ed08a712abf546a49b4eb..41e4aca77b7fe432b1b27b3c1e7= ffa8211297e1a 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -109,7 +109,7 @@ static int subdev_open(struct file *file) =20 err: module_put(subdev_fh->owner); - v4l2_fh_del(&subdev_fh->vfh); + v4l2_fh_del(&subdev_fh->vfh, file); v4l2_fh_exit(&subdev_fh->vfh); subdev_fh_free(subdev_fh); kfree(subdev_fh); @@ -127,11 +127,10 @@ static int subdev_close(struct file *file) if (sd->internal_ops && sd->internal_ops->close) sd->internal_ops->close(sd, subdev_fh); module_put(subdev_fh->owner); - v4l2_fh_del(vfh); + v4l2_fh_del(vfh, file); v4l2_fh_exit(vfh); subdev_fh_free(subdev_fh); kfree(subdev_fh); - file->private_data =3D NULL; =20 return 0; } diff --git a/drivers/staging/media/imx/imx-media-csc-scaler.c b/drivers/sta= ging/media/imx/imx-media-csc-scaler.c index 9dc0954ed9aac7088e42bea03c6aada4ee8f2ae8..c4ee0eebb3730e709c3d4a95935= d0047a645e411 100644 --- a/drivers/staging/media/imx/imx-media-csc-scaler.c +++ b/drivers/staging/media/imx/imx-media-csc-scaler.c @@ -792,7 +792,7 @@ static int ipu_csc_scaler_open(struct file *file) err_ctrls: v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); err_ctx: - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); return ret; @@ -807,7 +807,7 @@ static int ipu_csc_scaler_release(struct file *file) =20 v4l2_ctrl_handler_free(&ctx->ctrl_hdlr); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_fh_exit(&ctx->fh); kfree(ctx); =20 diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/medi= a/meson/vdec/vdec.c index b92666ff50a15196de0143f2ba5bf476c6f7729d..49e497a32973b8df18c5143e0db= 68d0f7f42c36c 100644 --- a/drivers/staging/media/meson/vdec/vdec.c +++ b/drivers/staging/media/meson/vdec/vdec.c @@ -926,7 +926,7 @@ static int vdec_close(struct file *file) =20 v4l2_m2m_ctx_release(sess->m2m_ctx); v4l2_m2m_release(sess->m2m_dev); - v4l2_fh_del(&sess->fh); + v4l2_fh_del(&sess->fh, file); v4l2_fh_exit(&sess->fh); =20 mutex_destroy(&sess->lock); diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/= media/sunxi/cedrus/cedrus.c index ebefd646dbdb4e998bf6a8a0f0be6d7e4bf7d28b..bff42ea1871f7376bfdb1dfad2b= a7f22e862b0ea 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -404,7 +404,7 @@ static int cedrus_release(struct file *file) =20 mutex_lock(&dev->dev_mutex); =20 - v4l2_fh_del(&ctx->fh); + v4l2_fh_del(&ctx->fh, file); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); =20 v4l2_ctrl_handler_free(&ctx->hdl); diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/vide= o/video.c index 24a68e3e54195cf5f8952a35fe103d93bb0fd3e5..32f71d9a9cf78ad74aa8b9a53f4= 0c1d52123df52 100644 --- a/drivers/staging/most/video/video.c +++ b/drivers/staging/most/video/video.c @@ -107,7 +107,7 @@ static int comp_vdev_open(struct file *filp) return 0; =20 err_rm: - v4l2_fh_del(&fh->fh); + v4l2_fh_del(&fh->fh, filp); v4l2_fh_exit(&fh->fh); =20 err_dec: @@ -143,7 +143,7 @@ static int comp_vdev_close(struct file *filp) most_stop_channel(mdev->iface, mdev->ch_idx, &comp); mdev->mute =3D false; =20 - v4l2_fh_del(&fh->fh); + v4l2_fh_del(&fh->fh, filp); v4l2_fh_exit(&fh->fh); =20 atomic_dec(&mdev->access_ref); diff --git a/drivers/usb/gadget/function/uvc_v4l2.c b/drivers/usb/gadget/fu= nction/uvc_v4l2.c index 680f25d17dc2c7b99529441de8f079abe3b3411f..fd4b998ccd16058eb796dd31797= 1c0869f6bdeb8 100644 --- a/drivers/usb/gadget/function/uvc_v4l2.c +++ b/drivers/usb/gadget/function/uvc_v4l2.c @@ -692,8 +692,7 @@ uvc_v4l2_release(struct file *file) uvc_v4l2_disable(uvc); mutex_unlock(&video->mutex); =20 - file->private_data =3D NULL; - v4l2_fh_del(&handle->vfh); + v4l2_fh_del(&handle->vfh, file); v4l2_fh_exit(&handle->vfh); kfree(handle); =20 diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h index d8fcf49f10e09452b73499f4a9bd1285bc2835a5..5e4c761635120608e0b588e0b0d= af63e69588d38 100644 --- a/include/media/v4l2-fh.h +++ b/include/media/v4l2-fh.h @@ -114,12 +114,15 @@ int v4l2_fh_open(struct file *filp); * v4l2_fh_del - Remove file handle from the list of file handles. * * @fh: pointer to &struct v4l2_fh + * @filp: pointer to &struct file associated with @fh + * + * The function resets filp->private_data to NULL. * * .. note:: * Must be called in v4l2_file_operations->release\(\) handler if the d= river * uses &struct v4l2_fh. */ -void v4l2_fh_del(struct v4l2_fh *fh); +void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp); =20 /** * v4l2_fh_exit - Release resources related to a file handle. --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 4612B27054A; Sat, 2 Aug 2025 09:28:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126894; cv=none; b=TvxGUxuasdTd+2EuJLDmS4hvruxgSXZDVldHYQY+Z7QLiIaSYaWGNvnXJFfRoT9WC1QrsEO/U2kH584F68OjJzIV5ElTvMQce2O9Y813g4KtHfbxANMFZr9ryd+xUoPx8EzRwltniqzKwRGir41AnQJ8d32ilrKpbNK3E/XbUA0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126894; c=relaxed/simple; bh=50vYXEGhZeTzddTpY4VW3qqWt6o/oRzLVr9heRBb344=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=How0PajXaVLeqqpYvuskaVUjk461sTzdrdocWgKFXjqmbwHUqOtBrnD0bZ+xADMgIDSRdvgTNHQU8AU2HLVuhooXflUXoK81JOlZ3S2+vY5k+qPRTTZcFR9RN+RSdkI6MWiPtWppHKG14jmQLsHa2BzzVgvYGMCtwXEqVPDo3Lk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=bO9ZV45x; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="bO9ZV45x" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AE6443B8B; Sat, 2 Aug 2025 11:27:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126845; bh=50vYXEGhZeTzddTpY4VW3qqWt6o/oRzLVr9heRBb344=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bO9ZV45xEGgF6pwv4xOp/UHbDpRuyn3tsM5Ps8cKLkUxOwstVyEmE52BbRzyaxnPi RejLuvxRjfRvLuJdJHjNNrN9exsHVyD1VwXr3a55aLgI0Cc7LVsjh6E6VonxeaDjK6 ZFCSwB7kkcd7rfn+xRvUFNpPtTnXo2hQg3lcZ0EU= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:50 +0200 Subject: [PATCH 28/65] media: v4l2-ioctl: Access v4l2_fh from private_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-28-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6102; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=50vYXEGhZeTzddTpY4VW3qqWt6o/oRzLVr9heRBb344=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj6BS2OkLRIRXzaVdf/zNJM4Q4XKjnvniijd fboQzcTYIyJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+gAKCRByNAaPFqFW PFmQD/wOSAarhR1JioG20KiYPWKE7F1VDzwex19iOgZ3opz7/FURvUVDym7b666cyh2qCgiZgwH UptIgDpZRKRd949B8/ze4g0rQq9lEcIFAoTG6ELQzVXKlE4Xo1A1AywpEIuSDOqss2HguWiclXD xlkbmtDShmuRY8o79e9VNxhlDzDuYGgkXYcwTWTuYiKYmp1/x9HQq8XxdkJmIsB4jlkVIxsv+En Vys4x++KRGGfLo8TcaE48yyO7w/avATN3ZsZhHaEJ32Kp/0USpuNsgrNSrrH4BOvF88Ut3gVBVS 6wrvQqkiePkw95y4c7bN6bCoWdAsWxEvV91DhkHXO1q8K3q8hISLyJc8HKtlCruwfZmJJg44jQo T5ClGMTBO0xYbiL2e+Y/5zdGRR31dIKoS6ptm3CvqlQ/CbrguuS/Rfz/4Tb/36mMr/+fe9AyuZu x9BchltjTcciuZHQChHl+P+qI7bQTTo9EZJgoIw+xWyffKaCxVvRJGPuWtGslIb+dqcqJGY4f8q 8o42ieKDM8ILzrxk+neDKYp2tkMbesSWcUwpwP3kG084u+8ei9qJCbrkg1qBrLBgxloK9IuPKE0 yvbsJLuB1QptIUH2eYuA9guw/0Lr5vX6S9RUldh4Ki7dAAt7pk3mVT4S6neF9Fmhq5AlYtN/4Kr CkVxUsTH44vt4mg== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B Now that it is guaranteed that file->private_data is set to point to the 'struct v4l2_fh' initialised by v4l2_fh_add() the v4l2-ioctl layer can be modified to retrieve the v4l2_fh pointer from the file *. As the __video_do_ioctl() function, that calls all the handlers modified by this patch goes as: static long __video_do_ioctl(struct file *file, unsigned int cmd, void *arg) { void *fh =3D file->private_data; ... ret =3D info->func(ops, file, fh, arg); } This patch introduces no functional changes and makes it possible to remove in future the 'fh' argument to all ioctl handlers. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/v4l2-core/v4l2-ioctl.c | 46 ++++++++++++++++++++------------= ---- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core= /v4l2-ioctl.c index 8c81852c30466865eca36fd41923f6d05dbf9293..44c2f5ef3dae407d9786c5278d1= 3efc982be2ff0 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2297,8 +2297,8 @@ static int v4l_queryctrl(const struct v4l2_ioctl_ops = *ops, struct video_device *vfd =3D video_devdata(file); struct v4l2_query_ext_ctrl qec =3D {}; struct v4l2_queryctrl *p =3D arg; - struct v4l2_fh *vfh =3D - test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; + struct v4l2_fh *vfh =3D test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? + file_to_v4l2_fh(file) : NULL; int ret; =20 if (vfh && vfh->ctrl_handler) @@ -2322,8 +2322,8 @@ static int v4l_query_ext_ctrl(const struct v4l2_ioctl= _ops *ops, { struct video_device *vfd =3D video_devdata(file); struct v4l2_query_ext_ctrl *p =3D arg; - struct v4l2_fh *vfh =3D - test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; + struct v4l2_fh *vfh =3D test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? + file_to_v4l2_fh(file) : NULL; =20 if (vfh && vfh->ctrl_handler) return v4l2_query_ext_ctrl(vfh->ctrl_handler, p); @@ -2339,8 +2339,8 @@ static int v4l_querymenu(const struct v4l2_ioctl_ops = *ops, { struct video_device *vfd =3D video_devdata(file); struct v4l2_querymenu *p =3D arg; - struct v4l2_fh *vfh =3D - test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; + struct v4l2_fh *vfh =3D test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? + file_to_v4l2_fh(file) : NULL; =20 if (vfh && vfh->ctrl_handler) return v4l2_querymenu(vfh->ctrl_handler, p); @@ -2356,8 +2356,8 @@ static int v4l_g_ctrl(const struct v4l2_ioctl_ops *op= s, { struct video_device *vfd =3D video_devdata(file); struct v4l2_control *p =3D arg; - struct v4l2_fh *vfh =3D - test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; + struct v4l2_fh *vfh =3D test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? + file_to_v4l2_fh(file) : NULL; struct v4l2_ext_controls ctrls; struct v4l2_ext_control ctrl; =20 @@ -2388,8 +2388,8 @@ static int v4l_s_ctrl(const struct v4l2_ioctl_ops *op= s, { struct video_device *vfd =3D video_devdata(file); struct v4l2_control *p =3D arg; - struct v4l2_fh *vfh =3D - test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; + struct v4l2_fh *vfh =3D test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? + file_to_v4l2_fh(file) : NULL; struct v4l2_ext_controls ctrls; struct v4l2_ext_control ctrl; int ret; @@ -2418,8 +2418,8 @@ static int v4l_g_ext_ctrls(const struct v4l2_ioctl_op= s *ops, { struct video_device *vfd =3D video_devdata(file); struct v4l2_ext_controls *p =3D arg; - struct v4l2_fh *vfh =3D - test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; + struct v4l2_fh *vfh =3D test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? + file_to_v4l2_fh(file) : NULL; =20 p->error_idx =3D p->count; if (vfh && vfh->ctrl_handler) @@ -2439,8 +2439,8 @@ static int v4l_s_ext_ctrls(const struct v4l2_ioctl_op= s *ops, { struct video_device *vfd =3D video_devdata(file); struct v4l2_ext_controls *p =3D arg; - struct v4l2_fh *vfh =3D - test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; + struct v4l2_fh *vfh =3D test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? + file_to_v4l2_fh(file) : NULL; =20 p->error_idx =3D p->count; if (vfh && vfh->ctrl_handler) @@ -2460,8 +2460,8 @@ static int v4l_try_ext_ctrls(const struct v4l2_ioctl_= ops *ops, { struct video_device *vfd =3D video_devdata(file); struct v4l2_ext_controls *p =3D arg; - struct v4l2_fh *vfh =3D - test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL; + struct v4l2_fh *vfh =3D test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? + file_to_v4l2_fh(file) : NULL; =20 p->error_idx =3D p->count; if (vfh && vfh->ctrl_handler) @@ -2756,19 +2756,25 @@ static int v4l_dbg_g_chip_info(const struct v4l2_io= ctl_ops *ops, static int v4l_dqevent(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { - return v4l2_event_dequeue(fh, arg, file->f_flags & O_NONBLOCK); + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); + + return v4l2_event_dequeue(vfh, arg, file->f_flags & O_NONBLOCK); } =20 static int v4l_subscribe_event(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { - return ops->vidioc_subscribe_event(fh, arg); + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); + + return ops->vidioc_subscribe_event(vfh, arg); } =20 static int v4l_unsubscribe_event(const struct v4l2_ioctl_ops *ops, struct file *file, void *fh, void *arg) { - return ops->vidioc_unsubscribe_event(fh, arg); + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); + + return ops->vidioc_unsubscribe_event(vfh, arg); } =20 static int v4l_g_sliced_vbi_cap(const struct v4l2_ioctl_ops *ops, @@ -3072,7 +3078,7 @@ static long __video_do_ioctl(struct file *file, bool write_only =3D false; struct v4l2_ioctl_info default_info; const struct v4l2_ioctl_info *info; - void *fh =3D file->private_data; + void *fh =3D file_to_v4l2_fh(file); struct v4l2_fh *vfh =3D NULL; int dev_debug =3D vfd->dev_debug; long ret =3D -ENOTTY; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 B682A221723; Sat, 2 Aug 2025 09:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126905; cv=none; b=NXUGqiBRJDiz2oCwmJxHjA44yjJhzP9h44bJ5JRYaYYRt16cprw2ISLyvC4qSmnSzWdjMH1+tik8eLL3+h+w3EDmMg81MO/tVfyeRuCWj8eRadSn7DZg24pLBZiMb6Z/v/fvuhFyXwFAAb2NGJxbWPXGyrfsq5stGVfNTssiQqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126905; c=relaxed/simple; bh=EupQNZwVDEWPV0lRXOPIWwyqRXZFDT974pCYxdDmFr4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Wp7P9FuKzTOA/WsWfu6tVnRQ/Yk4jZdpqxfFGuidAZge5Y+Xiin7j8EV5ao9lU3JQkGRtkwRFmMpVzs+Ufs5TUFaAzTVXGEcSpsUjqyTpEEDzE08yXEJT+nxxuQwlz372tC/D4I6FbNbvbaNfcHaP9Ony95v+d/8x02V6QV8aDM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=hpY78Cmk; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hpY78Cmk" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A3DB13BFA; Sat, 2 Aug 2025 11:27:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126857; bh=EupQNZwVDEWPV0lRXOPIWwyqRXZFDT974pCYxdDmFr4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hpY78CmkVv74nSpWm7mIQCCiDoYD4+PYB95WVTP4W7eZHiEy+SV4qDjjuyt3l55ad Wo1Jomg7/kuakxont8Lj75UEoyxO/gXWRVep1Pym+B5WryRO5Bf/nqQHWEQxxF549z O+SKZiZJEXIhWbrbWhqqK7Mujk0z12AkXw6FIywc= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:51 +0200 Subject: [PATCH 29/65] media: allegro: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-29-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4042; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=EupQNZwVDEWPV0lRXOPIWwyqRXZFDT974pCYxdDmFr4=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj6938RTcCW3JLF7q2TU/zTQB1aW4uCXzbSl KRPGOpR5M2JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+gAKCRByNAaPFqFW PPEoEACtOVVZcE0Jno+wySkwxbtRcY7fcEkuzlP+5mpC4ISfqOV+gM1G/t+jhOBOQxI2V/sx6dj NffRk/kDtQ0yQ4OGn75YP9PwPU1u9Ho0ABWevDJPGYy5zNzO1Ho6BvS55kDKWQhWVZUBNHaX5q7 ydYl8Kklpn3uECXV2WO4sJhJcOUYT1yZ4VZ7O6wNgmZjaL+XavqFPr05yLv4ATGvhCQK1zttCLo ZuyM2KYvgb2RWYqOlshgBkBj6Ry5xxAPHBGJltaqSdAms5rji4stoNX+CGpKTz/eZCE1XaM8lec KfphPeP6gNXjr4erndbjbZ5ZG4SszKQ0+yLymE6Wdj+DQvrPjHGjJCx1xRLzDG4PzvA3ILsaB2E cmu6TARWAS4IXzftMkQ7UsHq3BLGTqd1B/BroBVisfe+SI5XaE8KQyW7YdgWWMUPmgD6IqaQ0D8 NG5HUaRIsNxYllVZYKG+EbXmU0cfD3ELrYPOBtInFkGy717UK1q8BcTX6XcC+G8qhbJZBsiGM6w SqUODvlIMVAPmeAe8idoPhTsaqG0rZJ6GHa13M4scN3OICYwSQoh2HrXwVz5Fs+X8Z993R2hRiR UuwCyI5NZ+aiwhmLknbWCncfbc/sPJStc5Q8ddqgjMoRv47AcoNqw7tZnQ+l3zMnhzdNFYcsO4x 6BSqqLyKW3RHXBA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it remove the only left user of fh_to_channel() and remove the macro completely. Signed-off-by: Jacopo Mondi --- drivers/media/platform/allegro-dvt/allegro-core.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/me= dia/platform/allegro-dvt/allegro-core.c index 5e3b1f5d7206d84b8ccb9ea3b3f3f1fe75becf99..81c6afcf2d06f9e39015e49d355= 346238c5033d8 100644 --- a/drivers/media/platform/allegro-dvt/allegro-core.c +++ b/drivers/media/platform/allegro-dvt/allegro-core.c @@ -197,8 +197,6 @@ static const struct regmap_config allegro_sram_config = =3D { .cache_type =3D REGCACHE_NONE, }; =20 -#define fh_to_channel(__fh) container_of(__fh, struct allegro_channel, fh) - struct allegro_channel { struct allegro_dev *dev; struct v4l2_fh fh; @@ -3284,7 +3282,7 @@ static int allegro_enum_fmt_vid(struct file *file, vo= id *fh, static int allegro_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); =20 f->fmt.pix.field =3D V4L2_FIELD_NONE; f->fmt.pix.width =3D channel->width; @@ -3326,7 +3324,7 @@ static int allegro_try_fmt_vid_cap(struct file *file,= void *fh, static int allegro_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); struct vb2_queue *vq; int err; =20 @@ -3350,7 +3348,7 @@ static int allegro_s_fmt_vid_cap(struct file *file, v= oid *fh, static int allegro_g_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *f) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); =20 f->fmt.pix.field =3D V4L2_FIELD_NONE; =20 @@ -3397,7 +3395,7 @@ static int allegro_try_fmt_vid_out(struct file *file,= void *fh, static int allegro_s_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *f) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); int err; =20 err =3D allegro_try_fmt_vid_out(file, fh, f); @@ -3438,7 +3436,7 @@ static int allegro_channel_cmd_start(struct allegro_c= hannel *channel) static int allegro_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd *cmd) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); int err; =20 err =3D v4l2_m2m_ioctl_try_encoder_cmd(file, fh, cmd); @@ -3488,7 +3486,7 @@ static int allegro_ioctl_streamon(struct file *file, = void *priv, enum v4l2_buf_type type) { struct v4l2_fh *fh =3D file_to_v4l2_fh(file); - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); int err; =20 if (type =3D=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) { @@ -3503,7 +3501,7 @@ static int allegro_ioctl_streamon(struct file *file, = void *priv, static int allegro_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); struct v4l2_fract *timeperframe; =20 if (a->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) @@ -3520,7 +3518,7 @@ static int allegro_g_parm(struct file *file, void *fh, static int allegro_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); struct v4l2_fract *timeperframe; int div; =20 --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 BC5F123E338; Sat, 2 Aug 2025 09:28:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126915; cv=none; b=KWywctM5BJI3vENg4jKh5/Zp4s3MJiMcby6rhdN+hOSCtZN/tUEx1pcKXr/7sBzsGb1sLwYsPFBNR5hSax1vnunfTZ+7bwNSjiRTJN0L0b/OpdTWZSNsc7Nz30O8rwm+AUnyi8GJXkaMClsuT6Db4zObW/4sm07KBx4aJPvdhw0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126915; c=relaxed/simple; bh=T3nnvKTfBwctCb2KRCzrOOTSYhCcGLTV59+/l2e0jic=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ISvSBxYnV838X2rbhhNoWdhakZbk3UWEK92sFA8+qdUAY+qiLRowvKtq2vxk/EfN/oBVftYIoOUVdZvkQwEmqgE+0Gs/O2ZYuDqillnzKjkUVXYNvYIT8mAhME1pBvNXzXE01FRJtFw6nZ40stxjvWY/vRQGZp4SSimn9Kd/2LI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Dkkumh4L; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Dkkumh4L" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 876C73C5C; Sat, 2 Aug 2025 11:27:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126867; bh=T3nnvKTfBwctCb2KRCzrOOTSYhCcGLTV59+/l2e0jic=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Dkkumh4LvxiuD8hNn3xqAjWcNyloSHLSyCVxEPeN03ejtzn2UG2VxVNhAnRssFn5b F2/F6FTzFRh9zHyOicYH+CITNw2ZAfi/45abmodAsDOnwXOXQkS8HI/S/Tn7OIRfWQ pXWkRYmhrYm2juFG6mt5ZWW34am6MecwMRht3TvU= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:52 +0200 Subject: [PATCH 30/65] media: meson-ge2d: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-30-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2933; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=T3nnvKTfBwctCb2KRCzrOOTSYhCcGLTV59+/l2e0jic=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj7Fyaa+k6kJNktEpScDTtiWPy/zaeBwHz9r DJi8voptXKJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+wAKCRByNAaPFqFW PKVRD/9hNjf7I/ZFLIZiasLup5gsgyNwUHVXZkHcmovAL8TIvnofdZ5VhpAM3eJ++8/l9qxMSuE MXKsXSR9XFbtftKtXz4+Y1tvz1FJ79z64WHGMs0xneU5nu2CpLKfX8ZvYAEKy58fxuSIHHSLLX0 hWA9E5Fa7k7kpVg4KT9CBQm2zTWNGW9Ucy6Pjt8HofFZT82URpYm6/fVN1NtXpbxqwV2unaH27Z oZOtB6292Z/G5zI8p4nl8eeeYxXn8egPLXef91fozHfsAdabGC/yL+Z5sWeOAGKv9D5s36TUoFQ w/lxJXYhMlOSk5+Q5WYei14Z/iOhIb6lbVl7JMQTaEIwgHpcBoodDYNyP3Z6Mnu8yc53Kj/FD6X razFUGu3uX1tU0YKS/TVeN2DYYJHlDUdDyvHf0Q+4z2LW1WWWpflBIncqJcoJarL8aeqsmJwDrU E8e4biI29YK7NJRZQ31JDbhuVIuwBjoYzkSOYA9bI+E0ftdCi+f0uGW9qiy/caNDTeXipY7xKTt zP3Uu36adc8AcaxdNLQtKM7zr7fCg/ssFemih19ULbECnJCfI85T8acrRKM4Z6OGo0iNB5jksc+ JPboZIQKZLhoLoTqDOBdSIg3MEs1Jh69sAhZu6nnVAT3asyNA/WNjkgnPPP4IYjOb2kxH08TA7Y VEIR3oTqjNmorVQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c b/drivers/med= ia/platform/amlogic/meson-ge2d/ge2d.c index b1b0b6535fb1931c74ae9b2da28bea579cd1bc4c..5744853a40035e9973e605dd3ff= ec508641470f2 100644 --- a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c +++ b/drivers/media/platform/amlogic/meson-ge2d/ge2d.c @@ -457,7 +457,7 @@ static int vidioc_enum_fmt(struct file *file, void *pri= v, struct v4l2_fmtdesc *f static int vidioc_g_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct ge2d_ctx *ctx =3D priv; + struct ge2d_ctx *ctx =3D file_to_ge2d_ctx(file); struct ge2d_frame *f; bool use_frame =3D false; =20 @@ -507,7 +507,7 @@ static int vidioc_g_selection(struct file *file, void *= priv, static int vidioc_s_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct ge2d_ctx *ctx =3D priv; + struct ge2d_ctx *ctx =3D file_to_ge2d_ctx(file); struct meson_ge2d *ge2d =3D ctx->ge2d; struct ge2d_frame *f; int ret =3D 0; @@ -574,8 +574,8 @@ static void vidioc_setup_cap_fmt(struct ge2d_ctx *ctx, = struct v4l2_pix_format *f =20 static int vidioc_try_fmt_cap(struct file *file, void *priv, struct v4l2_f= ormat *f) { + struct ge2d_ctx *ctx =3D file_to_ge2d_ctx(file); const struct ge2d_fmt *fmt =3D find_fmt(f); - struct ge2d_ctx *ctx =3D priv; struct v4l2_pix_format fmt_cap; =20 vidioc_setup_cap_fmt(ctx, &fmt_cap); @@ -595,7 +595,7 @@ static int vidioc_try_fmt_cap(struct file *file, void *= priv, struct v4l2_format =20 static int vidioc_s_fmt_cap(struct file *file, void *priv, struct v4l2_for= mat *f) { - struct ge2d_ctx *ctx =3D priv; + struct ge2d_ctx *ctx =3D file_to_ge2d_ctx(file); struct meson_ge2d *ge2d =3D ctx->ge2d; struct vb2_queue *vq; struct ge2d_frame *frm; @@ -631,7 +631,7 @@ static int vidioc_s_fmt_cap(struct file *file, void *pr= iv, struct v4l2_format *f =20 static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format = *f) { - struct ge2d_ctx *ctx =3D priv; + struct ge2d_ctx *ctx =3D file_to_ge2d_ctx(file); struct vb2_queue *vq; struct ge2d_frame *frm; =20 @@ -670,7 +670,7 @@ static int vidioc_try_fmt_out(struct file *file, void *= priv, struct v4l2_format =20 static int vidioc_s_fmt_out(struct file *file, void *priv, struct v4l2_for= mat *f) { - struct ge2d_ctx *ctx =3D priv; + struct ge2d_ctx *ctx =3D file_to_ge2d_ctx(file); struct meson_ge2d *ge2d =3D ctx->ge2d; struct vb2_queue *vq; struct ge2d_frame *frm, *frm_cap; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 0CCE5221F39; Sat, 2 Aug 2025 09:28:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126925; cv=none; b=KxWgnI5q+uJhMLbC7St4fIW45pmbGYSI4UUQFJVg+84SLVzonbHEKQTG0qy4qSxZoJaVQ7PN9YgmETaPaefm/wm7PDYj9MuxajRAia5Qd9nfgMWdXy+Xf4YPnEoc08ofGqoCrBDmweqN72bHk8WUaozS1GsqhtnxQrYkA1E5iHA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126925; c=relaxed/simple; bh=TlJ3vfBE6eOXaSzRlSNwTu3lbTFE43IxxanDcdfmWg0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GPwDK9H3VrXEpXLVeBPE2zerb6YHz1z13K7yZvkSdR9KAVuP31ChDuI2pci+j6sr0UWmXSvBfkPYlGDmeujfWQT7dm3kap9b+Zb1u8G6vajmzsVVRgZzd9hfNQofwmTam04JerG/B7YBbuJ5KioCdEa5seZzzKGR4mTU1VJy0Jg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=duA3dJ50; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="duA3dJ50" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 645743C5B; Sat, 2 Aug 2025 11:27:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126876; bh=TlJ3vfBE6eOXaSzRlSNwTu3lbTFE43IxxanDcdfmWg0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=duA3dJ50CGqSubEiUb6tH6brol9dIsXMNSvO5O1wlKHkbM+t1cYXYoYHvBjqEVQAU 6T1vr8defZLDQwNlsGvBZefSOJNBplJQwBGAtvnWmJFpJVKgGIuG4A95kPSRxfhFj0 VVyGPA3wQV5hmg0owRykgfvRnsuwd0UOntPRaAk0= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:53 +0200 Subject: [PATCH 31/65] media: coda: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-31-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7087; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=TlJ3vfBE6eOXaSzRlSNwTu3lbTFE43IxxanDcdfmWg0=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj7+KFlHPr1a0isCkNZoxK5D1IytunS6QznA Xx0PkUP/LeJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+wAKCRByNAaPFqFW PMEgD/4oWPtUHoRU6cbURgatIsy/ggO5IP5Eby7JaGzgNGqFvbfVZBfBsvDvSk0XId2Yf6AKLaS +FnRBa487AwS51rHE8fKzm3XDGnBJoVM4HfBTvt7MRRtyjJtWkwz9n6drkQCgqwHre/wM1QeZ7g CKdpnv3dwheDBseF0afNkwkXfaSuK5Zxhv3bQDQjEmA+LcxstpnzmxIrDVGnjzIx2ny3t1jXc5d iWlUbuGhe76FyZFlBx1AwZxWRWGDXCdZWYPgaSJl4uK2nyOufJh+11XC3vPJ1ZOJiEd+MU3Kwa9 uqKFs4IJYj5LqufRjjiFOJI2vh8LGRztTEiMrIZtpBAIYFffQeJvrqX/OYHA62UPzzhHZNOcNQn ihlqj30ly755JApJzOsKzNqHKR8R5O+L6btO4Os2yfBAHOc8hRP7ixaXaizgcAyUiTzH9h2qoBO P5vnAw3fGKJzlvn0KLjeBwFS5Ns/r3FlUap2KSGwjVPs6IWAn7xuSwiDhbHpvhDRvcn/6yMyB4U Q+VLMIRK/oMhvdkTNeQ+c/w4rvt7rnFpwlVIoMHlmQST3eR+hUSY6reLy4f2bShB6sCRz2CFyDC Jz5Z1jNqk3XX477veKLSaJth6f34LbD8yLZ9w5wn/6+xHIh56leHJqnoJ7OLe8iwOqOAIny23Ow KRl8vbIQCATC15A== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- .../media/platform/chips-media/coda/coda-common.c | 36 +++++++++++-------= ---- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/chips-media/coda/coda-common.c b/driver= s/media/platform/chips-media/coda/coda-common.c index a27d5a261a27fb78d4c7ca008146780698386333..a10576f702127ba6014799e7d31= 90c2785afd2a2 100644 --- a/drivers/media/platform/chips-media/coda/coda-common.c +++ b/drivers/media/platform/chips-media/coda/coda-common.c @@ -427,7 +427,7 @@ static struct vdoa_data *coda_get_vdoa_data(void) static int coda_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct coda_ctx *ctx =3D fh_to_ctx(priv); + struct coda_ctx *ctx =3D file_to_ctx(file); =20 strscpy(cap->driver, CODA_NAME, sizeof(cap->driver)); strscpy(cap->card, coda_product_name(ctx->dev->devtype->product), @@ -447,7 +447,7 @@ static int coda_enum_fmt(struct file *file, void *priv, { struct video_device *vdev =3D video_devdata(file); const struct coda_video_device *cvd =3D to_coda_video_device(vdev); - struct coda_ctx *ctx =3D fh_to_ctx(priv); + struct coda_ctx *ctx =3D file_to_ctx(file); const u32 *formats; =20 if (f->type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) @@ -497,7 +497,7 @@ static int coda_g_fmt(struct file *file, void *priv, struct v4l2_format *f) { struct coda_q_data *q_data; - struct coda_ctx *ctx =3D fh_to_ctx(priv); + struct coda_ctx *ctx =3D file_to_ctx(file); =20 q_data =3D get_q_data(ctx, f->type); if (!q_data) @@ -658,7 +658,7 @@ static int coda_try_fmt(struct coda_ctx *ctx, const str= uct coda_codec *codec, static int coda_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { - struct coda_ctx *ctx =3D fh_to_ctx(priv); + struct coda_ctx *ctx =3D file_to_ctx(file); const struct coda_q_data *q_data_src; const struct coda_codec *codec; struct vb2_queue *src_vq; @@ -764,7 +764,7 @@ static void coda_set_default_colorspace(struct v4l2_pix= _format *fmt) static int coda_try_fmt_vid_out(struct file *file, void *priv, struct v4l2_format *f) { - struct coda_ctx *ctx =3D fh_to_ctx(priv); + struct coda_ctx *ctx =3D file_to_ctx(file); struct coda_dev *dev =3D ctx->dev; const struct coda_q_data *q_data_dst; const struct coda_codec *codec; @@ -858,7 +858,7 @@ static int coda_s_fmt(struct coda_ctx *ctx, struct v4l2= _format *f, static int coda_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { - struct coda_ctx *ctx =3D fh_to_ctx(priv); + struct coda_ctx *ctx =3D file_to_ctx(file); struct coda_q_data *q_data_src; const struct coda_codec *codec; struct v4l2_rect r; @@ -910,7 +910,7 @@ static int coda_s_fmt_vid_cap(struct file *file, void *= priv, static int coda_s_fmt_vid_out(struct file *file, void *priv, struct v4l2_format *f) { - struct coda_ctx *ctx =3D fh_to_ctx(priv); + struct coda_ctx *ctx =3D file_to_ctx(file); const struct coda_codec *codec; struct v4l2_format f_cap; struct vb2_queue *dst_vq; @@ -966,7 +966,7 @@ static int coda_s_fmt_vid_out(struct file *file, void *= priv, static int coda_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *rb) { - struct coda_ctx *ctx =3D fh_to_ctx(priv); + struct coda_ctx *ctx =3D file_to_ctx(file); int ret; =20 ret =3D v4l2_m2m_reqbufs(file, ctx->fh.m2m_ctx, rb); @@ -986,7 +986,7 @@ static int coda_reqbufs(struct file *file, void *priv, static int coda_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) { - struct coda_ctx *ctx =3D fh_to_ctx(priv); + struct coda_ctx *ctx =3D file_to_ctx(file); =20 if (ctx->inst_type =3D=3D CODA_INST_DECODER && buf->type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) @@ -997,7 +997,7 @@ static int coda_qbuf(struct file *file, void *priv, =20 static int coda_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b= uf) { - struct coda_ctx *ctx =3D fh_to_ctx(priv); + struct coda_ctx *ctx =3D file_to_ctx(file); int ret; =20 ret =3D v4l2_m2m_dqbuf(file, ctx->fh.m2m_ctx, buf); @@ -1025,7 +1025,7 @@ void coda_m2m_buf_done(struct coda_ctx *ctx, struct v= b2_v4l2_buffer *buf, static int coda_g_selection(struct file *file, void *fh, struct v4l2_selection *s) { - struct coda_ctx *ctx =3D fh_to_ctx(fh); + struct coda_ctx *ctx =3D file_to_ctx(file); struct coda_q_data *q_data; struct v4l2_rect r, *rsel; =20 @@ -1071,7 +1071,7 @@ static int coda_g_selection(struct file *file, void *= fh, static int coda_s_selection(struct file *file, void *fh, struct v4l2_selection *s) { - struct coda_ctx *ctx =3D fh_to_ctx(fh); + struct coda_ctx *ctx =3D file_to_ctx(file); struct coda_q_data *q_data; =20 switch (s->target) { @@ -1126,7 +1126,7 @@ static void coda_wake_up_capture_queue(struct coda_ct= x *ctx) static int coda_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd *ec) { - struct coda_ctx *ctx =3D fh_to_ctx(fh); + struct coda_ctx *ctx =3D file_to_ctx(file); struct vb2_v4l2_buffer *buf; int ret; =20 @@ -1207,7 +1207,7 @@ static bool coda_mark_last_dst_buf(struct coda_ctx *c= tx) static int coda_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *dc) { - struct coda_ctx *ctx =3D fh_to_ctx(fh); + struct coda_ctx *ctx =3D file_to_ctx(file); struct coda_dev *dev =3D ctx->dev; struct vb2_v4l2_buffer *buf; struct vb2_queue *dst_vq; @@ -1286,7 +1286,7 @@ static int coda_decoder_cmd(struct file *file, void *= fh, static int coda_enum_framesizes(struct file *file, void *fh, struct v4l2_frmsizeenum *fsize) { - struct coda_ctx *ctx =3D fh_to_ctx(fh); + struct coda_ctx *ctx =3D file_to_ctx(file); struct coda_q_data *q_data_dst; const struct coda_codec *codec; =20 @@ -1319,7 +1319,7 @@ static int coda_enum_framesizes(struct file *file, vo= id *fh, static int coda_enum_frameintervals(struct file *file, void *fh, struct v4l2_frmivalenum *f) { - struct coda_ctx *ctx =3D fh_to_ctx(fh); + struct coda_ctx *ctx =3D file_to_ctx(file); struct coda_q_data *q_data; const struct coda_codec *codec; =20 @@ -1358,7 +1358,7 @@ static int coda_enum_frameintervals(struct file *file= , void *fh, =20 static int coda_g_parm(struct file *file, void *fh, struct v4l2_streamparm= *a) { - struct coda_ctx *ctx =3D fh_to_ctx(fh); + struct coda_ctx *ctx =3D file_to_ctx(file); struct v4l2_fract *tpf; =20 if (a->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) @@ -1441,7 +1441,7 @@ static uint32_t coda_timeperframe_to_frate(struct v4l= 2_fract *timeperframe) =20 static int coda_s_parm(struct file *file, void *fh, struct v4l2_streamparm= *a) { - struct coda_ctx *ctx =3D fh_to_ctx(fh); + struct coda_ctx *ctx =3D file_to_ctx(file); struct v4l2_fract *tpf; =20 if (a->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 1D914221F39; Sat, 2 Aug 2025 09:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126933; cv=none; b=Fh/rBD0tJpL6R9U0jemm3SWL7J+JsPN4+o+4sFwp3hlPATLkY91nwCSGhAkqLXUP0UIiOH3+k6mNcPB1Sra+i/RDa3MCbsZU3NycMXsjWZS1sMRJvWDt5tPeVn5GXEWMN6Yfd29A/Jo9uSwzf1kTNFcSnSevCrMrHWkP8uH8xEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126933; c=relaxed/simple; bh=uvJNgedmjfRxRB2KK4uHDM5CEa3owfvsuNtv/dXg1mo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X5X5jz0HVlakW/Yi+WUiHJLXdqUBWjkdefxcEml/lFeY2tCZArdYNav358Y5bl5XnSQGtnHjmXCOGX1ICFrwygXVEmi/1+TnQHjLIagKcBUx27CT/IBfc343F/IP85C5rp4RQE8sdXt2WR3P4+dlkMEyEnRGSrxDroYizBNl8gQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=OBeOdY71; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="OBeOdY71" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 526283C59; Sat, 2 Aug 2025 11:27:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126884; bh=uvJNgedmjfRxRB2KK4uHDM5CEa3owfvsuNtv/dXg1mo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OBeOdY71KXuivBYjHPJgVimqGpuOLlDp9yx3lDomohHUG5a7oNWQ0hvXoW69O0kNS NYAx54HROgkP695bPQtJ6+Ecd/T7MLt4bvONc/Y0dZA46ll9Mm2L78xgrOkpmJ6k0A 8PHaFKCiNki5tve7zAVZ45WyVeGD7Vm3ILrEKz8E= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:54 +0200 Subject: [PATCH 32/65] media: wave5: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-32-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=10324; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=uvJNgedmjfRxRB2KK4uHDM5CEa3owfvsuNtv/dXg1mo=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj7S/3Fw9ygciMykqOxZ3oq/ihDfFUViWqKi 5ekTs5Vd8+JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+wAKCRByNAaPFqFW POEiEAC74ewm4UwRerFfJAL8tK4Q4dfsUPWoOIltfCRNJ1oWZqybDtlPV8YdYeLQyI11uX/Y0Qd 3gtrtoMmI8vcaJUptDw6CuyJeboT6CzFR2Tt2KELXHeOLzjUIh8ZT+teCZq9OZcrjtWXHjkD2Ny 4vwfiGJ1pPmbrsNVWLGrxqn8cxwJGATdHC3ErwAUIJ3avwjcBz0yoGnAjGaMA+D5DXNmLEZZWzb 3R3Ud12Gqonq3xtBR8CGHFcBvZeNcPORqEEzJJza4FalTw2nGr65CohPNq3D0VZDOkRHir+qYTX XG23CyC/G4jYE1NDrbeTkGYe/iodpC+m6up/5gupugz/DlzBunaRa+tcXzKtfQ+sNZaZx2lpFq2 5pY45Vh2WLgNv1Xr+q76rvA3O1/Bn/Io4Zv+A7C5j8wXQNQfWpK2j8GKyCJ8aW3e2jR/irOrLF6 dARDLFGe3XP6LFU5Y4XqKwPczmTfxyHekKMxO0DssGbUttMuqE1qMGb0s336UeYPtPRyWcy7KDk T3uhKRB6h6VVTLmxsyaCUwh3KJlVjLNUcVQWzZ2c9xMlt5mHgGTH7Up6OYnBtk9UCjyv/PDbF8Q 1ETZeraVs8AOHlUnD6RRH7+nlH6yptXdMTIVT5IwSeOOFouJa78kh1G9qXzpu8F3CmG3mrdVdAT co8wEuknSM/h/VA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- .../platform/chips-media/wave5/wave5-helper.c | 2 +- .../platform/chips-media/wave5/wave5-vpu-dec.c | 18 ++++++++-------- .../platform/chips-media/wave5/wave5-vpu-enc.c | 24 +++++++++++-------= ---- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/media/platform/chips-media/wave5/wave5-helper.c b/driv= ers/media/platform/chips-media/wave5/wave5-helper.c index 0bce62f0c03902ae367182ee04774c79accc4712..f03ad9c0de2215794b2456c3965= 2785fff236966 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-helper.c +++ b/drivers/media/platform/chips-media/wave5/wave5-helper.c @@ -142,7 +142,7 @@ int wave5_vpu_subscribe_event(struct v4l2_fh *fh, const= struct v4l2_event_subscr =20 int wave5_vpu_g_fmt_out(struct file *file, void *fh, struct v4l2_format *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); int i; =20 f->fmt.pix_mp.width =3D inst->src_fmt.width; diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c b/dri= vers/media/platform/chips-media/wave5/wave5-vpu-dec.c index 88eb933a51448788373775e423ae2ac5042cf8b6..72af0faa3ef2e6fb83749044eb9= 1a58f39a3a986 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c @@ -506,7 +506,7 @@ static int wave5_vpu_dec_enum_fmt_cap(struct file *file= , void *fh, struct v4l2_f =20 static int wave5_vpu_dec_try_fmt_cap(struct file *file, void *fh, struct v= 4l2_format *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); struct dec_info *p_dec_info =3D &inst->codec_info->dec_info; const struct v4l2_frmsize_stepwise *frmsize; const struct vpu_format *vpu_fmt; @@ -547,7 +547,7 @@ static int wave5_vpu_dec_try_fmt_cap(struct file *file,= void *fh, struct v4l2_fo =20 static int wave5_vpu_dec_s_fmt_cap(struct file *file, void *fh, struct v4l= 2_format *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); int i, ret; =20 dev_dbg(inst->dev->dev, @@ -606,7 +606,7 @@ static int wave5_vpu_dec_s_fmt_cap(struct file *file, v= oid *fh, struct v4l2_form =20 static int wave5_vpu_dec_g_fmt_cap(struct file *file, void *fh, struct v4l= 2_format *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); int i; =20 f->fmt.pix_mp.width =3D inst->dst_fmt.width; @@ -630,7 +630,7 @@ static int wave5_vpu_dec_g_fmt_cap(struct file *file, v= oid *fh, struct v4l2_form =20 static int wave5_vpu_dec_enum_fmt_out(struct file *file, void *fh, struct = v4l2_fmtdesc *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); const struct vpu_format *vpu_fmt; =20 dev_dbg(inst->dev->dev, "%s: index: %u\n", __func__, f->index); @@ -647,7 +647,7 @@ static int wave5_vpu_dec_enum_fmt_out(struct file *file= , void *fh, struct v4l2_f =20 static int wave5_vpu_dec_try_fmt_out(struct file *file, void *fh, struct v= 4l2_format *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); const struct v4l2_frmsize_stepwise *frmsize; const struct vpu_format *vpu_fmt; int width, height; @@ -678,7 +678,7 @@ static int wave5_vpu_dec_try_fmt_out(struct file *file,= void *fh, struct v4l2_fo =20 static int wave5_vpu_dec_s_fmt_out(struct file *file, void *fh, struct v4l= 2_format *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); const struct vpu_format *vpu_fmt; int i, ret; =20 @@ -727,7 +727,7 @@ static int wave5_vpu_dec_s_fmt_out(struct file *file, v= oid *fh, struct v4l2_form =20 static int wave5_vpu_dec_g_selection(struct file *file, void *fh, struct v= 4l2_selection *s) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); =20 dev_dbg(inst->dev->dev, "%s: type: %u | target: %u\n", __func__, s->type,= s->target); =20 @@ -761,7 +761,7 @@ static int wave5_vpu_dec_g_selection(struct file *file,= void *fh, struct v4l2_se =20 static int wave5_vpu_dec_s_selection(struct file *file, void *fh, struct v= 4l2_selection *s) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; @@ -872,7 +872,7 @@ static int wave5_vpu_dec_start(struct vpu_instance *ins= t) =20 static int wave5_vpu_dec_decoder_cmd(struct file *file, void *fh, struct v= 4l2_decoder_cmd *dc) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); struct v4l2_m2m_ctx *m2m_ctx =3D inst->v4l2_fh.m2m_ctx; int ret; =20 diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/dri= vers/media/platform/chips-media/wave5/wave5-vpu-enc.c index 322c1498758a0a569eb94cab0d6612ce18cd4c7b..279f23e1304a9e47e31c9a0bdd0= efbf4c18622e1 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c @@ -360,7 +360,7 @@ static int wave5_vpu_enc_enum_framesizes(struct file *f= , void *fh, struct v4l2_f =20 static int wave5_vpu_enc_enum_fmt_cap(struct file *file, void *fh, struct = v4l2_fmtdesc *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); const struct vpu_format *vpu_fmt; =20 dev_dbg(inst->dev->dev, "%s: index: %u\n", __func__, f->index); @@ -377,7 +377,7 @@ static int wave5_vpu_enc_enum_fmt_cap(struct file *file= , void *fh, struct v4l2_f =20 static int wave5_vpu_enc_try_fmt_cap(struct file *file, void *fh, struct v= 4l2_format *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); const struct v4l2_frmsize_stepwise *frmsize; const struct vpu_format *vpu_fmt; int width, height; @@ -411,7 +411,7 @@ static int wave5_vpu_enc_try_fmt_cap(struct file *file,= void *fh, struct v4l2_fo =20 static int wave5_vpu_enc_s_fmt_cap(struct file *file, void *fh, struct v4l= 2_format *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); int i, ret; =20 dev_dbg(inst->dev->dev, "%s: fourcc: %u width: %u height: %u num_planes: = %u field: %u\n", @@ -445,7 +445,7 @@ static int wave5_vpu_enc_s_fmt_cap(struct file *file, v= oid *fh, struct v4l2_form =20 static int wave5_vpu_enc_g_fmt_cap(struct file *file, void *fh, struct v4l= 2_format *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); int i; =20 f->fmt.pix_mp.width =3D inst->dst_fmt.width; @@ -469,7 +469,7 @@ static int wave5_vpu_enc_g_fmt_cap(struct file *file, v= oid *fh, struct v4l2_form =20 static int wave5_vpu_enc_enum_fmt_out(struct file *file, void *fh, struct = v4l2_fmtdesc *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); const struct vpu_format *vpu_fmt; =20 dev_dbg(inst->dev->dev, "%s: index: %u\n", __func__, f->index); @@ -486,7 +486,7 @@ static int wave5_vpu_enc_enum_fmt_out(struct file *file= , void *fh, struct v4l2_f =20 static int wave5_vpu_enc_try_fmt_out(struct file *file, void *fh, struct v= 4l2_format *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); const struct v4l2_frmsize_stepwise *frmsize; const struct vpu_format *vpu_fmt; int width, height; @@ -515,7 +515,7 @@ static int wave5_vpu_enc_try_fmt_out(struct file *file,= void *fh, struct v4l2_fo =20 static int wave5_vpu_enc_s_fmt_out(struct file *file, void *fh, struct v4l= 2_format *f) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); const struct vpu_format *vpu_fmt; const struct v4l2_format_info *info; int i, ret; @@ -576,7 +576,7 @@ static int wave5_vpu_enc_s_fmt_out(struct file *file, v= oid *fh, struct v4l2_form =20 static int wave5_vpu_enc_g_selection(struct file *file, void *fh, struct v= 4l2_selection *s) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); =20 dev_dbg(inst->dev->dev, "%s: type: %u | target: %u\n", __func__, s->type,= s->target); =20 @@ -605,7 +605,7 @@ static int wave5_vpu_enc_g_selection(struct file *file,= void *fh, struct v4l2_se =20 static int wave5_vpu_enc_s_selection(struct file *file, void *fh, struct v= 4l2_selection *s) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) return -EINVAL; @@ -628,7 +628,7 @@ static int wave5_vpu_enc_s_selection(struct file *file,= void *fh, struct v4l2_se =20 static int wave5_vpu_enc_encoder_cmd(struct file *file, void *fh, struct v= 4l2_encoder_cmd *ec) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); struct v4l2_m2m_ctx *m2m_ctx =3D inst->v4l2_fh.m2m_ctx; int ret; =20 @@ -661,7 +661,7 @@ static int wave5_vpu_enc_encoder_cmd(struct file *file,= void *fh, struct v4l2_en =20 static int wave5_vpu_enc_g_parm(struct file *file, void *fh, struct v4l2_s= treamparm *a) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); =20 dev_dbg(inst->dev->dev, "%s: type: %u\n", __func__, a->type); =20 @@ -681,7 +681,7 @@ static int wave5_vpu_enc_g_parm(struct file *file, void= *fh, struct v4l2_streamp =20 static int wave5_vpu_enc_s_parm(struct file *file, void *fh, struct v4l2_s= treamparm *a) { - struct vpu_instance *inst =3D wave5_to_vpu_inst(fh); + struct vpu_instance *inst =3D file_to_vpu_inst(file); =20 dev_dbg(inst->dev->dev, "%s: type: %u\n", __func__, a->type); =20 --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 47F2D241CA2; Sat, 2 Aug 2025 09:28:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126941; cv=none; b=TV1RkqvgMVjDuYyW8Nt94N3rn0Q+TeWijnq+FwxJIUHXafFSJpUUHruIONbZKpcrKIoEhMro5lKl8jNTU0ck9IPD56agIGJWC54Vyjps0yYVYLx0HSsm+tKpv14DI4teUFPewwJRl57fTOR/y/ab4eqL88mL8pgQ3p86V2wpv8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126941; c=relaxed/simple; bh=41vTx83z/Uwja6XVkgBfBZsgFkv9BjK18LAN6EVk9C4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=McvdJB2ao4CYXY4RSYIJRxQcL9tPW2/x9SjTuupUqtxPhA1TIXDHUis6jhNnkfgQAkXLiCbyvELUSyQWejaRi5NCwVPDALfuG4/sIjkY5Vf+JLA9gn2gzHeeLvzIj1ziuUXavjd4VLdlicmNPp2DYNqU7x0YJnlsI8Q6kArMs14= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=pVvNcAun; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="pVvNcAun" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8152C3C67; Sat, 2 Aug 2025 11:28:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126893; bh=41vTx83z/Uwja6XVkgBfBZsgFkv9BjK18LAN6EVk9C4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pVvNcAuntI593b3+8JOouhdzGDFt2tmHaE57Nr/H0+gti/BMJpEEIFHA5+uFfKKEi /TinR7qedy9WiH2jyXomKJZiyq8x2qshMpdc2vFlrCpho2CEsAjd95XWFp6F9VNkLH qOhagXfR5W5AHnPYjhQSxrZyg7F3cCClyLs7v+n8= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:55 +0200 Subject: [PATCH 33/65] media: m2m-deinterlace: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-33-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2772; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=41vTx83z/Uwja6XVkgBfBZsgFkv9BjK18LAN6EVk9C4=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj7pwyrSBi9rnZ2weNb65Z8p51fNTUj4IIin TQAaww2RVaJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+wAKCRByNAaPFqFW PAMDD/9Ug9QwsOwqd/AgPzEvnOkucjAOnVc54Ut2Iym9meadtfaDDV1mc7FXlnf4QLXhPrr78BW mpb135tIptu5FHRKG7ysZfYALCQMddnU3UUQx0/gn5ZIZ5zPK4m9roV/TBUt4NtkFNAEaGV8NLQ 9FEY9ol3rYLDbWKjxpoZe+VhhCMaZiOBw5yagf67MDewREcw+UUrbGSHW4ru40PKZciqbc/vj0e nQfpCOMoiEF91JYrkF/d2z0t/W67gr7LDYsHVhwa/juCbCz2Wu5KQFwJkwZkJNSo2XbrEJdiJ4w jnU91qYWYQryas5efYVfY85hlacIcp74d7FCyJCPUdYt8NZ/hyYn8/VfC6qTgKHjcL/9vUZ3uu+ H32Q5uHhBqaFOo33iNE4+ZRkxfXJ5OcPoqWx+OWYYHE3044p0atCe5/EpNW+pdAD9SD5D+D4UTZ kv3SB4HWGcxMS+9txidCBc03zJCYCS8Vc6QIc/VosL0FGTOMEiMfJr6LSwuOipAKCDgNrX2V8sT OTZ9kYNFRnph4i25ZZq1/kHy+UJ5IMzKBGRFfCzBCuOngdJG5UtWh9IEQa9OTuiAJTnDo8qoqwT viKs/nKaDQkiXseRHCpINPwJEHsdfM+BRPU5LJEZzEfrGdcAxUCWkgHfZ07hCSfQ953aDjIBp9O TtEBNodMx+bGSzA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- drivers/media/platform/m2m-deinterlace.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platf= orm/m2m-deinterlace.c index 51c2f206cb1f601ec2f3d07fffbf63c86f4cdc01..e07e57d4206baa5e7a467298cb2= 40c3a2cd57cd8 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c @@ -517,13 +517,13 @@ static int vidioc_g_fmt(struct deinterlace_ctx *ctx, = struct v4l2_format *f) static int vidioc_g_fmt_vid_out(struct file *file, void *priv, struct v4l2_format *f) { - return vidioc_g_fmt(priv, f); + return vidioc_g_fmt(file_to_ctx(file), f); } =20 static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { - return vidioc_g_fmt(priv, f); + return vidioc_g_fmt(file_to_ctx(file), f); } =20 static int vidioc_try_fmt(struct v4l2_format *f, struct deinterlace_fmt *f= mt) @@ -544,8 +544,8 @@ static int vidioc_try_fmt(struct v4l2_format *f, struct= deinterlace_fmt *fmt) static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { + struct deinterlace_ctx *ctx =3D file_to_ctx(file); struct deinterlace_fmt *fmt; - struct deinterlace_ctx *ctx =3D priv; =20 fmt =3D find_format(f); if (!fmt || !(fmt->types & MEM2MEM_CAPTURE)) @@ -638,20 +638,20 @@ static int vidioc_s_fmt_vid_cap(struct file *file, vo= id *priv, ret =3D vidioc_try_fmt_vid_cap(file, priv, f); if (ret) return ret; - return vidioc_s_fmt(priv, f); + return vidioc_s_fmt(file_to_ctx(file), f); } =20 static int vidioc_s_fmt_vid_out(struct file *file, void *priv, struct v4l2_format *f) { - struct deinterlace_ctx *ctx =3D priv; + struct deinterlace_ctx *ctx =3D file_to_ctx(file); int ret; =20 ret =3D vidioc_try_fmt_vid_out(file, priv, f); if (ret) return ret; =20 - ret =3D vidioc_s_fmt(priv, f); + ret =3D vidioc_s_fmt(ctx, f); if (!ret) ctx->colorspace =3D f->fmt.pix.colorspace; =20 @@ -661,8 +661,8 @@ static int vidioc_s_fmt_vid_out(struct file *file, void= *priv, static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type type) { + struct deinterlace_ctx *ctx =3D file_to_ctx(file); struct deinterlace_q_data *s_q_data, *d_q_data; - struct deinterlace_ctx *ctx =3D priv; =20 s_q_data =3D get_q_data(V4L2_BUF_TYPE_VIDEO_OUTPUT); d_q_data =3D get_q_data(V4L2_BUF_TYPE_VIDEO_CAPTURE); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 6CE5B2222AB; Sat, 2 Aug 2025 09:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126951; cv=none; b=osrNc0oOQzNYG/laWkUm+du0ijN+epRqunnX4zGjlsNgB8MCDJaAs3EF2CvnAZUu8/RMHfElMlN4rmlKmdBab7u1n/RzRyjGDk9YocrPp/Dfv4j9WHkenx91QvDM03ksqsvqjpQa8dwUl9LdSd/y+y5mdyS84zesHpqNgxzXkg4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126951; c=relaxed/simple; bh=L0ZUzNfnoLjztZUAFo8LD82f1tvHxDD9diPSRFvNFG8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=idPmUt9AYXZBhlf3f9Hr5UMTlcKmzT+0N+dBgGOihRiCYJS2I0+AgVbr9R4p+P5WjlsYvCLpZsKCWIyqzh+tK/6cTUPZ+MWH/+jVZYGR5Dfc5NIMljBPP6yNy0XV3k0Ar0uTG2IjTQKrtZiotoc114czjWTNH0OtqPncqCBlYG4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=YgNxCbbV; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="YgNxCbbV" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8D5B13C64; Sat, 2 Aug 2025 11:28:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126902; bh=L0ZUzNfnoLjztZUAFo8LD82f1tvHxDD9diPSRFvNFG8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YgNxCbbV4Lu9nSUDHOLXb+Khn3iTG7uca8DR8oTYu966wM689OJhwdvHajbpALfe7 SobfPhefVv+UXuwNOm8AUrwSyV4o5pUIWPMqBB8HNh+YKTlUKsjnNpHfDd0JY4HgnM 2ljjhNlRhMYivAPRG+3MQuqEA4D06LL5zLT0b0+Y= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:56 +0200 Subject: [PATCH 34/65] media: mtk: jpeg: Access v4l2_fh from file->private_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-34-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5473; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=L0ZUzNfnoLjztZUAFo8LD82f1tvHxDD9diPSRFvNFG8=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj7gvp1bn79ddqFVF08lQxDnSWTM0Yzt2fgT Quste8pkyOJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+wAKCRByNAaPFqFW PAUHD/9/Mn8W2TWnpnF5jCtc9S3BNAZMttSJxyX+rR5RRe6S8x/I8d8N3U+ykOsqQyM3NIWlHt0 C0myb3twn6+97X7lRzosteZ2DCTbU2QWnjIcTCpAiC5uJ9saBPoaf2KxxZERdg3yWqYKvAVsua7 VKVqQwfE565lqKpZOqPSLhA5VTIGbTuooNI1HFqoeXpPp9jAhn7wWfGfkH8vE1NaSOA1BxrlRhR QVWvVysYhH/lafXj4XSniCcqUfwh4oL4MfFDIACucn0RFellTnptdo/gTgMD2Y04sHl1ljGBgYU jsCiRvcCJDg1zGLsSMdbHlB4R+5GJtxaIfkNRG090P5o1m/8e7Q/RxhaKbK5ml9QAPaWR65nOjr Xj60Z0XEKbTo/fTrLy+jRwmDXGxvQAm9qqisXrgZPPsxfwFnWCzSPbu4WosZZQbm3+ZiU6m+TcW apyakcWCNeVbV7xLZBKnIdSerEsIGn+SVC/p74Jw9H1nCbaWkZPcaZBEJK2Oc5kZZr5eGZyJmLe dZr9DrtDSNvB6WaMD/8C45rV3JqAyV8ogmJLOzSgjIGvt520pPa9mhqd6uIeSFfYpn2CCzteEz3 8lRJcdt5+Yu1wdlhYyOIKbtlfg0jX/CKb1rMpjtwpxx96U+3vwC7VG/MzM+mDutHW/YgrZnAebP XCCbyjTWWZJHYzQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it, remove the now unused mtk_jpeg_fh_to_ctx() macro. Signed-off-by: Jacopo Mondi --- .../media/platform/mediatek/jpeg/mtk_jpeg_core.c | 27 +++++++++---------= ---- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers= /media/platform/mediatek/jpeg/mtk_jpeg_core.c index 8e1883d034f5c67d418f5607c593c60f5d6ddbee..6268d651bdcfd212b58bf686c55= 660d64b659dfe 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -119,11 +119,6 @@ static inline struct mtk_jpeg_ctx *ctrl_to_ctx(struct = v4l2_ctrl *ctrl) return container_of(ctrl->handler, struct mtk_jpeg_ctx, ctrl_hdl); } =20 -static inline struct mtk_jpeg_ctx *mtk_jpeg_fh_to_ctx(struct v4l2_fh *fh) -{ - return container_of(fh, struct mtk_jpeg_ctx, fh); -} - static inline struct mtk_jpeg_ctx *mtk_jpeg_file_to_ctx(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct mtk_jpeg_ctx, fh); @@ -217,7 +212,7 @@ static int mtk_jpeg_enum_fmt(struct mtk_jpeg_fmt *mtk_j= peg_formats, int n, static int mtk_jpeg_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_fh_to_ctx(priv); + struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_file_to_ctx(file); struct mtk_jpeg_dev *jpeg =3D ctx->jpeg; =20 return mtk_jpeg_enum_fmt(jpeg->variant->formats, @@ -228,7 +223,7 @@ static int mtk_jpeg_enum_fmt_vid_cap(struct file *file,= void *priv, static int mtk_jpeg_enum_fmt_vid_out(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_fh_to_ctx(priv); + struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_file_to_ctx(file); struct mtk_jpeg_dev *jpeg =3D ctx->jpeg; =20 return mtk_jpeg_enum_fmt(jpeg->variant->formats, @@ -310,7 +305,7 @@ static int mtk_jpeg_g_fmt_vid_mplane(struct file *file,= void *priv, struct vb2_queue *vq; struct mtk_jpeg_q_data *q_data =3D NULL; struct v4l2_pix_format_mplane *pix_mp =3D &f->fmt.pix_mp; - struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_fh_to_ctx(priv); + struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_file_to_ctx(file); struct mtk_jpeg_dev *jpeg =3D ctx->jpeg; int i; =20 @@ -356,7 +351,7 @@ static int mtk_jpeg_g_fmt_vid_mplane(struct file *file,= void *priv, static int mtk_jpeg_try_fmt_vid_cap_mplane(struct file *file, void *priv, struct v4l2_format *f) { - struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_fh_to_ctx(priv); + struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_file_to_ctx(file); struct mtk_jpeg_dev *jpeg =3D ctx->jpeg; struct mtk_jpeg_fmt *fmt; =20 @@ -385,7 +380,7 @@ static int mtk_jpeg_try_fmt_vid_cap_mplane(struct file = *file, void *priv, static int mtk_jpeg_try_fmt_vid_out_mplane(struct file *file, void *priv, struct v4l2_format *f) { - struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_fh_to_ctx(priv); + struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_file_to_ctx(file); struct mtk_jpeg_dev *jpeg =3D ctx->jpeg; struct mtk_jpeg_fmt *fmt; =20 @@ -475,7 +470,7 @@ static int mtk_jpeg_s_fmt_vid_out_mplane(struct file *f= ile, void *priv, if (ret) return ret; =20 - return mtk_jpeg_s_fmt_mplane(mtk_jpeg_fh_to_ctx(priv), f, + return mtk_jpeg_s_fmt_mplane(mtk_jpeg_file_to_ctx(file), f, MTK_JPEG_FMT_FLAG_OUTPUT); } =20 @@ -488,7 +483,7 @@ static int mtk_jpeg_s_fmt_vid_cap_mplane(struct file *f= ile, void *priv, if (ret) return ret; =20 - return mtk_jpeg_s_fmt_mplane(mtk_jpeg_fh_to_ctx(priv), f, + return mtk_jpeg_s_fmt_mplane(mtk_jpeg_file_to_ctx(file), f, MTK_JPEG_FMT_FLAG_CAPTURE); } =20 @@ -517,7 +512,7 @@ static int mtk_jpeg_subscribe_event(struct v4l2_fh *fh, static int mtk_jpeg_enc_g_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_fh_to_ctx(priv); + struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_file_to_ctx(file); =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) return -EINVAL; @@ -542,7 +537,7 @@ static int mtk_jpeg_enc_g_selection(struct file *file, = void *priv, static int mtk_jpeg_dec_g_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_fh_to_ctx(priv); + struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_file_to_ctx(file); =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; @@ -571,7 +566,7 @@ static int mtk_jpeg_dec_g_selection(struct file *file, = void *priv, static int mtk_jpeg_enc_s_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_fh_to_ctx(priv); + struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_file_to_ctx(file); =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) return -EINVAL; @@ -594,7 +589,7 @@ static int mtk_jpeg_enc_s_selection(struct file *file, = void *priv, static int mtk_jpeg_qbuf(struct file *file, void *priv, struct v4l2_buffer= *buf) { struct v4l2_fh *fh =3D file_to_v4l2_fh(file); - struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_fh_to_ctx(priv); + struct mtk_jpeg_ctx *ctx =3D mtk_jpeg_file_to_ctx(file); struct vb2_queue *vq; struct vb2_buffer *vb; struct mtk_jpeg_src_buf *jpeg_src_buf; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 4498824467E; Sat, 2 Aug 2025 09:29:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126960; cv=none; b=soE7HHatwcmIR+cjw9t7fG7ZvEtcbNZhVcX/jyCXvFb5vnpIvjrIpze2B3hFzlBV9MfbrMCtvrZPQaBSVCz+ppwIarEQxD9OEcgUR54khh/wvjSFRRq/AgQBsqII/izsW+tuNFdwBqsbhHx7ehykzmLZantGv/Es4HThVWAVi2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126960; c=relaxed/simple; bh=Yp1jjNiETSRS2rD3cxKSnrkZYfH6FttVwhmOY8Rcezk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W72/wEnpanyo5rZl0fB2CNV5FBxWd+xXccuuNJYU034mQBCDIz+wTGVQYiQYDrByTOLMe8fQGqJrZznSvDUEVr7e67j/va48CAeBvxRlTUAFODupx0j2HpGfTV33HRQEXL5XMOHrxIYV3CozbgltDFcZBH/UTpQdev81Lq9x8f0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=oK65F9MO; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="oK65F9MO" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CC5683C6D; Sat, 2 Aug 2025 11:28:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126912; bh=Yp1jjNiETSRS2rD3cxKSnrkZYfH6FttVwhmOY8Rcezk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=oK65F9MO8UcjP/6hNhgPAYoZhlvkq+dE7764WQSpH/hkcjX6Rb/KkkY+fdKSTjt/w vphJVC/FyJaBkl11e29u1Z0eoaSgGKTIkW1Jj3s18ZoJGyaAy73X9YcFntU/aVGsMH /iZO1twyf28r7e1D1UCrv+Y0xTXqjwXq+IpXKl2Q= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:57 +0200 Subject: [PATCH 35/65] media: mtk_mdp_m2m: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-35-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4214; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=Yp1jjNiETSRS2rD3cxKSnrkZYfH6FttVwhmOY8Rcezk=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj7JJ72BFggMdAsaEou9LTKKektiwy1ugItg 8aerb8YmN2JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+wAKCRByNAaPFqFW PJHtD/9WyqYuwWJOfh5g1VWiGjbVTpkIX1b5Uy2x8MLlx18cgSLdj6+x0f3DRopLkV84ATY/RtQ SK5fk+ANG0EEnfKcLyRzCTvwxZxWeHrA1GEK3tL8oLQ2K4D8Wdagi+UKvyGctv1Bf3dWz6/yEB/ +w5HKX+Lzcu05OXTc/1vscZyEtMlghlNRqXnUAHnqNpPHfGIce5jL35BdelLLgMnkrBGHR3KmVD 4kMad1YfWVBYAHWYaQ67XSrnW+gBZfVJ7wARnBFv7ty6GzdLgLaWTg4j26wUUScYyIoDmVRwiw5 nu0iMGSqrJVJQoKr6v/RQLJKnzG61raDiylsrMrnqyc/J9WaqyvraNo4aqlu2UMFJwZgKFKXDtV R9oYbRdEIMmkD6MOkJO9E54OrbDgACoNAPBbpqOu3YUxs0aaSGh1Yk+qlV4uF517fqQ+CnUj1Qo OYwd67H7yXEFNYBtND7I79bBFukORypozZATF7RHkA8N/cI4aR1f6hKGdPxpqDN0J5sZKTeA601 uKd/AtqDWuNgOmlehluKCWwIuJDAHQZWX/YAXbsZAMVRWOHNuazhbs9VRgk0s3Csk6g956oz/oP w95XKEOp39XUgt08MC/mLmzTY/mCwS1I5rOl5p4mDsb2Y2OpI11ZzG8bidnmbz6do8Q57zSEqKH htnfly2T+xeCKBQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it, remove the now unused fh_to_ctx() macro. Signed-off-by: Jacopo Mondi --- drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c | 21 ++++++++-----------= -- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c b/drivers/me= dia/platform/mediatek/mdp/mtk_mdp_m2m.c index 3d836b5efa3807e4dc882956040014e244eeb660..03c07948dfdd07c6395c391ccad= 1788b08b1a867 100644 --- a/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c +++ b/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c @@ -348,11 +348,6 @@ static int mtk_mdp_try_crop(struct mtk_mdp_ctx *ctx, u= 32 type, return 0; } =20 -static inline struct mtk_mdp_ctx *fh_to_ctx(struct v4l2_fh *fh) -{ - return container_of(fh, struct mtk_mdp_ctx, fh); -} - static inline struct mtk_mdp_ctx *file_to_ctx(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct mtk_mdp_ctx, fh); @@ -594,7 +589,7 @@ static const struct vb2_ops mtk_mdp_m2m_qops =3D { static int mtk_mdp_m2m_querycap(struct file *file, void *fh, struct v4l2_capability *cap) { - struct mtk_mdp_ctx *ctx =3D fh_to_ctx(fh); + struct mtk_mdp_ctx *ctx =3D file_to_ctx(file); struct mtk_mdp_dev *mdp =3D ctx->mdp_dev; =20 strscpy(cap->driver, MTK_MDP_MODULE_NAME, sizeof(cap->driver)); @@ -632,7 +627,7 @@ static int mtk_mdp_m2m_enum_fmt_vid_out(struct file *fi= le, void *priv, static int mtk_mdp_m2m_g_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct mtk_mdp_ctx *ctx =3D fh_to_ctx(fh); + struct mtk_mdp_ctx *ctx =3D file_to_ctx(file); struct mtk_mdp_frame *frame; struct v4l2_pix_format_mplane *pix_mp; int i; @@ -671,7 +666,7 @@ static int mtk_mdp_m2m_g_fmt_mplane(struct file *file, = void *fh, static int mtk_mdp_m2m_try_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct mtk_mdp_ctx *ctx =3D fh_to_ctx(fh); + struct mtk_mdp_ctx *ctx =3D file_to_ctx(file); =20 if (!mtk_mdp_try_fmt_mplane(ctx, f)) return -EINVAL; @@ -681,7 +676,7 @@ static int mtk_mdp_m2m_try_fmt_mplane(struct file *file= , void *fh, static int mtk_mdp_m2m_s_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct mtk_mdp_ctx *ctx =3D fh_to_ctx(fh); + struct mtk_mdp_ctx *ctx =3D file_to_ctx(file); struct vb2_queue *vq; struct mtk_mdp_frame *frame; struct v4l2_pix_format_mplane *pix_mp; @@ -727,7 +722,7 @@ static int mtk_mdp_m2m_s_fmt_mplane(struct file *file, = void *fh, static int mtk_mdp_m2m_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers *reqbufs) { - struct mtk_mdp_ctx *ctx =3D fh_to_ctx(fh); + struct mtk_mdp_ctx *ctx =3D file_to_ctx(file); =20 return v4l2_m2m_reqbufs(file, ctx->m2m_ctx, reqbufs); } @@ -735,7 +730,7 @@ static int mtk_mdp_m2m_reqbufs(struct file *file, void = *fh, static int mtk_mdp_m2m_streamon(struct file *file, void *fh, enum v4l2_buf_type type) { - struct mtk_mdp_ctx *ctx =3D fh_to_ctx(fh); + struct mtk_mdp_ctx *ctx =3D file_to_ctx(file); int ret; =20 if (!mtk_mdp_ctx_state_is_set(ctx, MTK_MDP_VPU_INIT)) { @@ -773,8 +768,8 @@ static inline bool mtk_mdp_is_target_crop(u32 target) static int mtk_mdp_m2m_g_selection(struct file *file, void *fh, struct v4l2_selection *s) { + struct mtk_mdp_ctx *ctx =3D file_to_ctx(file); struct mtk_mdp_frame *frame; - struct mtk_mdp_ctx *ctx =3D fh_to_ctx(fh); bool valid =3D false; =20 if (s->type =3D=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) { @@ -840,8 +835,8 @@ static int mtk_mdp_check_scaler_ratio(struct mtk_mdp_va= riant *var, int src_w, static int mtk_mdp_m2m_s_selection(struct file *file, void *fh, struct v4l2_selection *s) { + struct mtk_mdp_ctx *ctx =3D file_to_ctx(file); struct mtk_mdp_frame *frame; - struct mtk_mdp_ctx *ctx =3D fh_to_ctx(fh); struct v4l2_rect new_r; struct mtk_mdp_variant *variant =3D ctx->mdp_dev->variant; int ret; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 322092222AA; Sat, 2 Aug 2025 09:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126973; cv=none; b=IP+xN6cYBHVpSm48hVB7aagMhi/D/neOFsIR/hLmW00K9ERqrFtUM9m/ZsQfmsbwuduEWhjE5kOfKN99bwZ4OKZiLNRrj9ASidG8TMRBky8bvONoHoL6cYy2iwjpT1kbzhNUC3TdCk9RjX7X4POwGbGIQqZj6e9XS7jVGnzuBk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126973; c=relaxed/simple; bh=SiP0pV3uc5ehXCmjBOQ+pI87XyOKqpx8plOTytPDacg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GwvJJGSrlij5UNbxgnen0uY/npEjJoK75skLa8XKizWbKsYVmFZEC7BxXHAHE90Lb9zzIe4msd+o7b1lphTTODDgHACa1E+vT4/Xem5mnb3iyWi1xkTry4J7Kc+HLhG/hW8YEK/TJ3nXjRfQgvYTY0VJSK6YeIq7LrA8HCYsArA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=San+pDEC; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="San+pDEC" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0FD193C9F; Sat, 2 Aug 2025 11:28:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126925; bh=SiP0pV3uc5ehXCmjBOQ+pI87XyOKqpx8plOTytPDacg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=San+pDECzI88V7mT/YALl0VxYF7B/l+IylhbNl1u7nEBfG63br+nLorQpng0+of/H WTXMeTOHHqH/KLsDJsMUnPmBrIWFB50jsfcJVQlhTNjhjMVd+X1TGdiHQmF+LBAlb9 aR7UsSdVcYen71YQY8NoGVoCRLGdVOINtcFEVK8M= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:58 +0200 Subject: [PATCH 36/65] media: mtk: mdp3: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-36-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3371; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=SiP0pV3uc5ehXCmjBOQ+pI87XyOKqpx8plOTytPDacg=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj7rzoS7q8iiibhw66Yirn2/oG1c8uoKKblm P50PaQA172JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+wAKCRByNAaPFqFW POLLD/40E/BbhBjjzsyc19BPpJfqJe0r65dUiQbnbXZ3LgvyF1h2ul+hKU/fqvksQk1bq1ZbsfN 6owSmRIx4H0FnCJBIhSgnO120esGna89Qtmsbx2qEFYRY09ZPg2yWkDozlFtrbhEPBqjwSj0v4p +43Y1catQVyppG3ZzUQaykBE4yjxkA1JbGM8Jz2QJ0wrUAl8uqF2ym5gpe4AyaPYbCGa01o+oOa LCvsjzHHZmmAGik2wIMae4UpHiLycx5R+3yRgjVTN7dUb9JNdAHSVfgJB8G/6gqOrDWX4XFcQw0 VByW7JksnjYBsU38s+2e5Fp0sOfYn+pPVNRDX1vVcM3MwAi6TCIY3YVfLoCwo8qFOkZNqX2osFZ NbFvecCKIBzhz1NJKPoCKKQ0+XFWKm9QhILFXei++xKR2oQlgmIfNnsZ9c+wzNvMJkh+HcrMn3L nPlrbBu8DrN2SdKfUTodgpl1Iu/DDXveB9WDlgZogU3csDxHBscgBgTm728lJG7CnY9DNAjGwai 2Rru7p4yZIHRHUg8wCdEef7swc6/d1tboP38PG3y1Q8mQwC/uUOQa0RRJXPTT4xtAKJ10xWnw/U UIcJgH+LwN5mUoFyiSCqIoe23/Xrax2pXFhoMrTwNDPZiATmoTxP0B2QBeTXbq+FfTpkqu0SDec 2l1n9uL3CHjcg6A== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it, remove the now unused fh_to_ctx() macro. Signed-off-by: Jacopo Mondi --- drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c b/drivers/= media/platform/mediatek/mdp3/mtk-mdp3-m2m.c index 2e0619542d2a9ad73457853e4f5008e6eb130cdd..9ef956b565a791429a477dc9656= 7453cb189d817 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c @@ -10,11 +10,6 @@ #include #include "mtk-mdp3-m2m.h" =20 -static inline struct mdp_m2m_ctx *fh_to_ctx(struct v4l2_fh *fh) -{ - return container_of(fh, struct mdp_m2m_ctx, fh); -} - static inline struct mdp_m2m_ctx *file_to_ctx(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct mdp_m2m_ctx, fh); @@ -290,7 +285,7 @@ static int mdp_m2m_querycap(struct file *file, void *fh, static int mdp_m2m_enum_fmt_mplane(struct file *file, void *fh, struct v4l2_fmtdesc *f) { - struct mdp_m2m_ctx *ctx =3D fh_to_ctx(fh); + struct mdp_m2m_ctx *ctx =3D file_to_ctx(file); =20 return mdp_enum_fmt_mplane(ctx->mdp_dev, f); } @@ -298,7 +293,7 @@ static int mdp_m2m_enum_fmt_mplane(struct file *file, v= oid *fh, static int mdp_m2m_g_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct mdp_m2m_ctx *ctx =3D fh_to_ctx(fh); + struct mdp_m2m_ctx *ctx =3D file_to_ctx(file); struct mdp_frame *frame; struct v4l2_pix_format_mplane *pix_mp; =20 @@ -316,7 +311,7 @@ static int mdp_m2m_g_fmt_mplane(struct file *file, void= *fh, static int mdp_m2m_s_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct mdp_m2m_ctx *ctx =3D fh_to_ctx(fh); + struct mdp_m2m_ctx *ctx =3D file_to_ctx(file); struct mdp_frame *frame =3D ctx_get_frame(ctx, f->type); struct mdp_frame *capture; const struct mdp_format *fmt; @@ -359,7 +354,7 @@ static int mdp_m2m_s_fmt_mplane(struct file *file, void= *fh, static int mdp_m2m_try_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct mdp_m2m_ctx *ctx =3D fh_to_ctx(fh); + struct mdp_m2m_ctx *ctx =3D file_to_ctx(file); =20 if (!mdp_try_fmt_mplane(ctx->mdp_dev, f, &ctx->curr_param, ctx->id)) return -EINVAL; @@ -370,7 +365,7 @@ static int mdp_m2m_try_fmt_mplane(struct file *file, vo= id *fh, static int mdp_m2m_g_selection(struct file *file, void *fh, struct v4l2_selection *s) { - struct mdp_m2m_ctx *ctx =3D fh_to_ctx(fh); + struct mdp_m2m_ctx *ctx =3D file_to_ctx(file); struct mdp_frame *frame; bool valid =3D false; =20 @@ -422,7 +417,7 @@ static int mdp_m2m_g_selection(struct file *file, void = *fh, static int mdp_m2m_s_selection(struct file *file, void *fh, struct v4l2_selection *s) { - struct mdp_m2m_ctx *ctx =3D fh_to_ctx(fh); + struct mdp_m2m_ctx *ctx =3D file_to_ctx(file); struct mdp_frame *frame =3D ctx_get_frame(ctx, s->type); struct mdp_frame *capture; struct v4l2_rect r; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 913C22222AA; Sat, 2 Aug 2025 09:29:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126982; cv=none; b=iaiVrzJocqTfnAxzCK+BjrMeweIqtoMitcjfyZIMR47riIa9p9fgPo5QCnMZqWPpB1sm3eNfKEnRlQ3Z+Z3Mxh5gh+FpFTl6CV8vxiWZm0cn0Bb81cKvUdCtniFf7ufWI24VynOspayPsqCzSSYi9IgR6N0nlaT1rAzSH+/kG3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126982; c=relaxed/simple; bh=TREA8Gw7i9MWzaBdbk/QKhP4Ggubbbr1P2XTmejXLMg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oZyB1po6kvJvhUA6SarSExRUubGop+a7L2OvAb5BSzpaWQbFUbblPhhdhYjUpt7uSVAcSmVio92A5EplxdhGRB7PDx8HS/edPrxsTlKMg/zelkTVPYzGghcvpTTXfpuBNLnufi5s0RD4wULqRGRiEkGIHYVuaDQhw/mK5T4zMZo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=jNijr26x; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jNijr26x" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B4CC23C6C; Sat, 2 Aug 2025 11:28:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126933; bh=TREA8Gw7i9MWzaBdbk/QKhP4Ggubbbr1P2XTmejXLMg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jNijr26x5+M7V7u6frcDFOc1kw8nkayNoUX+tkfFN+81P3tAoLJU0zqTc4xceh+JS CcXmq6ErvT/tUMPRINb7C733Z753O0Kg4oUaHuaQtM+H3G/r9kIUq//VNa+n/wDzQx ZCPA5vqvcGKXQtSSlbt/9zBRQyOy0nPGCuzDVOHk= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:59 +0200 Subject: [PATCH 37/65] media: mtk: vcodec: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-37-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=15817; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=TREA8Gw7i9MWzaBdbk/QKhP4Ggubbbr1P2XTmejXLMg=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj7OFz+gN+wVUa5VrMIM4YwXqynriZsOLr8/ lEjqmJBecSJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+wAKCRByNAaPFqFW PDXFEACF7S0bzNNPSEx0ZGozCHIVTditcgtd3bjzpugZNSpCFcQL5RnblDMNXaTZ9JUxJojuT/y t7OKO86LZRZm2RaF2T/6UvtXUSmcunX6qFk8BFTn+mqubhxy+CO/Ex+SzTPlemYp9t/THLIcQhF OXvmdmnwpq1yYBHiGd7Bw5wLQ5Q/vHV4weIFVDAL5V/ORd+T/gUXFXg0ySeCUbaaYFVxXIaiSEm 7lReb8gjHZq2461gV6GQbUzU/jmKEyy8SBZXc2ND0v6I7ubcUYW1P63TQ7hPnmEiyNpJmK5C58l Uuw1V9L9I/1P6g6+n1/Ml523MwfsS2+dPX+KEElKiZlXqAlVc9HQRXZrrgen4CFJH3qP55z+464 zGhiK5n7WozA50CkGjspJc+tAWCqThw78zGzqSNXIXvp1UT5FdprbpNvQjybL4/KaQyWhsPNcgC NxNPp4zJYrcrsFSwbfgsR6FaAijZ6DVcwq3ZH/likfl+LXm5/KTHjO2PDpbdL05tlYPkRpkO7/F CKCJBfmdL1z8l1M91mAgY3pgCBkMxOlUIVTgWWFM8hjvhrFE4Gm01woUGeD/JbRlN55KcosvY1H zB7VSNQY8qhwoExGJoDLy4EfRmxMZfIvdCO/eX+32eNNEYPOZVQsXYs6+Zm1CBonwBKKzxqMddf UeHloDAzu4agKiw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at modify mtk_vcodec_enc_get_chip_name() to accept a ctx instead of a raw void *. While at it, remove the now unused fh_to_enc_ctx() macro. Signed-off-by: Jacopo Mondi --- .../mediatek/vcodec/decoder/mtk_vcodec_dec.c | 36 ++++++++++--------= --- .../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 37 +++++++++++-------= ---- .../mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h | 5 --- 3 files changed, 36 insertions(+), 42 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.= c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c index 98838217b97d45ed2b5431fdf87c94e0ff79fc57..d691bd533103b100e7d1817e834= 696cc5b3990ce 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c @@ -87,7 +87,7 @@ static int stateful_try_decoder_cmd(struct file *file, vo= id *priv, struct v4l2_d =20 static int stateful_decoder_cmd(struct file *file, void *priv, struct v4l2= _decoder_cmd *cmd) { - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); struct vb2_queue *src_vq, *dst_vq; int ret; =20 @@ -132,7 +132,7 @@ static int stateless_try_decoder_cmd(struct file *file,= void *priv, struct v4l2_ =20 static int stateless_decoder_cmd(struct file *file, void *priv, struct v4l= 2_decoder_cmd *cmd) { - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); int ret; =20 ret =3D v4l2_m2m_ioctl_stateless_try_decoder_cmd(file, priv, cmd); @@ -158,7 +158,7 @@ static int stateless_decoder_cmd(struct file *file, voi= d *priv, struct v4l2_deco =20 static int vidioc_try_decoder_cmd(struct file *file, void *priv, struct v4= l2_decoder_cmd *cmd) { - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); =20 if (ctx->dev->vdec_pdata->uses_stateless_api) return stateless_try_decoder_cmd(file, priv, cmd); @@ -168,7 +168,7 @@ static int vidioc_try_decoder_cmd(struct file *file, vo= id *priv, struct v4l2_dec =20 static int vidioc_decoder_cmd(struct file *file, void *priv, struct v4l2_d= ecoder_cmd *cmd) { - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); =20 if (ctx->dev->vdec_pdata->uses_stateless_api) return stateless_decoder_cmd(file, priv, cmd); @@ -233,7 +233,7 @@ void mtk_vcodec_dec_set_default_params(struct mtk_vcode= c_dec_ctx *ctx) static int vidioc_vdec_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) { - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); =20 if (ctx->state =3D=3D MTK_STATE_ABORT) { mtk_v4l2_vdec_err(ctx, "[%d] Call on QBUF after unrecoverable error", ct= x->id); @@ -246,7 +246,7 @@ static int vidioc_vdec_qbuf(struct file *file, void *pr= iv, static int vidioc_vdec_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) { - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); =20 if (ctx->state =3D=3D MTK_STATE_ABORT) { mtk_v4l2_vdec_err(ctx, "[%d] Call on DQBUF after unrecoverable error", c= tx->id); @@ -259,7 +259,7 @@ static int vidioc_vdec_dqbuf(struct file *file, void *p= riv, static int vidioc_vdec_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); struct device *dev =3D &ctx->dev->plat_dev->dev; =20 strscpy(cap->driver, dev->driver->name, sizeof(cap->driver)); @@ -354,7 +354,7 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *f= ile, void *priv, struct v4l2_format *f) { const struct mtk_video_fmt *fmt; - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); const struct mtk_vcodec_dec_pdata *dec_pdata =3D ctx->dev->vdec_pdata; =20 fmt =3D mtk_vdec_find_format(f, dec_pdata); @@ -372,7 +372,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *f= ile, void *priv, { struct v4l2_pix_format_mplane *pix_fmt_mp =3D &f->fmt.pix_mp; const struct mtk_video_fmt *fmt; - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); const struct mtk_vcodec_dec_pdata *dec_pdata =3D ctx->dev->vdec_pdata; =20 fmt =3D mtk_vdec_find_format(f, dec_pdata); @@ -393,7 +393,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *f= ile, void *priv, static int vidioc_vdec_g_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); struct mtk_q_data *q_data; =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) @@ -442,7 +442,7 @@ static int vidioc_vdec_g_selection(struct file *file, v= oid *priv, static int vidioc_vdec_s_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; @@ -464,7 +464,7 @@ static int vidioc_vdec_s_selection(struct file *file, v= oid *priv, static int vidioc_vdec_s_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); struct v4l2_pix_format_mplane *pix_mp; struct mtk_q_data *q_data; int ret =3D 0; @@ -594,7 +594,7 @@ static int vidioc_enum_framesizes(struct file *file, vo= id *priv, struct v4l2_frmsizeenum *fsize) { int i =3D 0; - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); const struct mtk_vcodec_dec_pdata *dec_pdata =3D ctx->dev->vdec_pdata; =20 if (fsize->index !=3D 0) @@ -623,10 +623,10 @@ static int vidioc_enum_framesizes(struct file *file, = void *priv, return -EINVAL; } =20 -static int vidioc_enum_fmt(struct v4l2_fmtdesc *f, void *priv, +static int vidioc_enum_fmt(struct file *file, struct v4l2_fmtdesc *f, bool output_queue) { - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); const struct mtk_vcodec_dec_pdata *dec_pdata =3D ctx->dev->vdec_pdata; const struct mtk_video_fmt *fmt; int i, j =3D 0; @@ -660,19 +660,19 @@ static int vidioc_enum_fmt(struct v4l2_fmtdesc *f, vo= id *priv, static int vidioc_vdec_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - return vidioc_enum_fmt(f, priv, false); + return vidioc_enum_fmt(file, f, false); } =20 static int vidioc_vdec_enum_fmt_vid_out(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - return vidioc_enum_fmt(f, priv, true); + return vidioc_enum_fmt(file, f, true); } =20 static int vidioc_vdec_g_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct mtk_vcodec_dec_ctx *ctx =3D fh_to_dec_ctx(priv); + struct mtk_vcodec_dec_ctx *ctx =3D file_to_dec_ctx(file); struct v4l2_pix_format_mplane *pix_mp =3D &f->fmt.pix_mp; struct vb2_queue *vq; struct mtk_q_data *q_data; diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.= c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c index a01dc25a769911cd85a8d19c58e0c0a12b92ad50..d815e962ab8981c53000851e8f2= bc61faf28056d 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c @@ -159,7 +159,7 @@ static int vidioc_enum_framesizes(struct file *file, vo= id *fh, struct v4l2_frmsizeenum *fsize) { const struct mtk_video_fmt *fmt; - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(fh); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); =20 if (fsize->index !=3D 0) return -EINVAL; @@ -183,7 +183,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, v= oid *priv, struct v4l2_fmtdesc *f) { const struct mtk_vcodec_enc_pdata *pdata =3D - fh_to_enc_ctx(priv)->dev->venc_pdata; + file_to_enc_ctx(file)->dev->venc_pdata; =20 return vidioc_enum_fmt(f, pdata->capture_formats, pdata->num_capture_formats); @@ -193,15 +193,14 @@ static int vidioc_enum_fmt_vid_out(struct file *file,= void *priv, struct v4l2_fmtdesc *f) { const struct mtk_vcodec_enc_pdata *pdata =3D - fh_to_enc_ctx(priv)->dev->venc_pdata; + file_to_enc_ctx(file)->dev->venc_pdata; =20 return vidioc_enum_fmt(f, pdata->output_formats, pdata->num_output_formats); } =20 -static int mtk_vcodec_enc_get_chip_name(void *priv) +static int mtk_vcodec_enc_get_chip_name(struct mtk_vcodec_enc_ctx *ctx) { - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); struct device *dev =3D &ctx->dev->plat_dev->dev; =20 if (of_device_is_compatible(dev->of_node, "mediatek,mt8173-vcodec-enc")) @@ -221,9 +220,9 @@ static int mtk_vcodec_enc_get_chip_name(void *priv) static int vidioc_venc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); struct device *dev =3D &ctx->dev->plat_dev->dev; - int platform_name =3D mtk_vcodec_enc_get_chip_name(priv); + int platform_name =3D mtk_vcodec_enc_get_chip_name(ctx); =20 strscpy(cap->driver, dev->driver->name, sizeof(cap->driver)); snprintf(cap->card, sizeof(cap->card), "MT%d video encoder", platform_nam= e); @@ -234,7 +233,7 @@ static int vidioc_venc_querycap(struct file *file, void= *priv, static int vidioc_venc_s_parm(struct file *file, void *priv, struct v4l2_streamparm *a) { - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); struct v4l2_fract *timeperframe =3D &a->parm.output.timeperframe; =20 if (a->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) @@ -257,7 +256,7 @@ static int vidioc_venc_s_parm(struct file *file, void *= priv, static int vidioc_venc_g_parm(struct file *file, void *priv, struct v4l2_streamparm *a) { - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); =20 if (a->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) return -EINVAL; @@ -414,7 +413,7 @@ static void mtk_venc_set_param(struct mtk_vcodec_enc_ct= x *ctx, static int vidioc_venc_s_fmt_cap(struct file *file, void *priv, struct v4l2_format *f) { - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); const struct mtk_vcodec_enc_pdata *pdata =3D ctx->dev->venc_pdata; struct vb2_queue *vq; struct mtk_q_data *q_data =3D mtk_venc_get_q_data(ctx, f->type); @@ -469,7 +468,7 @@ static int vidioc_venc_s_fmt_cap(struct file *file, voi= d *priv, static int vidioc_venc_s_fmt_out(struct file *file, void *priv, struct v4l2_format *f) { - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); const struct mtk_vcodec_enc_pdata *pdata =3D ctx->dev->venc_pdata; struct vb2_queue *vq; struct mtk_q_data *q_data =3D mtk_venc_get_q_data(ctx, f->type); @@ -524,7 +523,7 @@ static int vidioc_venc_g_fmt(struct file *file, void *p= riv, struct v4l2_format *f) { struct v4l2_pix_format_mplane *pix =3D &f->fmt.pix_mp; - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); struct vb2_queue *vq; struct mtk_q_data *q_data =3D mtk_venc_get_q_data(ctx, f->type); int i; @@ -557,7 +556,7 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *f= ile, void *priv, struct v4l2_format *f) { const struct mtk_video_fmt *fmt; - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); const struct mtk_vcodec_enc_pdata *pdata =3D ctx->dev->venc_pdata; =20 fmt =3D mtk_venc_find_format(f->fmt.pix.pixelformat, pdata); @@ -579,7 +578,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *f= ile, void *priv, struct v4l2_format *f) { const struct mtk_video_fmt *fmt; - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); const struct mtk_vcodec_enc_pdata *pdata =3D ctx->dev->venc_pdata; =20 fmt =3D mtk_venc_find_format(f->fmt.pix.pixelformat, pdata); @@ -600,7 +599,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *f= ile, void *priv, static int vidioc_venc_g_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); struct mtk_q_data *q_data =3D mtk_venc_get_q_data(ctx, s->type); =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) @@ -630,7 +629,7 @@ static int vidioc_venc_g_selection(struct file *file, v= oid *priv, static int vidioc_venc_s_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); struct mtk_q_data *q_data =3D mtk_venc_get_q_data(ctx, s->type); =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) @@ -655,7 +654,7 @@ static int vidioc_venc_s_selection(struct file *file, v= oid *priv, static int vidioc_venc_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) { - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); =20 if (ctx->state =3D=3D MTK_STATE_ABORT) { mtk_v4l2_venc_err(ctx, "[%d] Call on QBUF after unrecoverable error", @@ -669,7 +668,7 @@ static int vidioc_venc_qbuf(struct file *file, void *pr= iv, static int vidioc_venc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) { - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); int ret; =20 if (ctx->state =3D=3D MTK_STATE_ABORT) { @@ -707,7 +706,7 @@ static int vidioc_venc_dqbuf(struct file *file, void *p= riv, static int vidioc_encoder_cmd(struct file *file, void *priv, struct v4l2_encoder_cmd *cmd) { - struct mtk_vcodec_enc_ctx *ctx =3D fh_to_enc_ctx(priv); + struct mtk_vcodec_enc_ctx *ctx =3D file_to_enc_ctx(file); struct vb2_queue *src_vq, *dst_vq; int ret; =20 diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_= drv.h b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h index 402e7d31d03d1985ad5ff2831faffc5c31b63467..5b304a5512366ed7109469a3b8f= 90b240baf2a11 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h @@ -217,11 +217,6 @@ struct mtk_vcodec_enc_dev { struct mtk_vcodec_dbgfs dbgfs; }; =20 -static inline struct mtk_vcodec_enc_ctx *fh_to_enc_ctx(struct v4l2_fh *fh) -{ - return container_of(fh, struct mtk_vcodec_enc_ctx, fh); -} - static inline struct mtk_vcodec_enc_ctx *file_to_enc_ctx(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct mtk_vcodec_enc_ctx, fh); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 70F95222587; Sat, 2 Aug 2025 09:29:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126992; cv=none; b=qB02zl7i3Ofilbmkhydqvp5rs6lzclwqCEH+Qg/Ltjrx5pIoPrMFh1CLd/TDRc048Z0vtpIVxecrv71fi2YYAg6IzbHCgltUDErXkZwwtaPWaFrWsmv7bg6i8Vf+Hv/JKbt2mR8QRw4oP8R4UcvD+C07f2ACmshTRrp5/kWCvyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126992; c=relaxed/simple; bh=MthwYUOLpqBn0ba6jZYKpMy9cQjcqOQkTUKOiMmYskY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JODgYuVDUlVxPya1mM/SIT2VmlkeCGzzpNFGsQzoAt14BDrRZRHCxc6Ykz3vo6bDFhQM2rPXLnVDTN03J1JyYgvwvAOLCMlRklCOuxadEqsvTUBhx4qVT+/FcsPCFJWenWAn3xkSZsITa5b0EoeQfUc2/d+CP7csQc07e10A+sQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=WrzWKhJz; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="WrzWKhJz" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 395973E43; Sat, 2 Aug 2025 11:28:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126942; bh=MthwYUOLpqBn0ba6jZYKpMy9cQjcqOQkTUKOiMmYskY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=WrzWKhJzGGme5zOuQKXcQS/gNGIUjt+o1Z00R2tij+Qj4M9aA/SV+y5Z26X7R3HR1 nYV72q1Za8zMTe1MdtszLQQRIrdrEHwMHomB/rG6zrt8mk52l3LNAcujKID2JmXYOv 3WD21E56BSQ+HYPkYABpAkGGxFx8a7Yv2PLlaV8g= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:00 +0200 Subject: [PATCH 38/65] media: tegra-vde: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-38-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4867; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=MthwYUOLpqBn0ba6jZYKpMy9cQjcqOQkTUKOiMmYskY=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj8TQAFq4EkLSez561K0ZCn/vn/BBJTmiqEC bdHNw8gzSWJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/AAKCRByNAaPFqFW PJFxD/0TIoksJkRESbXqmBqgUb3qo3kiE82eWw0Z6Q17TElBpWIw99pBtQOEfWrjRc99I2UNoAc mCWz87rZyt3b6rGydUaLt9eHY90h2RMG8ZuGxvsCjUqNu2QgiOXjLWK+BThZ6GSsaJU/obfD58m M5vJxlycDcFVA5yj4c9cYo9gOkSEthg2q7w+YAK5woOn3Vhbu23YWdJCoZpSNqcddOpyHsiqnEZ avPs8NZ686jUTHS/YnHe3ZYCI/gQcUffV4SXamBdh+FkxWa0WALMw86oWkcaFkX5WXmX9wNfith /kP9lim1JndmUQqWhp2EC7h7aowy/H3g4BtOWW9Z00CDQZ+3e4LiZ7Kqddsxq0uE5QNF7jPETC1 hJybOhHs6dvry1LAO5LFktHgr2lIdVTZQs9thfuO2XeQoqVM6z4bBjwLozzZsiN6urjUYoUz1XC iYuPhRgfbhwGyHjeVLsCHuXYR6JmLQXWLDCs6ZamO1AxcA1+VIjV3MS9lbcssLjGWrs++h+MJbD KljduZoHMhOINt+uFXu/pPJDBZ/AC/9qe73RGy3LvPoTSfbm+fTyCcLaqIn3INSuce3gG9VafpX 3OWHslj9R1uowlyL4FDQTnn2sNB+gM5WCqNDA5Sjx3AwLtjkJT1LApcSPeOOfKoBM/c3R1RVeVD u4zEl7mhyZWHBtw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- drivers/media/platform/nvidia/tegra-vde/v4l2.c | 24 ++++++++++++----------= -- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/nvidia/tegra-vde/v4l2.c b/drivers/media= /platform/nvidia/tegra-vde/v4l2.c index 0c50f4ff82e0a8f4935325d00691c58072182926..d94978ae2baf3394206ad7c3eb7= a400aeee47cf7 100644 --- a/drivers/media/platform/nvidia/tegra-vde/v4l2.c +++ b/drivers/media/platform/nvidia/tegra-vde/v4l2.c @@ -46,9 +46,9 @@ static const struct v4l2_ctrl_config ctrl_cfgs[] =3D { }, }; =20 -static inline struct tegra_ctx *fh_to_tegra_ctx(struct v4l2_fh *fh) +static inline struct tegra_ctx *file_to_tegra_ctx(struct file *file) { - return container_of(fh, struct tegra_ctx, fh); + return container_of(file_to_v4l2_fh(file), struct tegra_ctx, fh); } =20 static void tegra_set_control_data(struct tegra_ctx *ctx, void *data, u32 = id) @@ -506,7 +506,7 @@ static int tegra_querycap(struct file *file, void *priv, static int tegra_enum_decoded_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct tegra_ctx *ctx =3D fh_to_tegra_ctx(priv); + struct tegra_ctx *ctx =3D file_to_tegra_ctx(file); =20 if (WARN_ON(!ctx->coded_fmt_desc)) return -EINVAL; @@ -522,7 +522,7 @@ static int tegra_enum_decoded_fmt(struct file *file, vo= id *priv, static int tegra_g_decoded_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct tegra_ctx *ctx =3D fh_to_tegra_ctx(priv); + struct tegra_ctx *ctx =3D file_to_tegra_ctx(file); =20 *f =3D ctx->decoded_fmt; return 0; @@ -531,8 +531,8 @@ static int tegra_g_decoded_fmt(struct file *file, void = *priv, static int tegra_try_decoded_fmt(struct file *file, void *priv, struct v4l2_format *f) { + struct tegra_ctx *ctx =3D file_to_tegra_ctx(file); struct v4l2_pix_format_mplane *pix_mp =3D &f->fmt.pix_mp; - struct tegra_ctx *ctx =3D fh_to_tegra_ctx(priv); const struct tegra_coded_fmt_desc *coded_desc; unsigned int i; =20 @@ -571,7 +571,7 @@ static int tegra_try_decoded_fmt(struct file *file, voi= d *priv, static int tegra_s_decoded_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct tegra_ctx *ctx =3D fh_to_tegra_ctx(priv); + struct tegra_ctx *ctx =3D file_to_tegra_ctx(file); struct vb2_queue *vq; int err; =20 @@ -593,7 +593,7 @@ static int tegra_s_decoded_fmt(struct file *file, void = *priv, static int tegra_enum_coded_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct tegra_ctx *ctx =3D fh_to_tegra_ctx(priv); + struct tegra_ctx *ctx =3D file_to_tegra_ctx(file); const struct tegra_vde_soc *soc =3D ctx->vde->soc; =20 if (f->index >=3D soc->num_coded_fmts) @@ -607,7 +607,7 @@ static int tegra_enum_coded_fmt(struct file *file, void= *priv, static int tegra_g_coded_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct tegra_ctx *ctx =3D fh_to_tegra_ctx(priv); + struct tegra_ctx *ctx =3D file_to_tegra_ctx(file); =20 *f =3D ctx->coded_fmt; return 0; @@ -631,7 +631,7 @@ static int tegra_try_coded_fmt(struct file *file, void = *priv, struct v4l2_format *f) { struct v4l2_pix_format_mplane *pix_mp =3D &f->fmt.pix_mp; - struct tegra_ctx *ctx =3D fh_to_tegra_ctx(priv); + struct tegra_ctx *ctx =3D file_to_tegra_ctx(file); const struct tegra_vde_soc *soc =3D ctx->vde->soc; int size =3D pix_mp->plane_fmt[0].sizeimage; const struct tegra_coded_fmt_desc *desc; @@ -656,7 +656,7 @@ static int tegra_try_coded_fmt(struct file *file, void = *priv, static int tegra_s_coded_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct tegra_ctx *ctx =3D fh_to_tegra_ctx(priv); + struct tegra_ctx *ctx =3D file_to_tegra_ctx(file); struct v4l2_m2m_ctx *m2m_ctx =3D ctx->fh.m2m_ctx; const struct tegra_coded_fmt_desc *desc; struct vb2_queue *peer_vq, *vq; @@ -718,7 +718,7 @@ static int tegra_s_coded_fmt(struct file *file, void *p= riv, static int tegra_enum_framesizes(struct file *file, void *priv, struct v4l2_frmsizeenum *fsize) { - struct tegra_ctx *ctx =3D fh_to_tegra_ctx(priv); + struct tegra_ctx *ctx =3D file_to_tegra_ctx(file); const struct tegra_coded_fmt_desc *fmt; =20 if (fsize->index) @@ -852,8 +852,8 @@ static int tegra_open(struct file *file) =20 static int tegra_release(struct file *file) { + struct tegra_ctx *ctx =3D file_to_tegra_ctx(file); struct v4l2_fh *fh =3D file_to_v4l2_fh(file); - struct tegra_ctx *ctx =3D fh_to_tegra_ctx(fh); struct tegra_vde *vde =3D ctx->vde; =20 v4l2_fh_del(fh, file); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 A023F212D67; Sat, 2 Aug 2025 09:29:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126999; cv=none; b=BajQmboq8G4yJQEnWFEC5pE1XApQpWY9S4fwAHM3Su1ndFBhABkImbiWvKsR+nSxJJe5HYG+TsfdzP0Ppm67aJji+l33VBWdHcWwLVHGqcLvGSeI6hFzvFbyxg28rncIkHewn6rbFseYRaTqqThqGKHbwI3DOcHfQbE7AGIoMOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126999; c=relaxed/simple; bh=QMXN795g4JQ02dbn34MUgI1SrXfUXWeSvy7JvnRGT/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r+okpetGUAIQi78vz4eu/YFPQWxjpofckNUNeXorbOWQk1l84aTJWEK9gPOhV6Ufb5eJ5F/qVs9l1KSb1ScRi/tudl/INw8l7rL5MMLEY3YCh0dQQR07eBban0PddQkwSfwz1MEoVD4ZvRxCAGcG+iy58Vzca4o99ZSDYaFpu8E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=a6yKtLO3; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="a6yKtLO3" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D13D93EE9; Sat, 2 Aug 2025 11:29:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126950; bh=QMXN795g4JQ02dbn34MUgI1SrXfUXWeSvy7JvnRGT/4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=a6yKtLO3p3dptqs8nDpC4CTqf6f17ThWt2kAQ1RtjLbHys7ZhKQtBaxqQGSFM14hJ lo2so0O2XgjC9oyqujkhkQVVJ41fDYV4TE+DbxU0VOqJKvsFvw9M/9U/KkF7+/glzq Xda2N5WbvBrVab8G1DXb+S/ilReE23HpnougskVQ= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:01 +0200 Subject: [PATCH 39/65] media: imx-jpeg: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-39-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6555; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=QMXN795g4JQ02dbn34MUgI1SrXfUXWeSvy7JvnRGT/4=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj8/oWIIARD+dfkmFv/taMUYIiUf/KYJk9vV f7+9cr+2++JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/AAKCRByNAaPFqFW PKtxD/0WLPIL/mL1eF89kxSMM9GwOxEKdo8GLGfT13RWpduaSJTQpP/edD44lwWuTCc/Ppgs83F u9bd6x4dOVwYfaPQIN5wij1VrkrZ6Bukd6h598tHgoKq0LmK6g9AS6SSJyKCVG8ETu/fpF0ARpW 1oq1soPH+lkWm2YsCf88hjEAeLKuLe6T2CZB8MolKhAQOKNFewTMquWE8SfXrpMELAUh97npU/h GzVOcyJRfI+Me9QDMgov6AQRy+qGdm2K6R0aK8XaHuDSUkdPw4breQtXzbxvHJujLsZ3Ylt4IrG 5pTN90+UngJ1pYigkyC8u8WI8bF5BcOxKx+gjGXuO+zcdr++UiIKHU/iOzkeJvdSnBPE6XjtZEW DBYFVMgrlvKkBQ9pjwJIsek4GgkDSCUoTnyXtR5YpjSZLIOP2Hkxg/MYLR1K00HzGwNykLZfmwU gvHiAygX/esogRpR/rFyA6SnjaCLLoy/9Dak8v/a15IEWnRsw8DD6LGJGELTh5E3YGkkeFfBkWQ nk9hYsCX5zLegyyQZ6tjuv6HJc53gqm0Mq3KtJl8V5t46D4VXt+WsPiGrcRHyyYD8ibuJBlaHs2 ocOq1NEyVZ4BCdDoTWV7kqUn46e9u4uWM6Owwwggr8iOtxOn3o1mz5KuPz3wd7z2Oc1LrqSZ3Ry yexlpARHGjG1bXg== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it, remove the now unused mxc_jpeg_fh_to_ctx() macro. Signed-off-by: Jacopo Mondi --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 33 +++++++++++-----------= ---- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media= /platform/nxp/imx-jpeg/mxc-jpeg.c index fa7d74d8c1aabd3bf74482e214165d8c1a7e89da..df3ccdf767baf0bf6687808e2c0= 17063181a7220 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -644,11 +644,6 @@ static void print_mxc_buf(struct mxc_jpeg_dev *jpeg, s= truct vb2_buffer *buf, } } =20 -static inline struct mxc_jpeg_ctx *mxc_jpeg_fh_to_ctx(struct v4l2_fh *fh) -{ - return container_of(fh, struct mxc_jpeg_ctx, fh); -} - static inline struct mxc_jpeg_ctx *mxc_jpeg_file_to_ctx(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct mxc_jpeg_ctx, fh); @@ -1610,7 +1605,7 @@ static int mxc_jpeg_decoder_cmd(struct file *file, vo= id *priv, struct v4l2_decoder_cmd *cmd) { struct v4l2_fh *fh =3D file_to_v4l2_fh(file); - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(fh); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); unsigned long flags; int ret; =20 @@ -1643,7 +1638,7 @@ static int mxc_jpeg_encoder_cmd(struct file *file, vo= id *priv, struct v4l2_encoder_cmd *cmd) { struct v4l2_fh *fh =3D file_to_v4l2_fh(file); - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(fh); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); unsigned long flags; int ret; =20 @@ -2260,7 +2255,7 @@ static int mxc_jpeg_querycap(struct file *file, void = *priv, static int mxc_jpeg_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(priv); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); struct mxc_jpeg_q_data *q_data =3D mxc_jpeg_get_q_data(ctx, f->type); =20 if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_ENCODE) { @@ -2300,7 +2295,7 @@ static int mxc_jpeg_enum_fmt_vid_cap(struct file *fil= e, void *priv, static int mxc_jpeg_enum_fmt_vid_out(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(priv); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); u32 type =3D ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_DECODE ? MXC_JPEG_FMT_T= YPE_ENC : MXC_JPEG_FMT_TYPE_RAW; int ret; @@ -2441,7 +2436,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, static int mxc_jpeg_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(priv); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); struct mxc_jpeg_dev *jpeg =3D ctx->mxc_jpeg; struct device *dev =3D jpeg->dev; struct mxc_jpeg_q_data tmp_q; @@ -2460,7 +2455,7 @@ static int mxc_jpeg_try_fmt_vid_cap(struct file *file= , void *priv, static int mxc_jpeg_try_fmt_vid_out(struct file *file, void *priv, struct v4l2_format *f) { - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(priv); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); struct mxc_jpeg_dev *jpeg =3D ctx->mxc_jpeg; struct device *dev =3D jpeg->dev; struct mxc_jpeg_q_data tmp_q; @@ -2512,20 +2507,20 @@ static int mxc_jpeg_s_fmt(struct mxc_jpeg_ctx *ctx, static int mxc_jpeg_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { - return mxc_jpeg_s_fmt(mxc_jpeg_fh_to_ctx(priv), f); + return mxc_jpeg_s_fmt(mxc_jpeg_file_to_ctx(file), f); } =20 static int mxc_jpeg_s_fmt_vid_out(struct file *file, void *priv, struct v4l2_format *f) { int ret; - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(priv); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); struct vb2_queue *dst_vq; struct mxc_jpeg_q_data *q_data_cap; enum v4l2_buf_type cap_type =3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; struct v4l2_format fc; =20 - ret =3D mxc_jpeg_s_fmt(mxc_jpeg_fh_to_ctx(priv), f); + ret =3D mxc_jpeg_s_fmt(ctx, f); if (ret) return ret; =20 @@ -2554,7 +2549,7 @@ static int mxc_jpeg_s_fmt_vid_out(struct file *file, = void *priv, static int mxc_jpeg_g_fmt_vid(struct file *file, void *priv, struct v4l2_format *f) { - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(priv); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); struct mxc_jpeg_dev *jpeg =3D ctx->mxc_jpeg; struct device *dev =3D jpeg->dev; struct v4l2_pix_format_mplane *pix_mp =3D &f->fmt.pix_mp; @@ -2592,7 +2587,7 @@ static int mxc_jpeg_g_fmt_vid(struct file *file, void= *priv, =20 static int mxc_jpeg_dec_g_selection(struct file *file, void *fh, struct v4= l2_selection *s) { - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(fh); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); struct mxc_jpeg_q_data *q_data_cap; =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE && s->type !=3D V4L2_BUF_TYP= E_VIDEO_CAPTURE_MPLANE) @@ -2621,7 +2616,7 @@ static int mxc_jpeg_dec_g_selection(struct file *file= , void *fh, struct v4l2_sel =20 static int mxc_jpeg_enc_g_selection(struct file *file, void *fh, struct v4= l2_selection *s) { - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(fh); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); struct mxc_jpeg_q_data *q_data_out; =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT && s->type !=3D V4L2_BUF_TYPE= _VIDEO_OUTPUT_MPLANE) @@ -2649,7 +2644,7 @@ static int mxc_jpeg_enc_g_selection(struct file *file= , void *fh, struct v4l2_sel =20 static int mxc_jpeg_g_selection(struct file *file, void *fh, struct v4l2_s= election *s) { - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(fh); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); =20 if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_DECODE) return mxc_jpeg_dec_g_selection(file, fh, s); @@ -2659,7 +2654,7 @@ static int mxc_jpeg_g_selection(struct file *file, vo= id *fh, struct v4l2_selecti =20 static int mxc_jpeg_s_selection(struct file *file, void *fh, struct v4l2_s= election *s) { - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(fh); + struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_file_to_ctx(file); struct mxc_jpeg_q_data *q_data_out; =20 if (ctx->mxc_jpeg->mode !=3D MXC_JPEG_ENCODE) --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 653352797A3; Sat, 2 Aug 2025 09:30:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127008; cv=none; b=Jj2ywAoNqeAo2D8utraznNXkef3AZZq7CjbAvr8TbXuuL0RQnVnxGcdr6iidJMKaxnwZVsdO+9zOUXLekJy25HmHLLLJwIwYd6s9P3d8o/fPPdLzaU1cSeHfEU4N73dP82BYfci6a6+jFQeA77V+6O96XUtCTKpRFifbZIIGyBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127008; c=relaxed/simple; bh=DR8H5PIAc8L4JOzfoP4xWpCxebhDCEnaJqqWhPBFy+0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ug1QI8sYv+2Mkc4VBK7fi5t7+v77d31BgdPw3jz+E/rc5d70KLwRTtSLUjgUUKeezZipnQDEk+iXTdMNj4bz3noxa73LQtYAraof2nNRLSHEbhe6nixJzwlmk5Po94/b+HFpkeSh47s1wl5FGEs2t7xASy1YqpRnLCi5yKH4JlQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=hT8Gx6Bm; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hT8Gx6Bm" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EDA0D3C97; Sat, 2 Aug 2025 11:29:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126959; bh=DR8H5PIAc8L4JOzfoP4xWpCxebhDCEnaJqqWhPBFy+0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hT8Gx6BmOM76bDFeML8LExuJPTAnht6Wvn57/qJhB7+ZhlNMqfXhEkASH3NW3RuyW UZTqUXH/j8H6xn9lPsNIuJ1E2Ht2wzHcwFHMec6ZTXX4zFnaK3T8vOqZ9UuNg86A45 wLsnMm4kFRwPqYJBTI/nmtZ/BWbP+cVS1qJzP4Mw= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:02 +0200 Subject: [PATCH 40/65] media: imx-isi: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-40-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3477; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=DR8H5PIAc8L4JOzfoP4xWpCxebhDCEnaJqqWhPBFy+0=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj8EoZgkMCHL3+wASHVhjTV75Orj6SKgaDZA 6AcS4LUd4KJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/AAKCRByNAaPFqFW POVpD/9a3Ls6bK9algAcZ2oeiBjNz7tRIjEIwEqB46qB5Bq/kQDbriurqxVTCwNigHT9yYh0mXP 7cACNJ33RBJeyO9365kZBXs/wmIKGs/p4y+dJ8d2bdWddvcupEtgqZNitoozeu7ESiwRcXbm3y+ BoqB1V1jDTE11ypab29+vcaKo4qzSBIP3Hrtk4YeBKLn7gvYgaFBrNEonU6NKD9ODA/LIQulZRe 73jR/l7r+PYcnZ7Rx2T3rwKBgs8D83nyaNr0oEZik56YfleC18XsXP3MSfruSvbfjD6GZWeNrgd 712W4aBRF81a+B6kH5V8Aovltk00OUqLELIBHSUZ7El7W4Me1pXr/QPd6vAC1H+DRpxf2j40+RN TDxqmDHi3YGoi8kJ0PnEMVgSCBCaLXRuhS8dGLvwvkIDAcuHVFiPB8byYSwpkGOYBKB7luuYB7H 4xIhq9bAWnGPh09Xfuwcd9HL+8K5DLRYr1sqRYZZ55yszHbxWsYKKm4yD7EKfvDRiOMJb3LBBrX Z35HmnmFMEe15m2PWocAX01Sgl4eA0YFESsMERAWjZQgueknFQDoJGsL4JOMUxeaYI6kcUScc+3 RYuRDI3FkGlEJpgXEYQ+q+gim7m/X5v4sL1NiwSpLY259tUn9RHwSBlkYDikigIZORsM45vlmyz zSJL01P1ffA0xNA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it, remove the now unused to_isi_m2m_ctx() macro. Signed-off-by: Jacopo Mondi --- drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c b/drivers/m= edia/platform/nxp/imx8-isi/imx8-isi-m2m.c index 850dd8ae95841d4470ac6bd7cb1e54a7510d6d5e..5501214cc6c0ce3e0188ae6d4ff= 4ae277b975911 100644 --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c @@ -74,11 +74,6 @@ to_isi_m2m_buffer(struct vb2_v4l2_buffer *buf) return container_of(buf, struct mxc_isi_m2m_buffer, buf.vb); } =20 -static inline struct mxc_isi_m2m_ctx *to_isi_m2m_ctx(struct v4l2_fh *fh) -{ - return container_of(fh, struct mxc_isi_m2m_ctx, fh); -} - static inline struct mxc_isi_m2m_ctx *file_to_isi_m2m_ctx(struct file *fil= p) { return container_of(file_to_v4l2_fh(filp), struct mxc_isi_m2m_ctx, fh); @@ -432,7 +427,7 @@ static int mxc_isi_m2m_try_fmt_vid(struct file *file, v= oid *fh, const enum mxc_isi_video_type type =3D f->type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ? MXC_ISI_VIDEO_M2M_OUT : MXC_ISI_VIDEO_M2M_CAP; - struct mxc_isi_m2m_ctx *ctx =3D to_isi_m2m_ctx(fh); + struct mxc_isi_m2m_ctx *ctx =3D file_to_isi_m2m_ctx(file); =20 __mxc_isi_m2m_try_fmt_vid(ctx, &f->fmt.pix_mp, type); =20 @@ -442,7 +437,7 @@ static int mxc_isi_m2m_try_fmt_vid(struct file *file, v= oid *fh, static int mxc_isi_m2m_g_fmt_vid(struct file *file, void *fh, struct v4l2_format *f) { - struct mxc_isi_m2m_ctx *ctx =3D to_isi_m2m_ctx(fh); + struct mxc_isi_m2m_ctx *ctx =3D file_to_isi_m2m_ctx(file); const struct mxc_isi_m2m_ctx_queue_data *qdata =3D mxc_isi_m2m_ctx_qdata(ctx, f->type); =20 @@ -457,7 +452,7 @@ static int mxc_isi_m2m_s_fmt_vid(struct file *file, voi= d *fh, const enum mxc_isi_video_type type =3D f->type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ? MXC_ISI_VIDEO_M2M_OUT : MXC_ISI_VIDEO_M2M_CAP; - struct mxc_isi_m2m_ctx *ctx =3D to_isi_m2m_ctx(fh); + struct mxc_isi_m2m_ctx *ctx =3D file_to_isi_m2m_ctx(file); struct v4l2_pix_format_mplane *pix =3D &f->fmt.pix_mp; const struct mxc_isi_format_info *info; struct vb2_queue *vq; @@ -489,7 +484,7 @@ static int mxc_isi_m2m_s_fmt_vid(struct file *file, voi= d *fh, static int mxc_isi_m2m_streamon(struct file *file, void *fh, enum v4l2_buf_type type) { - struct mxc_isi_m2m_ctx *ctx =3D to_isi_m2m_ctx(fh); + struct mxc_isi_m2m_ctx *ctx =3D file_to_isi_m2m_ctx(file); struct mxc_isi_m2m_ctx_queue_data *q =3D mxc_isi_m2m_ctx_qdata(ctx, type); const struct v4l2_pix_format_mplane *out_pix =3D &ctx->queues.out.format; const struct v4l2_pix_format_mplane *cap_pix =3D &ctx->queues.cap.format; @@ -577,7 +572,7 @@ static int mxc_isi_m2m_streamon(struct file *file, void= *fh, static int mxc_isi_m2m_streamoff(struct file *file, void *fh, enum v4l2_buf_type type) { - struct mxc_isi_m2m_ctx *ctx =3D to_isi_m2m_ctx(fh); + struct mxc_isi_m2m_ctx *ctx =3D file_to_isi_m2m_ctx(file); struct mxc_isi_m2m_ctx_queue_data *q =3D mxc_isi_m2m_ctx_qdata(ctx, type); struct mxc_isi_m2m *m2m =3D ctx->m2m; =20 --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 7386F279DDB; Sat, 2 Aug 2025 09:30:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127016; cv=none; b=qYpMaQWb8DOabAhh6Q6h/Of7kPj+L6Ovkf58WbsAVsfbV/PZgsXK1LPEvpNyMoUtNMjUKDb68eIUXi7TY9REVG2qObm9Kzpv6Abn1MY9jAEQVVFPxs99Czfw3QoOXVtJHaY+xbry+THZQJRhal0OkWegSXoiyl/Aje9NtGcLASw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127016; c=relaxed/simple; bh=M2x6tXzxCjjFAUXbEL3SC1QII47wQxoBv/wBb1wDsp0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Dewt45cNFC6nHTbpUT4ngGZD4rM0QcjQmnwa4FsE9gOuGIBNlmE5cfMgzGw+LV6KD+DmVfqVMPvWfp7kJ18NmrQALThLzo9Qto0ZzTr8Oi/8iI59/Qp+1pQ+LFkHGCCSpJKz4CuuChgvqBM+hSII/Flfw2w9geLZ5q7DKPoyp0k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=i9zx++aQ; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="i9zx++aQ" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F05833F8F; Sat, 2 Aug 2025 11:29:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126967; bh=M2x6tXzxCjjFAUXbEL3SC1QII47wQxoBv/wBb1wDsp0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=i9zx++aQy/alvIpuEbDg4B8AZJJ6ljo40OX7t/PQh+QoqR2JKsunNOZik5UtJPOIh HkA0w1qtbec7i1eXH98uzHZHkmMQTSdGwYpy1rVrXNPF25rPMV/Q0resMuSAHRSHzr WRbwUjUj18J0V9ZzY59wjrgffWpq5xaH1xshksJw= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:03 +0200 Subject: [PATCH 41/65] media: nxp: mx2: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-41-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2558; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=M2x6tXzxCjjFAUXbEL3SC1QII47wQxoBv/wBb1wDsp0=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj8n9hAMD57A4gTd58HcmF9kOI9d41H8TaVb 6NpnZLKiN6JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/AAKCRByNAaPFqFW PPR3D/49Ma84Vh9j5F5lg+aITWx3vFs2W0Ao6fxs0ce6jAjUUycjjm5bMR9ul9yvs+bvwNYKCu/ /unwZHnferqh4e3z6zoxuYb5CSXpIxc1jr4Kk/EqeGOiKOnn/YkW+utx+fsqKKsVIK3uLt6FOta IRAVmTSR8HwUKkhJhuyYlHsJGaAkKoWSm2XBBa+OSM7TrXCqm+6xGIl1iAYtuma4zB0R8Z1bTx8 d1Kz+3QMgH29z52NvDsY4L+9bP3myDbJQBCBicACsU4DseVlbjXaqhtC8zrMi4wNQsxF3nyQg5w zw3tKqg+X/9n4dj8egNhtrzQ9fajVM1xp1exUiOe0JiH6u00E97/9DPUiXPiiAxpSpq4QTc1rd4 aCPhF7bX6bqcgmnb1by/d1vqkuaASPi/VRmo9x4tykyyWZfd8rh6IOkiGJf5V/wFf9qJz6zuOSX kCEGX03VCm2ksn8iOZMB5bPilBNd060ETYyKNsSODxpRwLbmfaN7wBbl3oOwV5WOWLM7Wn0znRs uwu8gEf8zravjInXPbM2xA1mhcei9mOg3RyrE43J4rwjCagzVyEwvT7d8Bf731bR0ng6svImvD3 p+kgM+LGY/7CfBWG3zHWNRPfvzpPzytKg/8ZNIqHfTSj0gqunclhwK7YXop3L5pAAwnCvhko2yA fM1004fYqBkAsEA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- drivers/media/platform/nxp/mx2_emmaprp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/nxp/mx2_emmaprp.c b/drivers/media/platf= orm/nxp/mx2_emmaprp.c index d23da93304bd6f55898cfb96319d2fa101036ca1..3aae8c0b690c0b1b0dd4f05a1c9= 184b089719a20 100644 --- a/drivers/media/platform/nxp/mx2_emmaprp.c +++ b/drivers/media/platform/nxp/mx2_emmaprp.c @@ -456,13 +456,13 @@ static int vidioc_g_fmt(struct emmaprp_ctx *ctx, stru= ct v4l2_format *f) static int vidioc_g_fmt_vid_out(struct file *file, void *priv, struct v4l2_format *f) { - return vidioc_g_fmt(priv, f); + return vidioc_g_fmt(file_to_emmaprp_ctx(file), f); } =20 static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { - return vidioc_g_fmt(priv, f); + return vidioc_g_fmt(file_to_emmaprp_ctx(file), f); } =20 static int vidioc_try_fmt(struct v4l2_format *f) @@ -502,8 +502,8 @@ static int vidioc_try_fmt(struct v4l2_format *f) static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { + struct emmaprp_ctx *ctx =3D file_to_emmaprp_ctx(file); struct emmaprp_fmt *fmt; - struct emmaprp_ctx *ctx =3D priv; =20 fmt =3D find_format(f); if (!fmt || !(fmt->types & MEM2MEM_CAPTURE)) { @@ -519,8 +519,8 @@ static int vidioc_try_fmt_vid_cap(struct file *file, vo= id *priv, static int vidioc_try_fmt_vid_out(struct file *file, void *priv, struct v4l2_format *f) { + struct emmaprp_ctx *ctx =3D file_to_emmaprp_ctx(file); struct emmaprp_fmt *fmt; - struct emmaprp_ctx *ctx =3D priv; =20 fmt =3D find_format(f); if (!fmt || !(fmt->types & MEM2MEM_OUTPUT)) { @@ -580,7 +580,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void= *priv, if (ret) return ret; =20 - return vidioc_s_fmt(priv, f); + return vidioc_s_fmt(file_to_emmaprp_ctx(file), f); } =20 static int vidioc_s_fmt_vid_out(struct file *file, void *priv, @@ -592,7 +592,7 @@ static int vidioc_s_fmt_vid_out(struct file *file, void= *priv, if (ret) return ret; =20 - return vidioc_s_fmt(priv, f); + return vidioc_s_fmt(file_to_emmaprp_ctx(file), f); } =20 static const struct v4l2_ioctl_ops emmaprp_ioctl_ops =3D { --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 4EDAD202C58; Sat, 2 Aug 2025 09:30:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127030; cv=none; b=Xe/5VAyh6LJqbkXoJTgFk2eBSsgVtm9BjCodXQMPZPSKvotaIDIG+2RxxdjgHAdTyE+QMI3CgWbNj5odHNT4NAs4bzHxhz6mkn8pru8IcguzG7zYyN9UonNOTmIwNJTF3qA9RI/NNNkHfJ9VTROKAzu/KldFDCMLHYWf6Zgt6d8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127030; c=relaxed/simple; bh=r9EmdW9i1TpnM68OPWTkjqIluWnJXR3RjvZTO/X9K3g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VAzDVkA1R6RbeK/zuUSv0OoGhvXSzSlb2LSMhIHMh+2LFyp44HK0J/InVydeffN3b2sE90tHRLQarfWsa75pvRG9rGbTkQ3lB51utwtaT0lr3dlyF7mdICKUvYOV7f9zDOmIuXkl7gFLaliKiriSKho6I6pFU2uy1v1VaMyZbMg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=wcMF2qKe; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="wcMF2qKe" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E971D3F0F; Sat, 2 Aug 2025 11:29:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126981; bh=r9EmdW9i1TpnM68OPWTkjqIluWnJXR3RjvZTO/X9K3g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=wcMF2qKeeP2cktp7fqhd2vjW0xiaN/orYcLh5U3pkhxKwKjpY2k/E49wUHJ2Xgb9w HyHrijr4L+cjv6j9Ecd5TI6MOGRecES0E9m9jZHRYTzcyrQn1vjjmhPS7WEfLFVmF7 iyjssYOY0wyo3gcdLqTDXcLyOhvPfhvhQzAmFN4s= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:04 +0200 Subject: [PATCH 42/65] media: renesas: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-42-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5921; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=r9EmdW9i1TpnM68OPWTkjqIluWnJXR3RjvZTO/X9K3g=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj8t8qErd8Gcnukq8YAN1PzdPUhY0KWPYAx6 WnkJP0eq1OJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/AAKCRByNAaPFqFW PBQuEACOm3E3t7R/ETMWYIrxOOSYylsbXMC53sRw2HfKxw/zvZVMKNOD5+z4nylQitLk5k2xu3W lqwgyikKsFoEDXwSDoaZWFmxNpu//6BR4IUp8/iWn/xQmfQdppY0FHkojEVSCZFJcLk1wdkhMYu 19wy9T5//atcRQyOCVf7f5Hj4UjwsbyZGPz+GSG7Ymt/h0PCArKk5pC2RJq2YNu+zUiekqODyve EN6rZRIdW3aSd56Kicu7U3CeFDY/nVj7bdFZ9czT5zyLkF6sXVojy9pcdDlMAkP7+BGXHXfSJ8o s0aCcfw26jDKQiCcRo880H0r/z5E3zOKJWovHvIAo0MN8LHWaz4OTXVdPR+519xm+XhtcQ1Yw14 af5SwUtDjXE9DskQ6ycaMMQmv/VWBkIseTQS/99v2XVLJxBadUojy2o7VtB5wczPhH/L+MI7LQc 5RsQM/m09BN6SFjvf33xmaZiOKKAzLpkdieFoCM85jPMhyxtE3nq1qKHPPzk2h3RUFMpp2xLFD+ hKpE9Vee/FqJhdLGU8xkQ6Bx816/tvp0SvG4YybmUIRiKwW+bsS7K03oxf9CdE6gvY2YTJEC6QZ svUsHWdy0E/nmSm+TXrF6LhWinQJYgsErYee7cnfayg1I0A5jg/X99y9A0fk5owEjFECEb7khY3 xt1/NbTqZcgyrUQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it, remove the now unused fh_to_ctx() macro. Signed-off-by: Jacopo Mondi --- drivers/media/platform/renesas/rcar_fdp1.c | 11 +++-------- drivers/media/platform/renesas/rcar_jpu.c | 21 ++++++++------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/drivers/media/platform/renesas/rcar_fdp1.c b/drivers/media/pla= tform/renesas/rcar_fdp1.c index e78d8fb104e9544d27c8ace38888995ca170483f..84c3901a2e5dc3e7ccfb3b44062= e839f8f19ee02 100644 --- a/drivers/media/platform/renesas/rcar_fdp1.c +++ b/drivers/media/platform/renesas/rcar_fdp1.c @@ -630,11 +630,6 @@ struct fdp1_ctx { struct fdp1_field_buffer *previous; }; =20 -static inline struct fdp1_ctx *fh_to_ctx(struct v4l2_fh *fh) -{ - return container_of(fh, struct fdp1_ctx, fh); -} - static inline struct fdp1_ctx *file_to_ctx(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct fdp1_ctx, fh); @@ -1411,8 +1406,8 @@ static int fdp1_enum_fmt_vid_out(struct file *file, v= oid *priv, =20 static int fdp1_g_fmt(struct file *file, void *priv, struct v4l2_format *f) { + struct fdp1_ctx *ctx =3D file_to_ctx(file); struct fdp1_q_data *q_data; - struct fdp1_ctx *ctx =3D fh_to_ctx(priv); =20 if (!v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type)) return -EINVAL; @@ -1589,7 +1584,7 @@ static void fdp1_try_fmt_capture(struct fdp1_ctx *ctx, =20 static int fdp1_try_fmt(struct file *file, void *priv, struct v4l2_format = *f) { - struct fdp1_ctx *ctx =3D fh_to_ctx(priv); + struct fdp1_ctx *ctx =3D file_to_ctx(file); =20 if (f->type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) fdp1_try_fmt_output(ctx, NULL, &f->fmt.pix_mp); @@ -1660,7 +1655,7 @@ static void fdp1_set_format(struct fdp1_ctx *ctx, =20 static int fdp1_s_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct fdp1_ctx *ctx =3D fh_to_ctx(priv); + struct fdp1_ctx *ctx =3D file_to_ctx(file); struct v4l2_m2m_ctx *m2m_ctx =3D ctx->fh.m2m_ctx; struct vb2_queue *vq =3D v4l2_m2m_get_vq(m2m_ctx, f->type); =20 diff --git a/drivers/media/platform/renesas/rcar_jpu.c b/drivers/media/plat= form/renesas/rcar_jpu.c index 058fcfb967bd98440f33272db42f0d973299d572..9c70a74a2969fce6446b0f26e06= 37a68eade3942 100644 --- a/drivers/media/platform/renesas/rcar_jpu.c +++ b/drivers/media/platform/renesas/rcar_jpu.c @@ -480,11 +480,6 @@ static struct jpu_ctx *ctrl_to_ctx(struct v4l2_ctrl *c) return container_of(c->handler, struct jpu_ctx, ctrl_handler); } =20 -static struct jpu_ctx *fh_to_ctx(struct v4l2_fh *fh) -{ - return container_of(fh, struct jpu_ctx, fh); -} - static struct jpu_ctx *file_to_ctx(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct jpu_ctx, fh); @@ -661,7 +656,7 @@ static u8 jpu_parse_hdr(void *buffer, unsigned long siz= e, unsigned int *width, static int jpu_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct jpu_ctx *ctx =3D fh_to_ctx(priv); + struct jpu_ctx *ctx =3D file_to_ctx(file); =20 if (ctx->encoder) strscpy(cap->card, DRV_NAME " encoder", sizeof(cap->card)); @@ -719,7 +714,7 @@ static int jpu_enum_fmt(struct v4l2_fmtdesc *f, u32 typ= e) static int jpu_enum_fmt_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct jpu_ctx *ctx =3D fh_to_ctx(priv); + struct jpu_ctx *ctx =3D file_to_ctx(file); =20 return jpu_enum_fmt(f, ctx->encoder ? JPU_ENC_CAPTURE : JPU_DEC_CAPTURE); @@ -728,7 +723,7 @@ static int jpu_enum_fmt_cap(struct file *file, void *pr= iv, static int jpu_enum_fmt_out(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct jpu_ctx *ctx =3D fh_to_ctx(priv); + struct jpu_ctx *ctx =3D file_to_ctx(file); =20 return jpu_enum_fmt(f, ctx->encoder ? JPU_ENC_OUTPUT : JPU_DEC_OUTPUT); } @@ -828,7 +823,7 @@ static int __jpu_try_fmt(struct jpu_ctx *ctx, struct jp= u_fmt **fmtinfo, =20 static int jpu_try_fmt(struct file *file, void *priv, struct v4l2_format *= f) { - struct jpu_ctx *ctx =3D fh_to_ctx(priv); + struct jpu_ctx *ctx =3D file_to_ctx(file); =20 if (!v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type)) return -EINVAL; @@ -839,7 +834,7 @@ static int jpu_try_fmt(struct file *file, void *priv, s= truct v4l2_format *f) static int jpu_s_fmt(struct file *file, void *priv, struct v4l2_format *f) { struct vb2_queue *vq; - struct jpu_ctx *ctx =3D fh_to_ctx(priv); + struct jpu_ctx *ctx =3D file_to_ctx(file); struct v4l2_m2m_ctx *m2m_ctx =3D ctx->fh.m2m_ctx; struct jpu_fmt *fmtinfo; struct jpu_q_data *q_data; @@ -868,8 +863,8 @@ static int jpu_s_fmt(struct file *file, void *priv, str= uct v4l2_format *f) =20 static int jpu_g_fmt(struct file *file, void *priv, struct v4l2_format *f) { + struct jpu_ctx *ctx =3D file_to_ctx(file); struct jpu_q_data *q_data; - struct jpu_ctx *ctx =3D fh_to_ctx(priv); =20 if (!v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type)) return -EINVAL; @@ -902,8 +897,8 @@ static const struct v4l2_ctrl_ops jpu_ctrl_ops =3D { =20 static int jpu_streamon(struct file *file, void *priv, enum v4l2_buf_type = type) { - struct jpu_ctx *ctx =3D fh_to_ctx(priv); struct jpu_q_data *src_q_data, *dst_q_data, *orig, adj, *ref; + struct jpu_ctx *ctx =3D file_to_ctx(file); enum v4l2_buf_type adj_type; =20 src_q_data =3D jpu_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); @@ -1284,8 +1279,8 @@ static int jpu_open(struct file *file) =20 static int jpu_release(struct file *file) { - struct jpu *jpu =3D video_drvdata(file); struct jpu_ctx *ctx =3D file_to_ctx(file); + struct jpu *jpu =3D video_drvdata(file); =20 v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); v4l2_ctrl_handler_free(&ctx->ctrl_handler); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 87AB7202C58; Sat, 2 Aug 2025 09:30:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127038; cv=none; b=K9KqqwJ5c390cTdQ6BSeupfo2jBKYkpqzA38vAIv8fMYkpRhG09KlUi786VN7K3DWuOTMGxcbhjiVt86Z0feigy4JwiPuygER9KZXnCPryxt83Ge7K9m7Nql/lBiT5KFyQ7JexCbN7tM2tuzlyFmE/zrWDy9c82e5rgrSwb5VsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127038; c=relaxed/simple; bh=myVmSWYpHXIiztgrX4Nbrz2tt4YIb4c7beKoOCYKNI8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tsor8AO7Sxtg8mYSeuZPUK1oJfVkwo2DpSbcPuGjLpnDVPbw1DLSsElDUpWb60zahmEDzim9eSNpnJP8bUvXbK0WhnWwvf7fvjlXhqTOqHZ+IFC6582THy7cKQ4Xb96VkucneHV+jakTCw8mcGJwOR+PzMRhHdE8OcwfIg4uLq0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=QbRPXMxC; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="QbRPXMxC" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id ECBE63C6E; Sat, 2 Aug 2025 11:29:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126989; bh=myVmSWYpHXIiztgrX4Nbrz2tt4YIb4c7beKoOCYKNI8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QbRPXMxClSG+25IAt4oxV96cFHKcviPLixdfqrSDzLcPwvWgGgvIRo50l5ww6D3IK Kmv9Ks6g/gci/i2jR1Ii5hzUnPUR3QYANiVjpHd5IsdNJWzE+5wygun8SqKXIHhqCi xz+TVzEYqOd0uNepbZV7dK/LW9Ec3RfJXm4/uk2I= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:05 +0200 Subject: [PATCH 43/65] media: rockhip: rga: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-43-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2197; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=myVmSWYpHXIiztgrX4Nbrz2tt4YIb4c7beKoOCYKNI8=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj8bCtcXrZDq0XjKLnfeb21Qxsw9vktTvwYZ I8b1Ve5FRiJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/AAKCRByNAaPFqFW PJerD/wPNsB4FoQmDjS+Q2bgvOYg1HMkC42KAS+62lqBwK9OjkMw5wdywbBTFVeAO7/aoTCDScD yaUKSkF5RIqchlj+RO4Fa3fXWvdbRYfYpEFp0EnPQxkJDfsd9xAIXoVxPIaEasZ77ZQWuXrwfn5 9EnPq+6b9yaVDD6W0KF2Cm5V7S9Zbm8l7NrJRBO79plfdkHjIux7O67NnUg2I+6yfQIPw/lP5Ka zdWfiKBOmgWFRUQm4sI/0lHkPp+KThqrCq9CAMoxKILayA4NNC4JtPrP7ungcho77BKXBKL5mXW h1EoMrBYp+mRVweuy/YfN5F7wCaS7v1moLkiVEAY0S45X685QTspJhlewfsMyDIOJUCNTCPejJV biw7C0PdiRlREDEAwu5Ek1ACd09LU9uov8HmE5kki5FRUIRJHNqNI+gquFNumbhuRwfLpCneuLY u2i4QhmC/EJ2NVmyQFGPJthMLMjeAD1fNVa8a0W+AosRLcgV164/Zzk41RNSGleeJSKNbEj8mvy 2JhIDecUDT+kETEC5GSA2UJElubl0KSPWDHdrDa7P+fnFfWsX3DYhIxPU+4ZB5gXoHiCWoxYBSq yFlTXFLCz9RCU7s879GUKIUTEZIvGggHd9u7cMgyh5Bc2/9Cm+qwEvi0fAgKJ+fGwx0ZxFRIrSn mpL2fgUgHW/KBvA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- drivers/media/platform/rockchip/rga/rga.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/plat= form/rockchip/rga/rga.c index 45c42c7ad846fab985e573ef7acf4a5bc1a4cac1..7c657df623f2897cd1ce2b6fa4c= 4b4de369f1c64 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -462,7 +462,7 @@ static int vidioc_enum_fmt(struct file *file, void *prv= , struct v4l2_fmtdesc *f) static int vidioc_g_fmt(struct file *file, void *prv, struct v4l2_format *= f) { struct v4l2_pix_format_mplane *pix_fmt =3D &f->fmt.pix_mp; - struct rga_ctx *ctx =3D prv; + struct rga_ctx *ctx =3D file_to_rga_ctx(file); struct vb2_queue *vq; struct rga_frame *frm; =20 @@ -504,7 +504,7 @@ static int vidioc_try_fmt(struct file *file, void *prv,= struct v4l2_format *f) static int vidioc_s_fmt(struct file *file, void *prv, struct v4l2_format *= f) { struct v4l2_pix_format_mplane *pix_fmt =3D &f->fmt.pix_mp; - struct rga_ctx *ctx =3D prv; + struct rga_ctx *ctx =3D file_to_rga_ctx(file); struct rockchip_rga *rga =3D ctx->rga; struct vb2_queue *vq; struct rga_frame *frm; @@ -561,7 +561,7 @@ static int vidioc_s_fmt(struct file *file, void *prv, s= truct v4l2_format *f) static int vidioc_g_selection(struct file *file, void *prv, struct v4l2_selection *s) { - struct rga_ctx *ctx =3D prv; + struct rga_ctx *ctx =3D file_to_rga_ctx(file); struct rga_frame *f; bool use_frame =3D false; =20 @@ -609,7 +609,7 @@ static int vidioc_g_selection(struct file *file, void *= prv, static int vidioc_s_selection(struct file *file, void *prv, struct v4l2_selection *s) { - struct rga_ctx *ctx =3D prv; + struct rga_ctx *ctx =3D file_to_rga_ctx(file); struct rockchip_rga *rga =3D ctx->rga; struct rga_frame *f; int ret =3D 0; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 E239F226D14; Sat, 2 Aug 2025 09:30:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127046; cv=none; b=s5DKyFaoHsHsKb7AAXZYNHNE72joiz/yRq4pSvib1zkqRA5GPjX76dimgcQVRGj1amjbADF6S7rGuId4b/5G8Vw/pXQHOGuQCcF7rg5Ia3OIh+FTa6okouN67FolwgAXqbVgHurUvJ7vVK0s0ZzJmln5zoN3p4KlNeszjg0UYZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127046; c=relaxed/simple; bh=N/+SmX8uCSElsoQI/Kb0w5aCmhV7erqVc0DGwURG/AA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=c+YE+s4IDak89sd7QbCllO0Fnd9T7rmR/h2CFOLGVNl37lXu1p7mb5w8zOR1OsRf7THK1vBFiygFBsSNruqRtLnYUcWaaD3R5kk/5mUx1KEApG7VrOmCzjaMpOI0J+ca5tnAK5lLQ8UIR5gENpc9ap9WzmM/VrNpX+yfXGiN7hE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=O2ythKO2; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="O2ythKO2" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1F3D640D7; Sat, 2 Aug 2025 11:29:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126997; bh=N/+SmX8uCSElsoQI/Kb0w5aCmhV7erqVc0DGwURG/AA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=O2ythKO2VLeSyaJW1M/PqCX/Mkk5kckpbF0P3b/mXShykQUmZpyRwP7cnS0GIDbL/ 1DUlZhDvcIq3FFW01jGr4U4d4DEVv0toEN/a34f1d+8i68oIA7/0jOonpdg6HBRSO7 wRvxI6vA7eAfOnezFzDfnkMhxtBedOLidMjxv5pM= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:06 +0200 Subject: [PATCH 44/65] media: rockchip: rkvdec: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-44-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4093; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=N/+SmX8uCSElsoQI/Kb0w5aCmhV7erqVc0DGwURG/AA=; b=owEBbAKT/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj8GhGRoLbVmqgvZIfiBugvAzZbpSmTSf59f 8yjByt2IQaJAjIEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/AAKCRByNAaPFqFW PHoxD/dZpPaC6C0cHgs+6v+St9wjgRkVaZQPtX28YtuVqRe+UWHscNIwGphLs9NBDuLq0g5atP1 LlhxmW2GY0FLrU4ODHwmd2p6qM2Z/1jKYgj7s1BQO2pqpNekk0WFWK/1MBsyFftm2KbE6oxHHb3 MjzTehWud6ey9ZZ/xS0hq47jkIbh6C5rPk0jX8ArRlL/YT7DyODiZjLZ8k+HfWKXGaqHpCLH03e k/ubxOnY0OApTrAZHcAFipujf6N9fp7vOhuJC9xF14G7CDyfWpB9prIJmN0KTo0HIYmkwXijHZ7 4hZq9Q6YOdfcUTg4V9X6r7bqBaPLXLGiqhMscoH26A1VxzfD8nW80Pdh81jYWLRnGY36eA+vI5l ifXsoAohqQtUSZNhDJVW7R4RAw4hSqkoQMRaDZp4V0oE6bE8IPS/MYKYYk6DB4BCctHM4IoY4p9 YIuYtS8UzM4mMzVTAekk4U0uJPhk48PVxf6M62ZzNCIMVW/6zKhpm/neqruVAO8i+MvPzeIxTvs OgqunbBOS20rPOU/kLg7qxZXeDBSf2bxjfnD+vNmdF4d8meyw+aAL9iesbcUAUnh7p8+K1IXNXs wkwZ3h4Awk9cg/sCpbpXDN22PLzLj8gBJQ1zdSBXuK34VXa2RLneYzBhWuyXvnhKBo7xKyVWcy6 m59/g+/Cysrlb X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it, remove the now unused fh_to_rkvdec_ctx() macro. Signed-off-by: Jacopo Mondi --- drivers/media/platform/rockchip/rkvdec/rkvdec.c | 14 +++++++------- drivers/media/platform/rockchip/rkvdec/rkvdec.h | 5 ----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/medi= a/platform/rockchip/rkvdec/rkvdec.c index 481c2488f9ac64e70869ed21e5053cfbc4ed6e0e..9fa80ab3c62b7753e6c992aefd1= 06ee99ed375e4 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c @@ -354,7 +354,7 @@ static int rkvdec_try_capture_fmt(struct file *file, vo= id *priv, struct v4l2_format *f) { struct v4l2_pix_format_mplane *pix_mp =3D &f->fmt.pix_mp; - struct rkvdec_ctx *ctx =3D fh_to_rkvdec_ctx(priv); + struct rkvdec_ctx *ctx =3D file_to_rkvdec_ctx(file); const struct rkvdec_coded_fmt_desc *coded_desc; =20 /* @@ -387,7 +387,7 @@ static int rkvdec_try_output_fmt(struct file *file, voi= d *priv, struct v4l2_format *f) { struct v4l2_pix_format_mplane *pix_mp =3D &f->fmt.pix_mp; - struct rkvdec_ctx *ctx =3D fh_to_rkvdec_ctx(priv); + struct rkvdec_ctx *ctx =3D file_to_rkvdec_ctx(file); const struct rkvdec_coded_fmt_desc *desc; =20 desc =3D rkvdec_find_coded_fmt_desc(pix_mp->pixelformat); @@ -418,7 +418,7 @@ static int rkvdec_try_output_fmt(struct file *file, voi= d *priv, static int rkvdec_s_capture_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct rkvdec_ctx *ctx =3D fh_to_rkvdec_ctx(priv); + struct rkvdec_ctx *ctx =3D file_to_rkvdec_ctx(file); struct vb2_queue *vq; int ret; =20 @@ -439,7 +439,7 @@ static int rkvdec_s_capture_fmt(struct file *file, void= *priv, static int rkvdec_s_output_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct rkvdec_ctx *ctx =3D fh_to_rkvdec_ctx(priv); + struct rkvdec_ctx *ctx =3D file_to_rkvdec_ctx(file); struct v4l2_m2m_ctx *m2m_ctx =3D ctx->fh.m2m_ctx; const struct rkvdec_coded_fmt_desc *desc; struct v4l2_format *cap_fmt; @@ -504,7 +504,7 @@ static int rkvdec_s_output_fmt(struct file *file, void = *priv, static int rkvdec_g_output_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct rkvdec_ctx *ctx =3D fh_to_rkvdec_ctx(priv); + struct rkvdec_ctx *ctx =3D file_to_rkvdec_ctx(file); =20 *f =3D ctx->coded_fmt; return 0; @@ -513,7 +513,7 @@ static int rkvdec_g_output_fmt(struct file *file, void = *priv, static int rkvdec_g_capture_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct rkvdec_ctx *ctx =3D fh_to_rkvdec_ctx(priv); + struct rkvdec_ctx *ctx =3D file_to_rkvdec_ctx(file); =20 *f =3D ctx->decoded_fmt; return 0; @@ -532,7 +532,7 @@ static int rkvdec_enum_output_fmt(struct file *file, vo= id *priv, static int rkvdec_enum_capture_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct rkvdec_ctx *ctx =3D fh_to_rkvdec_ctx(priv); + struct rkvdec_ctx *ctx =3D file_to_rkvdec_ctx(file); u32 fourcc; =20 fourcc =3D rkvdec_enum_decoded_fmt(ctx, f->index, ctx->image_fmt); diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.h b/drivers/medi= a/platform/rockchip/rkvdec/rkvdec.h index 35effe9467845fdfc4ffea432211d1d2e75a08b0..481aaa4bffe975fa106fb22e78b= ef90ade86a6cf 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.h +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.h @@ -124,11 +124,6 @@ struct rkvdec_ctx { void *priv; }; =20 -static inline struct rkvdec_ctx *fh_to_rkvdec_ctx(struct v4l2_fh *fh) -{ - return container_of(fh, struct rkvdec_ctx, fh); -} - static inline struct rkvdec_ctx *file_to_rkvdec_ctx(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct rkvdec_ctx, fh); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 B9C4E226D14; Sat, 2 Aug 2025 09:30:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127054; cv=none; b=IM6ylgQwpkM8AcpmZAsX7qT0oVCP4sSRtPvS0sNJz0oIQO7I6VPLwjblrznsG9sO8vas/vuBSBYTuwu9j33ErPhpL4gzFxNoLVB/hGzuNf4YTneolKgREalxifLR1wfbtRIal/N7Y8U31XcGE0/b6jSzZILNng8Quhaxa9zWnI0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127054; c=relaxed/simple; bh=xHnhOGEMWbiAskGZ/qB9Pnn4oRUTnceFuQgyRVWi5Z4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hW6UouFDDHcpOp5MMChvcVD+D5R2TYS8yNZLsDfCZmFYSepaRyAByuEHmGT1m/VV7kznc6xnacBlZT2l6Y0greDgiWA34aKxOdYHInmbP5X5yXLIJgKolf5omN++sXVmGV+1zWmfLqr27YAEfziEpoOQhKnpA3YmC8+hdRz1rpM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Qm8VlMMd; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Qm8VlMMd" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 10B5D4126; Sat, 2 Aug 2025 11:29:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127005; bh=xHnhOGEMWbiAskGZ/qB9Pnn4oRUTnceFuQgyRVWi5Z4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Qm8VlMMdD2mYpZ3jp8TiUK71YniJfD/W+U3FXDvkjAOJ90OJwj4al+DQ5JYMy5IJA V1dTufXhg0/73p0n/9BN0o2p9OtealswLjQtP6Ul/KN2+PcPPz23WefAZU8vnmwaCp JlEi0d/D0b6LzhryhAg86Gmp9WQNciqsWUkiM9A4= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:07 +0200 Subject: [PATCH 45/65] media: exynos-gsc: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-45-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5168; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=xHnhOGEMWbiAskGZ/qB9Pnn4oRUTnceFuQgyRVWi5Z4=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj8mJTRrXDLZmlcFTn5RabMqJPlofNXwIR40 Mp7zonG0TCJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/AAKCRByNAaPFqFW POP5D/0YMuyBDL0G469A3dQex0lq+u9oMevFJtDvon3YgoFWn8rVfh39dM7Miv2PMU5cy/NsTLd f+3KO1inbR/ppCbjkFdOoYPxszXvrr+AYE4PQQ6dmoXMGfaYzKhCEaGBISizKwCe8C1VE1wQjnx beevIt1FLO/FDXjoII+Hk+gNLEapJgchdW76opTMxcU1f9k+ldr7BuLho65E9Z5z+CAwNuTsxDT W+NYh6ak5wp6eMTlBQeYtpJeY/f0ZZIVSFX9uuvwTXSLGSPCsonZosaKOL2oasrhdQy7zyAePGs Xu8DpRyTeJJEuEWAHEGq8MIsNz9fBS7qz/q5BdJrRnFEQFDi5SZ3+hopYbp3ZgPam9BtJQviGLe hWd0d9slmpAZ4i67M1dNiJUfdB22NDRPprPqV7IDSI8mBSdracO/VcBDwKgS7YLAMpHz9/DIIrn XPfwHPeTtH5Wn608pM8qqwAjAQrNNVr+yxoD7bfbROE2thO94uVX1GzAL2BxBhrwpWws1SlCSh0 L7h7MSfCAjgQ/a+MiZ8cjrGqN87HOh8zG3nAhWmyzaTLW040hsL6w+BNotcPAR0CvvEtQV22/hE TK79grAfwHWgcbGKQTOA1yO79fNp5t73ipYVezgZErk4LcQA7FFGjTVRzJ3AOu3j+EPkzTuR/Rq qF7qIxPbZn5s6iQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it, remove the now unused fh_to_ctx() macro. Signed-off-by: Jacopo Mondi --- .../media/platform/samsung/exynos-gsc/gsc-core.h | 2 -- .../media/platform/samsung/exynos-gsc/gsc-m2m.c | 24 +++++++++++-------= ---- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/samsung/exynos-gsc/gsc-core.h b/drivers= /media/platform/samsung/exynos-gsc/gsc-core.h index a5491fe39e0f686c75c888c4632150f32326c36e..265221abf4dcd87f2ab10758e14= 5fa96ac9d420e 100644 --- a/drivers/media/platform/samsung/exynos-gsc/gsc-core.h +++ b/drivers/media/platform/samsung/exynos-gsc/gsc-core.h @@ -85,8 +85,6 @@ enum gsc_yuv_fmt { GSC_CRCB, }; =20 -#define fh_to_ctx(__fh) container_of(__fh, struct gsc_ctx, fh) - #define is_rgb(x) (!!((x) & 0x1)) #define is_yuv420(x) (!!((x) & 0x2)) #define is_yuv422(x) (!!((x) & 0x4)) diff --git a/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c b/drivers/= media/platform/samsung/exynos-gsc/gsc-m2m.c index 2999fb2610f0f61b63d0331f94883469ff43d751..722e2531e23f1bc01f5e9a9c08d= fe4745cc2aa4f 100644 --- a/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c @@ -297,7 +297,7 @@ static int gsc_m2m_enum_fmt(struct file *file, void *pr= iv, static int gsc_m2m_g_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct gsc_ctx *ctx =3D fh_to_ctx(fh); + struct gsc_ctx *ctx =3D file_to_ctx(file); =20 return gsc_g_fmt_mplane(ctx, f); } @@ -305,7 +305,7 @@ static int gsc_m2m_g_fmt_mplane(struct file *file, void= *fh, static int gsc_m2m_try_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct gsc_ctx *ctx =3D fh_to_ctx(fh); + struct gsc_ctx *ctx =3D file_to_ctx(file); =20 return gsc_try_fmt_mplane(ctx, f); } @@ -313,7 +313,7 @@ static int gsc_m2m_try_fmt_mplane(struct file *file, vo= id *fh, static int gsc_m2m_s_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct gsc_ctx *ctx =3D fh_to_ctx(fh); + struct gsc_ctx *ctx =3D file_to_ctx(file); struct vb2_queue *vq; struct gsc_frame *frame; struct v4l2_pix_format_mplane *pix; @@ -359,7 +359,7 @@ static int gsc_m2m_s_fmt_mplane(struct file *file, void= *fh, static int gsc_m2m_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers *reqbufs) { - struct gsc_ctx *ctx =3D fh_to_ctx(fh); + struct gsc_ctx *ctx =3D file_to_ctx(file); struct gsc_dev *gsc =3D ctx->gsc_dev; u32 max_cnt; =20 @@ -374,35 +374,35 @@ static int gsc_m2m_reqbufs(struct file *file, void *f= h, static int gsc_m2m_expbuf(struct file *file, void *fh, struct v4l2_exportbuffer *eb) { - struct gsc_ctx *ctx =3D fh_to_ctx(fh); + struct gsc_ctx *ctx =3D file_to_ctx(file); return v4l2_m2m_expbuf(file, ctx->m2m_ctx, eb); } =20 static int gsc_m2m_querybuf(struct file *file, void *fh, struct v4l2_buffer *buf) { - struct gsc_ctx *ctx =3D fh_to_ctx(fh); + struct gsc_ctx *ctx =3D file_to_ctx(file); return v4l2_m2m_querybuf(file, ctx->m2m_ctx, buf); } =20 static int gsc_m2m_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf) { - struct gsc_ctx *ctx =3D fh_to_ctx(fh); + struct gsc_ctx *ctx =3D file_to_ctx(file); return v4l2_m2m_qbuf(file, ctx->m2m_ctx, buf); } =20 static int gsc_m2m_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) { - struct gsc_ctx *ctx =3D fh_to_ctx(fh); + struct gsc_ctx *ctx =3D file_to_ctx(file); return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf); } =20 static int gsc_m2m_streamon(struct file *file, void *fh, enum v4l2_buf_type type) { - struct gsc_ctx *ctx =3D fh_to_ctx(fh); + struct gsc_ctx *ctx =3D file_to_ctx(file); =20 /* The source and target color format need to be set */ if (V4L2_TYPE_IS_OUTPUT(type)) { @@ -418,7 +418,7 @@ static int gsc_m2m_streamon(struct file *file, void *fh, static int gsc_m2m_streamoff(struct file *file, void *fh, enum v4l2_buf_type type) { - struct gsc_ctx *ctx =3D fh_to_ctx(fh); + struct gsc_ctx *ctx =3D file_to_ctx(file); return v4l2_m2m_streamoff(file, ctx->m2m_ctx, type); } =20 @@ -440,8 +440,8 @@ static int is_rectangle_enclosed(struct v4l2_rect *a, s= truct v4l2_rect *b) static int gsc_m2m_g_selection(struct file *file, void *fh, struct v4l2_selection *s) { + struct gsc_ctx *ctx =3D file_to_ctx(file); struct gsc_frame *frame; - struct gsc_ctx *ctx =3D fh_to_ctx(fh); =20 if ((s->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) && (s->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT)) @@ -478,7 +478,7 @@ static int gsc_m2m_s_selection(struct file *file, void = *fh, struct v4l2_selection *s) { struct gsc_frame *frame; - struct gsc_ctx *ctx =3D fh_to_ctx(fh); + struct gsc_ctx *ctx =3D file_to_ctx(file); struct gsc_variant *variant =3D ctx->gsc_dev->variant; struct v4l2_selection sel =3D *s; int ret; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 24E51254878; Sat, 2 Aug 2025 09:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127062; cv=none; b=W3UALcU7/NwzrF88hHZnohFYQKEgLNGRsywaLYVeiYzSIma8Sb+KjmGkavx1YUyzDGWRCoHuNfFY//W59t3U8qSpsAnv9krNhqvrCRK0yPJwOR9ebO9iSJgCH95r2tjThqgDYfwUgG41LTGtnf04adpAG+oAOm5Pv/ulcHf8TAA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127062; c=relaxed/simple; bh=Zf/YF3LmVEiKTVMxhxN0Gc3jRXrBb3FeFalAScFj6mo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kxT6cCgLIpVSvmJyWam6cTBFKF2xpK6ch3NzGne717zefud4EfVf6rGR0N2FNf2kHKDDmI73WkyTpDoEA2F2o8P2ir4tYroVyy0s4dsnWtLVM0fm99aeuNz0CPu/nfwCWHKsj6P57WHmBEsnj1GOFs53qrD6GOaB+cSkOdCAeco= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=YPXEsqU+; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="YPXEsqU+" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1273442A8; Sat, 2 Aug 2025 11:30:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127014; bh=Zf/YF3LmVEiKTVMxhxN0Gc3jRXrBb3FeFalAScFj6mo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YPXEsqU+w5BHs2YjAiEdi9Om4cBHZlvX9Eujp4q56v0+VTiJPEhylI/ND2mDx+g56 HaO3XrJCv0FpZqsUki4cZrhfVPyfjn/UI5Xx7uqpalKNp5RiY75mnWGs+tk1l/zFK6 zopdbV1n9Z7K07TR/Ze4XWK1UeA0MeTKcHg4DeUY= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:08 +0200 Subject: [PATCH 46/65] media: exynos4-is: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-46-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3270; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=Zf/YF3LmVEiKTVMxhxN0Gc3jRXrBb3FeFalAScFj6mo=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj99+qGA9flCQyC0++cheYFVG3MraszyTga5 d8jaXvn40aJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/QAKCRByNAaPFqFW PD+MEACYV0w7+ed4A0+Uo+tBCjNKgzmO9oF6JqADv7iHNudn42HhFykLdXyiqpLvzF6gyhoDnB6 6L2bJ5NdgwQhQU8kd6jXjAuWCDD47AvAWGJ3V/J9MR/iMk6KHBQiOj33HbBhyX2KMn2y6tdms2C RoOvQGhJm1b0dqHD0Zr/wD5YXKZwADh+Q56rqQDe/qe+lPFPG5Ninkbw9tgYRok43YSUF1fX0c+ ZTGz+YOlqi0Mq+8u/Bbp+svfhyL/JE5OHosRFcPyIAbNsfb3bojLWbIA3ge6yVBS00hhwNGgmDK LNUaCOcL0tyYkJwna8zv4df3i9FYGaLKabR50yMu59Db0iRnsKVetY3Q72r9opleDRyQmhPTFHE HvugiIJ9lmcjKuZpRjJRUcLU/8rdoNTUgj2UUYTT7bkQb5F98sUeexN04EySlWp49oElL+aSqM8 Q4ZMmB2m0fOmdEStlAcqGQ9FBO/Uxy8698vqbNX7y5Qbz33JwsdbCN25DkUi+YSVBtexCKevBqB wBXQyyP6iqnuvCUsn8ujdk6JitPJkPQWrD+/LRKVBS0T7EsM1p9DCk6qMzNMzbtqQIX9aL9Ezy2 823yvwOJotRBYc7vRV6EDSHmodGV0Kaq5g4JTSF4z1rw0Dyh5gPW2Xezvyr4ppe7lXloMWmVpDo lNwfgwGbMF+bYTA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it, remove the now unused fh_to_ctx() macro. Signed-off-by: Jacopo Mondi --- drivers/media/platform/samsung/exynos4-is/fimc-core.h | 2 -- drivers/media/platform/samsung/exynos4-is/fimc-m2m.c | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-core.h b/driver= s/media/platform/samsung/exynos4-is/fimc-core.h index 25711df062e79eb2066f0f6eab1c1733f16c9c2d..c23cbdee7afcdfedf1a2ef0433b= 98af6b4478eef 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-core.h +++ b/drivers/media/platform/samsung/exynos4-is/fimc-core.h @@ -496,8 +496,6 @@ struct fimc_ctx { struct fimc_ctrls ctrls; }; =20 -#define fh_to_ctx(__fh) container_of(__fh, struct fimc_ctx, fh) - static inline struct fimc_ctx *file_to_ctx(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct fimc_ctx, fh); diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c b/drivers= /media/platform/samsung/exynos4-is/fimc-m2m.c index 609fd84f89d4ad189d0f367bb37693f15f3a618e..562c57f186c61546175b4f902f1= da18fbb2f25fe 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c @@ -249,7 +249,7 @@ static int fimc_m2m_enum_fmt(struct file *file, void *p= riv, static int fimc_m2m_g_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct fimc_ctx *ctx =3D fh_to_ctx(fh); + struct fimc_ctx *ctx =3D file_to_ctx(file); const struct fimc_frame *frame =3D ctx_get_frame(ctx, f->type); =20 if (IS_ERR(frame)) @@ -308,7 +308,7 @@ static int fimc_try_fmt_mplane(struct fimc_ctx *ctx, st= ruct v4l2_format *f) static int fimc_m2m_try_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct fimc_ctx *ctx =3D fh_to_ctx(fh); + struct fimc_ctx *ctx =3D file_to_ctx(file); return fimc_try_fmt_mplane(ctx, f); } =20 @@ -337,7 +337,7 @@ static void __set_frame_format(struct fimc_frame *frame, static int fimc_m2m_s_fmt_mplane(struct file *file, void *fh, struct v4l2_format *f) { - struct fimc_ctx *ctx =3D fh_to_ctx(fh); + struct fimc_ctx *ctx =3D file_to_ctx(file); struct fimc_dev *fimc =3D ctx->fimc_dev; const struct fimc_fmt *fmt; struct vb2_queue *vq; @@ -376,7 +376,7 @@ static int fimc_m2m_s_fmt_mplane(struct file *file, voi= d *fh, static int fimc_m2m_g_selection(struct file *file, void *fh, struct v4l2_selection *s) { - struct fimc_ctx *ctx =3D fh_to_ctx(fh); + struct fimc_ctx *ctx =3D file_to_ctx(file); const struct fimc_frame *frame; =20 frame =3D ctx_get_frame(ctx, s->type); @@ -484,7 +484,7 @@ static int fimc_m2m_try_selection(struct fimc_ctx *ctx, static int fimc_m2m_s_selection(struct file *file, void *fh, struct v4l2_selection *s) { - struct fimc_ctx *ctx =3D fh_to_ctx(fh); + struct fimc_ctx *ctx =3D file_to_ctx(file); struct fimc_dev *fimc =3D ctx->fimc_dev; struct fimc_frame *f; int ret; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 2E79B22A1E1; Sat, 2 Aug 2025 09:31:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127072; cv=none; b=ExlvhL0YVK0rr6rlK304T4lNG1Fb1C1mj69lFWBOCRBLAMBUEJEIF/HLr+ucqby6DKTUZmzO5M5iBniccZ42h5vsZqbyhcCCdi7ExXF05p3Jqs3giVA/phx4eFPVcKJbCpk0HYpfC1b9Dhh/vdF2R3fak3yAYFssJP7V7fWC3PA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127072; c=relaxed/simple; bh=Eczg8ECb72+TCEnmOt8zTT17kJTYh4uwIayf3SmW1JY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=S2HbMR4PcxVGyN6E4WXIqeR9M2tFxyIUEF+22jHzMcE46HJkZcumK17Q4N0ElGu2cpuN7b7/5g9Vbtq2jofZ79ceBEFuuGFyq2Y5Rcn1kH+iBEx2Y2LZKGkcFY0cGWiHr3kQoBGYgzXbftktUw21OlR4Luh351x7nevaKYI3nvg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Vxlu84YD; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Vxlu84YD" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7DE8F4176; Sat, 2 Aug 2025 11:30:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127023; bh=Eczg8ECb72+TCEnmOt8zTT17kJTYh4uwIayf3SmW1JY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Vxlu84YDp7Jd4jfVvLAsxFy34pgccx9f3xa0paw8IVe29SHPH8VpJZNnUMsWiYUHR CVAa+3L3e1L2pJwimqcrq6hgVVAwuh3wbs1CibLsfxSfHpoZiR4VCfYxo3Keoo0n2z jKyrW2ft8hyaVFcJL9t+p6SpGIothGx1EIXMmAGs= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:09 +0200 Subject: [PATCH 47/65] media: s3c-camif: Set queue owner using file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-47-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3613; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=Eczg8ECb72+TCEnmOt8zTT17kJTYh4uwIayf3SmW1JY=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj9+KKN9ybzE3g+ZGFi3JToB55y8XEuI2gwH zGCFuhA0OaJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/QAKCRByNAaPFqFW PK7OD/9WLUC3p8SXYZRT43b0K+nuWhWGgtGSBt4/ElOwk1n834rKblsRtgx7mkJ5VuJ4K5EQne2 BF+d4Tb8DowDc+0OGKbKv5JsSZEhB585l9MaqLEuOf2fk//TGgpX4Nca+xgE0zwVLfF70GO6MwS +02OV5Z1/vzKbiRBFF1QYTr/uNe5E+fp6DzAimCXUzHjJgioOH6sB6N/SAh6RenycGWdl9pf/Ed iXUQYCbjRdKXpqFHpvrx7g7xwfdtHWu2toSHl6zfBIXn7MScpWqxIPGLsPJwP+8sJsXlTXlBdEw cBS7biGwPdh0BKeqXIY6uvCr4s6/yFy43FpmZBa7XPCxVWWfsVSDNkPpXcMyPEMAwg+mTX2/uPb uLCmk86pOQVWNfm7auaVF11/tqG3d161P5E1UfnGuqKOxd+h9E4s+2ChkF4PSmBGtOGxna/6vFM +KwSnv7523PD5w/Jd3jz/TXYgI1nItgpGbCd3Cn08d1NHBaDy7Gvqd8Hfpv1pkYGUYMwGWPczt8 WTBgBFLE9pkdsp2SvyM2jnTtf3yWZYu6279qfF4CJ2byI/AT3TglvJv9FnXxp8PHMsIiXTKyzQO 826gtpZOi9+L67vdX/KwzWvmaFFUJEWqOMK67CHgq9IUcDDgY2PhDr4GsAqzTTaAmmvt0MAXtN7 C6/29ZoK3kBsz0A== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The s3c-camif driver keeps track of which user owns the vb2 queue by using the 'void *priv' argument passed to ioctl handlers. As the driver uses v4l2_fh_open() the priv argument points to the v4l2_fh handle associated with the open file. Use file_to_v4l2_fh(file) instead of the raw 'priv' argument for better consistency. Signed-off-by: Jacopo Mondi --- .../media/platform/samsung/s3c-camif/camif-capture.c | 20 ++++++++++------= ---- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/samsung/s3c-camif/camif-capture.c b/dri= vers/media/platform/samsung/s3c-camif/camif-capture.c index cae15a4ce5fd83f00ced8b2dfbb5f5a6f7483ca4..ed1a1d693293b33d8da3190ac8e= e6dd212a64b88 100644 --- a/drivers/media/platform/samsung/s3c-camif/camif-capture.c +++ b/drivers/media/platform/samsung/s3c-camif/camif-capture.c @@ -791,7 +791,7 @@ static int s3c_camif_vidioc_s_fmt(struct file *file, vo= id *priv, out_frame->rect.top =3D 0; =20 if (vp->owner =3D=3D NULL) - vp->owner =3D priv; + vp->owner =3D file_to_v4l2_fh(file); =20 pr_debug("%ux%u. payload: %u. fmt: 0x%08x. %d %d. sizeimage: %d. bpl: %d\= n", out_frame->f_width, out_frame->f_height, vp->payload, @@ -841,7 +841,7 @@ static int s3c_camif_streamon(struct file *file, void *= priv, if (type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; =20 - if (vp->owner && vp->owner !=3D priv) + if (vp->owner && vp->owner !=3D file_to_v4l2_fh(file)) return -EBUSY; =20 if (s3c_vp_active(vp)) @@ -872,7 +872,7 @@ static int s3c_camif_streamoff(struct file *file, void = *priv, if (type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; =20 - if (vp->owner && vp->owner !=3D priv) + if (vp->owner && vp->owner !=3D file_to_v4l2_fh(file)) return -EBUSY; =20 ret =3D vb2_streamoff(&vp->vb_queue, type); @@ -888,9 +888,9 @@ static int s3c_camif_reqbufs(struct file *file, void *p= riv, int ret; =20 pr_debug("[vp%d] rb count: %d, owner: %p, priv: %p\n", - vp->id, rb->count, vp->owner, priv); + vp->id, rb->count, vp->owner, file_to_v4l2_fh(file)); =20 - if (vp->owner && vp->owner !=3D priv) + if (vp->owner && vp->owner !=3D file_to_v4l2_fh(file)) return -EBUSY; =20 if (rb->count) @@ -910,7 +910,7 @@ static int s3c_camif_reqbufs(struct file *file, void *p= riv, =20 vp->reqbufs_count =3D rb->count; if (vp->owner =3D=3D NULL && rb->count > 0) - vp->owner =3D priv; + vp->owner =3D file_to_v4l2_fh(file); =20 return ret; } @@ -929,7 +929,7 @@ static int s3c_camif_qbuf(struct file *file, void *priv, =20 pr_debug("[vp%d]\n", vp->id); =20 - if (vp->owner && vp->owner !=3D priv) + if (vp->owner && vp->owner !=3D file_to_v4l2_fh(file)) return -EBUSY; =20 return vb2_qbuf(&vp->vb_queue, vp->vdev.v4l2_dev->mdev, buf); @@ -942,7 +942,7 @@ static int s3c_camif_dqbuf(struct file *file, void *pri= v, =20 pr_debug("[vp%d] sequence: %d\n", vp->id, vp->frame_sequence); =20 - if (vp->owner && vp->owner !=3D priv) + if (vp->owner && vp->owner !=3D file_to_v4l2_fh(file)) return -EBUSY; =20 return vb2_dqbuf(&vp->vb_queue, buf, file->f_flags & O_NONBLOCK); @@ -954,14 +954,14 @@ static int s3c_camif_create_bufs(struct file *file, v= oid *priv, struct camif_vp *vp =3D video_drvdata(file); int ret; =20 - if (vp->owner && vp->owner !=3D priv) + if (vp->owner && vp->owner !=3D file_to_v4l2_fh(file)) return -EBUSY; =20 create->count =3D max_t(u32, 1, create->count); ret =3D vb2_create_bufs(&vp->vb_queue, create); =20 if (!ret && vp->owner =3D=3D NULL) - vp->owner =3D priv; + vp->owner =3D file_to_v4l2_fh(file); =20 return ret; } --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 2AE3F252912; Sat, 2 Aug 2025 09:31:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127082; cv=none; b=ALraOfqV8lfSp297Jf+NtYkxRLqMi1wOY2T0WCTRtMaJ7kzh75KVrtBfka7+bnFngkAs7voAvl/ey1E7EI/akipcbfOhw394kFr268emzz5KjZPS4jks+uX6Qk+hFK8284uiA3RHo8wVEAmd7AsmEe7Y9tacO8DXFos+K2sRSVg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127082; c=relaxed/simple; bh=P+AdXovkDs72ySz3QReqGKxKqBANHR4M/z/Qnx0Et0A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W6M60XO2BIeuiCxBKLRO0AymdeeETcbPT8RJ1HelcLnEijHgsR2NT+PmVRoSM2CNc/ZUgHwVGjbP+LXjfUiv8+F4WHSJAk+xpZFPHmkM8ejkxb5kjlnWc6KMy80Z4XJ1ix/VBl5i6k1eqkiCyzPjAxVtunxhqlbuhrjZwfmiVKQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=TYEMJ1NQ; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="TYEMJ1NQ" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B3C5940D8; Sat, 2 Aug 2025 11:30:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127034; bh=P+AdXovkDs72ySz3QReqGKxKqBANHR4M/z/Qnx0Et0A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TYEMJ1NQIn2AHami8rz14vK1JzGQigVifiRoyt6QHmF3Iu7LxEUWe+myT+degFzvr js1GxPK6uXfvuzkK5py81gAkb/ClqJxrx4Q9yB2nZNuMAdOJCd1ZQz6ex+ZmHLpccd Mvkz9iIBZ12ifbUQkccgBT6ah7Ey34/3qfhaou9E= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:10 +0200 Subject: [PATCH 48/65] media: s5p-g2d: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-48-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2354; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=P+AdXovkDs72ySz3QReqGKxKqBANHR4M/z/Qnx0Et0A=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj9QjDArsCCpetRJypejE9fiKxkH/6QF97H/ V7Va6UoY5qJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/QAKCRByNAaPFqFW PC37EACiB4t1ueWIIp+xm9SL1tP9bPd4oIx6m58tUtufzqv2UhhlQY2uIeweEcdjDrnmK6wlPFf Zh67AxZib08g3DhnLVPtuf6zyFFx9glCJg6E37kf4tO0Cbjk2b7Wo0XqOtvRvL0mrbcFdm10XOQ u48ojoafbcLDoihcjqYmZZQA517dhFRTPQq0ewLAWh1vRHp5r3u6zxmRYWXvtvn07t8yRHYo1yy pTIdGY05xvfVpm2AwuDef2uLWLTO0ecyx5rhZzPNUGXD+b+hBJfXTGV2aZuhzrLZFz4q/HnJ3x0 BYQRN2rUU0mfRw6XAJg2vcYskCk4xE1oHXWcvGmeORkGTZqWQquB4DHbQxT1ITU7vwv3iRSKx36 fCognK5a0c4ZW//QBYFwwlv9k74VAtnxKtNiBK6Vbuhbjdsu+YafF0wxxd0bwQ7mVD56iAeaLTZ aP2D2Iy/3E+BdZ4DzVXCbcj9E+jTxZfxbaXg3u5ARjUZb/cQaha4H5DW+a/bxwe6Dc0pyaf8hr7 jlWtg1P74osSQLocQSEkYZA+LkuSwrf7AjDO/49ylXeeTtmSe4k4UQHi0XpMZYOYBqHYmyW7gGE ppnTGZndhnM4xWgtUrd4XxDQx4HNaUV59HsflvBoP9BCtbJ8eruyG9ddj+y0d1cNTq36z2Yf78+ 2X3qjhfFmyd527g== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- drivers/media/platform/samsung/s5p-g2d/g2d.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-g2d/g2d.c b/drivers/media/p= latform/samsung/s5p-g2d/g2d.c index 922262f61e7b53baf1b5840d35149bf5b4b2e7ad..55f5130156b7e8690bd0eb20463= 0a730d9f84bd6 100644 --- a/drivers/media/platform/samsung/s5p-g2d/g2d.c +++ b/drivers/media/platform/samsung/s5p-g2d/g2d.c @@ -307,7 +307,7 @@ static int vidioc_enum_fmt(struct file *file, void *prv= , struct v4l2_fmtdesc *f) =20 static int vidioc_g_fmt(struct file *file, void *prv, struct v4l2_format *= f) { - struct g2d_ctx *ctx =3D prv; + struct g2d_ctx *ctx =3D file2ctx(file); struct vb2_queue *vq; struct g2d_frame *frm; =20 @@ -359,7 +359,7 @@ static int vidioc_try_fmt(struct file *file, void *prv,= struct v4l2_format *f) =20 static int vidioc_s_fmt(struct file *file, void *prv, struct v4l2_format *= f) { - struct g2d_ctx *ctx =3D prv; + struct g2d_ctx *ctx =3D file2ctx(file); struct g2d_dev *dev =3D ctx->dev; struct vb2_queue *vq; struct g2d_frame *frm; @@ -400,7 +400,7 @@ static int vidioc_s_fmt(struct file *file, void *prv, s= truct v4l2_format *f) static int vidioc_g_selection(struct file *file, void *prv, struct v4l2_selection *s) { - struct g2d_ctx *ctx =3D prv; + struct g2d_ctx *ctx =3D file2ctx(file); struct g2d_frame *f; =20 f =3D get_frame(ctx, s->type); @@ -450,7 +450,7 @@ static int vidioc_g_selection(struct file *file, void *= prv, static int vidioc_try_selection(struct file *file, void *prv, const struct v4l2_selection *s) { - struct g2d_ctx *ctx =3D prv; + struct g2d_ctx *ctx =3D file2ctx(file); struct g2d_dev *dev =3D ctx->dev; struct g2d_frame *f; =20 @@ -478,7 +478,7 @@ static int vidioc_try_selection(struct file *file, void= *prv, static int vidioc_s_selection(struct file *file, void *prv, struct v4l2_selection *s) { - struct g2d_ctx *ctx =3D prv; + struct g2d_ctx *ctx =3D file2ctx(file); struct g2d_frame *f; int ret; =20 --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 A2E73227BB5; Sat, 2 Aug 2025 09:31:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127101; cv=none; b=dR2hAGKCcMWtchWznr7PpZmHRMkpwD+PfnTH3s6oqop+PDzQKCtOzoh7O9zljuDXZ80kNpFjTexKsPUQCe1sBMY4F9mk6mELcNC47X8/2GYdDgTHlOWCTJw9tCzkE5b+4esRgVBQ+vjKAABoOr+99ExjCtnxhQ8BQJhEA09WCLw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127101; c=relaxed/simple; bh=e9spn0Wp0nY1lMfXntKTb/kLvwEFE4ID3yslOAjGdJI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FU+zuq2RCCgfTlAeQfIbpA6/4wf2VkS2EqK2VN2X50WikaCO1lSey0gccnrKGcvJcvavCx3+BwGhWDyMK7m8LwpGm27MK42FK2BAinlhLxwQtk5mlUI1iScr+M+e01T3hTRX+e2naraSLnhiSJ3zBX9el7E3x40JFaweeGRJLVY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=HpX5BDdV; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HpX5BDdV" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B88723FCE; Sat, 2 Aug 2025 11:30:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127052; bh=e9spn0Wp0nY1lMfXntKTb/kLvwEFE4ID3yslOAjGdJI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HpX5BDdVS3j+pTsNcwI1BeCJShWH8n9M85Z1l5akK04RGo19pEFRLt6X/IxG5rJOl poLl3ecPsVXrhmA1hnnbF5A0Kjc6WhMdGf1Q0Y9vJ8ijF78krqD2t5L4pCzXJojnGU PJ/ijYO2i6nQmjKqqWUzB4vwpkcHyzab7qcD1niw= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:11 +0200 Subject: [PATCH 49/65] media: s5p-jpeg: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-49-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4867; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=e9spn0Wp0nY1lMfXntKTb/kLvwEFE4ID3yslOAjGdJI=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj99eZoQBrrRU8HwZCp/lEmCC2AHXC6KN4bo 5sTBWh+2PmJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/QAKCRByNAaPFqFW POKlEACwPh0PROmzVn8vNI8tmgzbJ3MnsT1OqXi7X6rM2NINFWzgSBIn68R5SI9nExICwVvZOcg C/VU+1NnSJmzepB4eugrvkN8R/ohZPC931mfV5qnxmgqlfzIqhHFxL/yTAzB38rIMy6W79Iz0wz /2vu83MetiFDnqHirzlPi971oztZDB3goYVIWsVt2VHSjdxv84OLJy4k4K+uH28ZQLSzDtDuF+e rmvsS0NnkAcB00aYRXJBygz6VJc6NX4UXXRUr2k7t7nBGdyypfMnT6wCCnfVl2D/ZJqtPwIqOA+ lqCYjutFAd2rqSrAH8+p49h8x6tUkSX8D/2pbGQE4XlqNLqfEqHEB9wDFguUkoTgcP63SiSTVDt cjEzihdAXBLo/FZvYtllF3pzk/CygB7kQbuCX+65CBD3mA4hFxTgMUVs06EWPuGYuMMCxMYznc6 rJYKEUEZ83mM/c0/rdTHpa9zf4l25/nJ+N+88J4jWdYjdfgt0oihZQRHC8B9km3bomn1Chf4EMt FGW4aMoIugkEgb0C7vNcfkDdTLQQQzhiK9hFvThH8lAwJAfV/9danxqiMj/hrf2T9JXXicqycZ0 NYKJ31e5gDAGyuFSX3Cpfv5NBB7pUKfd0az1qZiKNEJWanS9nhV99GPNis9HU370KDk2gE5jOLF os4dXx+4t0F7obw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it, remove the now unused fh_to_ctx() macro. Signed-off-by: Jacopo Mondi --- .../media/platform/samsung/s5p-jpeg/jpeg-core.c | 25 +++++++++---------= ---- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c b/drivers/= media/platform/samsung/s5p-jpeg/jpeg-core.c index 2a57efd181540183e7d2b66d51f9f2f274ddd100..81792f7f8b1671dba2023f99b27= 79784d9a14b8c 100644 --- a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c @@ -580,11 +580,6 @@ static inline struct s5p_jpeg_ctx *ctrl_to_ctx(struct = v4l2_ctrl *c) return container_of(c->handler, struct s5p_jpeg_ctx, ctrl_handler); } =20 -static inline struct s5p_jpeg_ctx *fh_to_ctx(struct v4l2_fh *fh) -{ - return container_of(fh, struct s5p_jpeg_ctx, fh); -} - static inline struct s5p_jpeg_ctx *file_to_ctx(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct s5p_jpeg_ctx, fh); @@ -1015,8 +1010,8 @@ static int s5p_jpeg_open(struct file *file) =20 static int s5p_jpeg_release(struct file *file) { - struct s5p_jpeg *jpeg =3D video_drvdata(file); struct s5p_jpeg_ctx *ctx =3D file_to_ctx(file); + struct s5p_jpeg *jpeg =3D video_drvdata(file); =20 mutex_lock(&jpeg->lock); v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); @@ -1253,7 +1248,7 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data= *result, static int s5p_jpeg_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - struct s5p_jpeg_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_jpeg_ctx *ctx =3D file_to_ctx(file); =20 if (ctx->mode =3D=3D S5P_JPEG_ENCODE) { strscpy(cap->driver, S5P_JPEG_M2M_NAME, @@ -1301,7 +1296,7 @@ static int enum_fmt(struct s5p_jpeg_ctx *ctx, static int s5p_jpeg_enum_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct s5p_jpeg_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_jpeg_ctx *ctx =3D file_to_ctx(file); =20 if (ctx->mode =3D=3D S5P_JPEG_ENCODE) return enum_fmt(ctx, sjpeg_formats, SJPEG_NUM_FORMATS, f, @@ -1314,7 +1309,7 @@ static int s5p_jpeg_enum_fmt_vid_cap(struct file *fil= e, void *priv, static int s5p_jpeg_enum_fmt_vid_out(struct file *file, void *priv, struct v4l2_fmtdesc *f) { - struct s5p_jpeg_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_jpeg_ctx *ctx =3D file_to_ctx(file); =20 if (ctx->mode =3D=3D S5P_JPEG_ENCODE) return enum_fmt(ctx, sjpeg_formats, SJPEG_NUM_FORMATS, f, @@ -1340,7 +1335,7 @@ static int s5p_jpeg_g_fmt(struct file *file, void *pr= iv, struct v4l2_format *f) struct vb2_queue *vq; struct s5p_jpeg_q_data *q_data =3D NULL; struct v4l2_pix_format *pix =3D &f->fmt.pix; - struct s5p_jpeg_ctx *ct =3D fh_to_ctx(priv); + struct s5p_jpeg_ctx *ct =3D file_to_ctx(file); =20 vq =3D v4l2_m2m_get_vq(ct->fh.m2m_ctx, f->type); if (!vq) @@ -1480,7 +1475,7 @@ static int vidioc_try_fmt(struct v4l2_format *f, stru= ct s5p_jpeg_fmt *fmt, static int s5p_jpeg_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { - struct s5p_jpeg_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_jpeg_ctx *ctx =3D file_to_ctx(file); struct v4l2_pix_format *pix =3D &f->fmt.pix; struct s5p_jpeg_fmt *fmt; int ret; @@ -1539,7 +1534,7 @@ static int s5p_jpeg_try_fmt_vid_cap(struct file *file= , void *priv, static int s5p_jpeg_try_fmt_vid_out(struct file *file, void *priv, struct v4l2_format *f) { - struct s5p_jpeg_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_jpeg_ctx *ctx =3D file_to_ctx(file); struct s5p_jpeg_fmt *fmt; =20 fmt =3D s5p_jpeg_find_format(ctx, f->fmt.pix.pixelformat, @@ -1686,7 +1681,7 @@ static int s5p_jpeg_s_fmt_vid_cap(struct file *file, = void *priv, if (ret) return ret; =20 - return s5p_jpeg_s_fmt(fh_to_ctx(priv), f); + return s5p_jpeg_s_fmt(file_to_ctx(file), f); } =20 static int s5p_jpeg_s_fmt_vid_out(struct file *file, void *priv, @@ -1698,7 +1693,7 @@ static int s5p_jpeg_s_fmt_vid_out(struct file *file, = void *priv, if (ret) return ret; =20 - return s5p_jpeg_s_fmt(fh_to_ctx(priv), f); + return s5p_jpeg_s_fmt(file_to_ctx(file), f); } =20 static int s5p_jpeg_subscribe_event(struct v4l2_fh *fh, @@ -1795,7 +1790,7 @@ static int exynos3250_jpeg_try_crop(struct s5p_jpeg_c= tx *ctx, static int s5p_jpeg_g_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct s5p_jpeg_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_jpeg_ctx *ctx =3D file_to_ctx(file); =20 if (s->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT && s->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 956153D6D; Sat, 2 Aug 2025 09:32:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127122; cv=none; b=tVy3KYfdI/7/uov/4iPC2/QI3Z4L6efR4DK0hhV1rQrSWzMO+HLTZ4UXGNEsWVfUsys07X0k5vbSvN9t62NpTpNxF6xKJAeediLV3Afr+Fmm865i30taNqqAFxbdh8w66g6VrDuXCW/Nm/BzG3oaRQbLgsAvBn4COQ5a/svmdk8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127122; c=relaxed/simple; bh=IirxBztmljSSgN2BVXB6cHuAJICj/kyqIr+6UJ76kV4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Slcf0Ezd78ffpzwkROgdJ5XFQwNfQ2HxwXJfzKEK9joKdGUWJeYVx/SLa/QaPlPOZtrAye/56c6vz9EJvaVoTPHUF8UFFSomVFaKW0xzUcCDjuyC/QwWl4arPX3jOdAPHZJLtTqD5VAiLznCrEEPT0BhTVhE2AJE4z3PsUTV0UQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=TmEtBzqd; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="TmEtBzqd" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 079D63EB0; Sat, 2 Aug 2025 11:30:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127073; bh=IirxBztmljSSgN2BVXB6cHuAJICj/kyqIr+6UJ76kV4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TmEtBzqdBLqoZluZmZs8RWZtWynh8NG+K6Ba1+EQhY2cVQPMXqrZZI/bLcmAR0I4/ JHinrXd1/aSAMaplfSD+nTW92cFr9EAud1X6dQtjs6yp64g4C5UV1Y6sCRs19SnxRs jonF1sJjFPnx6LCJpUmOEXFbILHpJm0DWXiE5iHU= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:12 +0200 Subject: [PATCH 50/65] media: s5p-mfc: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-50-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=9860; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=IirxBztmljSSgN2BVXB6cHuAJICj/kyqIr+6UJ76kV4=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj9WlUYBZnvtf2wlXVIHJUMp9jqezOCJZkEu ZnI1YN6t7OJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/QAKCRByNAaPFqFW PNIKD/9gLwzi+0G2rYD3uhw/B90pgSgcO+CBQcWIi3EmM3D9Z5NL370hmM371eFP8iZ+KPoX2f0 WNvQYpl+7zDqGikGkhpak7k0SmbxMaalX/OgFsHCx79mpOM06FBfqSDSDIA943JnuxIFpNn2ymB wF65SyOjgG0Vrp2l8HTSFSP1yugJr2jXchjFaqAwLd90RZx/qcJWBJ7H6Xzl4y8LfPDJIv1EfuJ QhQrrSrWgV3Ykci//zn8E1SVEnM0+D16nAXVGqI1Fm43/byjzJloxtHpzuwI1t9jKpgDWg79kNw VJvGq8STnkxwsw03Pr54zOR+AGKMpwu2WcEjnc76q2UX1lqOqAhGitu/HsStX4mMq8vCKEs+fC0 MMkS3dqeBqqTemtbtodeIcWEIK2Xc6XAJe97Rj7WMwbGQncnUJgY12XhpkKKYNcyavDoNsMGEOP Q6eqUyYK1hFwo8/Cp0YvQWuknTsI5aznce/twxHwr+PdL3SWKa9mNtsplRx8YRFryUKkt6GVpCM BlziLQuxJgaPME2bQyq1e72z/X0RHeWzxSZhxXPA/Tk3i6YEcXxfa/v2hHjFnYmbnPgfHvY/8ca T3ICF5986+Vi7y/BaFmkldV4+Gs+luRI1xoHvEv9NEhaioZi6mtJOgg4XdXyObH6ALLGfS4602Y yx8stXWkxbGP4hQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- .../media/platform/samsung/s5p-mfc/s5p_mfc_dec.c | 22 ++++++++++--------= -- .../media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 24 +++++++++++-------= ---- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c b/drivers= /media/platform/samsung/s5p-mfc/s5p_mfc_dec.c index 3efbc336790629425c2a71e9feee8f073db55790..6a2703fe7e8cc3104fbaa3c7405= e67295e87db5d 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c @@ -345,7 +345,7 @@ static int vidioc_enum_fmt_vid_out(struct file *file, v= oid *priv, /* Get format */ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format = *f) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); struct v4l2_pix_format_mplane *pix_mp; =20 mfc_debug_enter(); @@ -442,7 +442,7 @@ static int vidioc_try_fmt(struct file *file, void *priv= , struct v4l2_format *f) static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format = *f) { struct s5p_mfc_dev *dev =3D video_drvdata(file); - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); int ret =3D 0; struct v4l2_pix_format_mplane *pix_mp; const struct s5p_mfc_buf_size *buf_size =3D dev->variant->buf_size; @@ -598,7 +598,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *reqbufs) { struct s5p_mfc_dev *dev =3D video_drvdata(file); - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); =20 if (reqbufs->memory !=3D V4L2_MEMORY_MMAP) { mfc_debug(2, "Only V4L2_MEMORY_MMAP is supported\n"); @@ -619,7 +619,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, static int vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *buf) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); int ret; int i; =20 @@ -647,7 +647,7 @@ static int vidioc_querybuf(struct file *file, void *pri= v, /* Queue a buffer */ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *= buf) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); =20 if (ctx->state =3D=3D MFCINST_ERROR) { mfc_err("Call on QBUF after unrecoverable error\n"); @@ -666,7 +666,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, = struct v4l2_buffer *buf) const struct v4l2_event ev =3D { .type =3D V4L2_EVENT_EOS }; - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); int ret; =20 if (ctx->state =3D=3D MFCINST_ERROR) { @@ -695,7 +695,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, = struct v4l2_buffer *buf) static int vidioc_expbuf(struct file *file, void *priv, struct v4l2_exportbuffer *eb) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); =20 if (eb->type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) return vb2_expbuf(&ctx->vq_src, eb); @@ -708,7 +708,7 @@ static int vidioc_expbuf(struct file *file, void *priv, static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type type) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); int ret =3D -EINVAL; =20 mfc_debug_enter(); @@ -724,7 +724,7 @@ static int vidioc_streamon(struct file *file, void *pri= v, static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type type) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); =20 if (type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) return vb2_streamoff(&ctx->vq_src, type); @@ -801,7 +801,7 @@ static const struct v4l2_ctrl_ops s5p_mfc_dec_ctrl_ops = =3D { static int vidioc_g_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); struct s5p_mfc_dev *dev =3D ctx->dev; u32 left, right, top, bottom; u32 width, height; @@ -856,7 +856,7 @@ static int vidioc_g_selection(struct file *file, void *= priv, static int vidioc_decoder_cmd(struct file *file, void *priv, struct v4l2_decoder_cmd *cmd) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); struct s5p_mfc_dev *dev =3D ctx->dev; struct s5p_mfc_buf *buf; unsigned long flags; diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c b/drivers= /media/platform/samsung/s5p-mfc/s5p_mfc_enc.c index 6c603dcd56649fcabe161173c64b9ea8bd055b93..c6787ccfaaa422a905dbb136d99= 2f2d15b8e484f 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c @@ -1389,8 +1389,8 @@ static int vidioc_enum_fmt_vid_out(struct file *file,= void *priv, =20 static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format = *f) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); struct v4l2_pix_format_mplane *pix_fmt_mp =3D &f->fmt.pix_mp; + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); =20 mfc_debug(2, "f->type =3D %d ctx->state =3D %d\n", f->type, ctx->state); if (f->type =3D=3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { @@ -1472,8 +1472,8 @@ static int vidioc_try_fmt(struct file *file, void *pr= iv, struct v4l2_format *f) =20 static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format = *f) { + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); struct s5p_mfc_dev *dev =3D video_drvdata(file); - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); struct v4l2_pix_format_mplane *pix_fmt_mp =3D &f->fmt.pix_mp; int ret =3D 0; =20 @@ -1531,7 +1531,7 @@ static int vidioc_reqbufs(struct file *file, void *pr= iv, struct v4l2_requestbuffers *reqbufs) { struct s5p_mfc_dev *dev =3D video_drvdata(file); - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); int ret =3D 0; =20 /* if memory is not mmp or userptr or dmabuf return error */ @@ -1601,7 +1601,7 @@ static int vidioc_reqbufs(struct file *file, void *pr= iv, static int vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *buf) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); int ret =3D 0; =20 /* if memory is not mmp or userptr or dmabuf return error */ @@ -1636,7 +1636,7 @@ static int vidioc_querybuf(struct file *file, void *p= riv, /* Queue a buffer */ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *= buf) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); =20 if (ctx->state =3D=3D MFCINST_ERROR) { mfc_err("Call on QBUF after unrecoverable error\n"); @@ -1657,10 +1657,10 @@ static int vidioc_qbuf(struct file *file, void *pri= v, struct v4l2_buffer *buf) /* Dequeue a buffer */ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer = *buf) { + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); const struct v4l2_event ev =3D { .type =3D V4L2_EVENT_EOS }; - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); int ret; =20 if (ctx->state =3D=3D MFCINST_ERROR) { @@ -1685,7 +1685,7 @@ static int vidioc_dqbuf(struct file *file, void *priv= , struct v4l2_buffer *buf) static int vidioc_expbuf(struct file *file, void *priv, struct v4l2_exportbuffer *eb) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); =20 if (eb->type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) return vb2_expbuf(&ctx->vq_src, eb); @@ -1698,7 +1698,7 @@ static int vidioc_expbuf(struct file *file, void *pri= v, static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type type) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); =20 if (type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) return vb2_streamon(&ctx->vq_src, type); @@ -1711,7 +1711,7 @@ static int vidioc_streamon(struct file *file, void *p= riv, static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type type) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); =20 if (type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) return vb2_streamoff(&ctx->vq_src, type); @@ -2284,7 +2284,7 @@ static const struct v4l2_ctrl_ops s5p_mfc_enc_ctrl_op= s =3D { static int vidioc_s_parm(struct file *file, void *priv, struct v4l2_streamparm *a) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); =20 if (a->type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { ctx->enc_params.rc_framerate_num =3D @@ -2301,7 +2301,7 @@ static int vidioc_s_parm(struct file *file, void *pri= v, static int vidioc_g_parm(struct file *file, void *priv, struct v4l2_streamparm *a) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); =20 if (a->type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) { a->parm.output.timeperframe.denominator =3D @@ -2318,7 +2318,7 @@ static int vidioc_g_parm(struct file *file, void *pri= v, static int vidioc_encoder_cmd(struct file *file, void *priv, struct v4l2_encoder_cmd *cmd) { - struct s5p_mfc_ctx *ctx =3D fh_to_ctx(priv); + struct s5p_mfc_ctx *ctx =3D file_to_ctx(file); struct s5p_mfc_dev *dev =3D ctx->dev; struct s5p_mfc_buf *buf; unsigned long flags; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 C0593218599; Sat, 2 Aug 2025 09:32:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127146; cv=none; b=OYabmyE0Z2GjSpk25zXKrfVJmo/+HU8OZrYsQJvOVlryzvunAnC5yHM8FBUt+lj/qr/2mprasG9nLA9Mm4c1Rseto5QjXYoLTO8hf/6TKqfgWJUCf9+Lj/P2+zJt83RBSfegXc/A3eUyMJ1HkS3X2YZZYnf3XA8xqwSHtNmE/Ig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127146; c=relaxed/simple; bh=gIu7Q4nN31+tN7fJeeN0sXg6UA/9FufXt5i86vLgD+Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ILTOjXIxayU+LRjULjaNktqRcE72o7b2jwUVeCr9J3uJZZ/EXTOtVzy+9rSQGNd9+YCMzm4vjMjV+F4hiEaBs+MrVW8zG82f5yy+uh0VcFvDkSP/U+RjdAkOilSNX+FHXPdeaOqCB7WBuAGvfW58/rbBQXHdASlsOEuN+jY4oQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=GL6CR5yU; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GL6CR5yU" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 92D654129; Sat, 2 Aug 2025 11:31:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127098; bh=gIu7Q4nN31+tN7fJeeN0sXg6UA/9FufXt5i86vLgD+Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GL6CR5yUCjrJ8Di6FitQc05AJIWv3/YAnWtH8vT9/rbN5zj5cL2izsjDnupBw8yvE L0lWTuvumb2ZXhIQVExAoei84xv19KDAVimC9N9bAnzu0BKdzv61ucCiFN0qXJifX0 hybuyN5nw7SUK45tB57L48cM/R8LXK+PwyxTM8CM= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:13 +0200 Subject: [PATCH 51/65] media: bdisp: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-51-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4052; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=gIu7Q4nN31+tN7fJeeN0sXg6UA/9FufXt5i86vLgD+Y=; b=kA0DAAoBcjQGjxahVjwByyZiAGiN2P2hAJjeL4C7TG81g20mJ+/1CxQtsOthszQGUM0XJNW7W okCMwQAAQoAHRYhBLXEPUiAmiCKj1g4wHI0Bo8WoVY8BQJojdj9AAoJEHI0Bo8WoVY8h/YP/Rrz +Cuai5dHAU1rx/elvXgMyktAPuA4wu2VdL2V1bVM4s1xdxx9aSpDpB3gUm87g00dGiGAfgAh3wd mmcHoafszDQ2MPBlhouZzjL+DDhOTP8r84ZaJVQ/mMHppYjPnBC2zKjQf/ZUK3H2DRmwu+Nz5os qwTvV2AsKkC4z3J1dyTi/pbkk0rvsi/+gy1QgI7+EjE7oG3p6cx9UJGenTyylr9nd27N9lYe3cD IAAfl09YRRop4Wg+xsoENjcSbTjb/dHkOoneJKKYr9LAOozYGP43+LOcG5Wjk1na1F3zI6a7fBj KwpT5npGhEzVMR8XPK2JpEK8Lqj4Rftu7vY5sX8xEl9ZQboZx8gm/+ZbR46Z/mHtKU5rSO+iIpJ T7M11oVBNsDh8e65csMOcST1mudTVJ+tsi38V5gZVjTWYjL5OXUVBGKUDOEs9YXB7Y660wKt5NW Wlta5Uzg32G9b4/vkxuo0s+r+WMn2svTvFr2hXBiDFy+3mgSPTd2+u+c1m1bA2/K7wN5jC7Vi+g vhh3Nn6SjRE5nU0tGvhgnITb3nSIyvVRaD9R/3TGWkInsh3DiBfiANIct7tsVMxlob/5Fu6Kvmb z4kRAbF9Mx8TXDmfyqZ+5irZIWPNW3aa9qMZOCiRyndODnDB80Z54qfqJxCYsEitNZNWMDw+Ddv r/hZZ X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it, remove the now unused fh_to_ctx() macro. Signed-off-by: Jacopo Mondi --- drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c b/drivers/med= ia/platform/st/sti/bdisp/bdisp-v4l2.c index fc7945d29bccc2fdf0fc48fc14d6698b321418d9..56169b70652d3aaf7c3c395a630= a29023cbd9722 100644 --- a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c @@ -33,8 +33,6 @@ #define BDISP_MIN_H 1 #define BDISP_MAX_H 8191 =20 -#define fh_to_ctx(__fh) container_of(__fh, struct bdisp_ctx, fh) - static inline struct bdisp_ctx *file_to_ctx(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct bdisp_ctx, fh); @@ -686,7 +684,7 @@ static const struct v4l2_file_operations bdisp_fops =3D= { static int bdisp_querycap(struct file *file, void *fh, struct v4l2_capability *cap) { - struct bdisp_ctx *ctx =3D fh_to_ctx(fh); + struct bdisp_ctx *ctx =3D file_to_ctx(file); struct bdisp_dev *bdisp =3D ctx->bdisp_dev; =20 strscpy(cap->driver, bdisp->pdev->name, sizeof(cap->driver)); @@ -698,7 +696,7 @@ static int bdisp_querycap(struct file *file, void *fh, =20 static int bdisp_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc= *f) { - struct bdisp_ctx *ctx =3D fh_to_ctx(fh); + struct bdisp_ctx *ctx =3D file_to_ctx(file); const struct bdisp_fmt *fmt; =20 if (f->index >=3D ARRAY_SIZE(bdisp_formats)) @@ -718,7 +716,7 @@ static int bdisp_enum_fmt(struct file *file, void *fh, = struct v4l2_fmtdesc *f) =20 static int bdisp_g_fmt(struct file *file, void *fh, struct v4l2_format *f) { - struct bdisp_ctx *ctx =3D fh_to_ctx(fh); + struct bdisp_ctx *ctx =3D file_to_ctx(file); struct v4l2_pix_format *pix; struct bdisp_frame *frame =3D ctx_get_frame(ctx, f->type); =20 @@ -742,7 +740,7 @@ static int bdisp_g_fmt(struct file *file, void *fh, str= uct v4l2_format *f) =20 static int bdisp_try_fmt(struct file *file, void *fh, struct v4l2_format *= f) { - struct bdisp_ctx *ctx =3D fh_to_ctx(fh); + struct bdisp_ctx *ctx =3D file_to_ctx(file); struct v4l2_pix_format *pix =3D &f->fmt.pix; const struct bdisp_fmt *format; u32 in_w, in_h; @@ -792,7 +790,7 @@ static int bdisp_try_fmt(struct file *file, void *fh, s= truct v4l2_format *f) =20 static int bdisp_s_fmt(struct file *file, void *fh, struct v4l2_format *f) { - struct bdisp_ctx *ctx =3D fh_to_ctx(fh); + struct bdisp_ctx *ctx =3D file_to_ctx(file); struct vb2_queue *vq; struct bdisp_frame *frame; struct v4l2_pix_format *pix; @@ -845,8 +843,8 @@ static int bdisp_s_fmt(struct file *file, void *fh, str= uct v4l2_format *f) static int bdisp_g_selection(struct file *file, void *fh, struct v4l2_selection *s) { + struct bdisp_ctx *ctx =3D file_to_ctx(file); struct bdisp_frame *frame; - struct bdisp_ctx *ctx =3D fh_to_ctx(fh); =20 frame =3D ctx_get_frame(ctx, s->type); if (IS_ERR(frame)) { @@ -923,8 +921,8 @@ static int is_rect_enclosed(struct v4l2_rect *a, struct= v4l2_rect *b) static int bdisp_s_selection(struct file *file, void *fh, struct v4l2_selection *s) { + struct bdisp_ctx *ctx =3D file_to_ctx(file); struct bdisp_frame *frame; - struct bdisp_ctx *ctx =3D fh_to_ctx(fh); struct v4l2_rect *in, out; bool valid =3D false; =20 @@ -1001,7 +999,7 @@ static int bdisp_s_selection(struct file *file, void *= fh, =20 static int bdisp_streamon(struct file *file, void *fh, enum v4l2_buf_type = type) { - struct bdisp_ctx *ctx =3D fh_to_ctx(fh); + struct bdisp_ctx *ctx =3D file_to_ctx(file); =20 if ((type =3D=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) && !bdisp_ctx_state_is_set(BDISP_SRC_FMT, ctx)) { --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 2D1BE21A435; Sat, 2 Aug 2025 09:32:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127156; cv=none; b=LQlJ08fXCfvN3vrAvUzVQtp5+EYgwUv5rNeyjHoFsEGFVaa5PfpGobDrYttBgIDd5Ln1rT3eekSWkwLcJh8mUA1gjkGY4bLs3OsOwBg0PGwkX3Al7L9wLBw27YCUqnD/S/hjb9vSXG9MqC9eAkKXzlWlvOvUX34eiHCwOeQpjvA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127156; c=relaxed/simple; bh=Gv9lbTXbRA6yPchkZ3lS+TOW5kUSmV4lOuM2BHAl6rc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Vynjxb6dgLHbtxw2LK24qL3HlinmcuTJInhYMq81pV5Fr40zK2+NZHKmAoi7kDpAHGayFbLY/Pa3qlbwimOCGUN3Pfs0UId/2M/mT1OO2LhRRD18heZaGPINjWQE//GcRUqAD8+UdzZXwu3nhiXgJNXynZVLUEB8jHQnJSyea78= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=prjR2qME; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="prjR2qME" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id ACBF54335; Sat, 2 Aug 2025 11:31:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127108; bh=Gv9lbTXbRA6yPchkZ3lS+TOW5kUSmV4lOuM2BHAl6rc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=prjR2qMEqDFUpRAMyRMQie2Nv0psrCvqJct/SVaw4UJ1ZnQGtwemB81zuwIxfhYmA UT5xqYwRWk4pliCkOwyDtOZIWgQ02ealWQ9qhJOwpXw0HYOuCGUOVZSW9E4Olza9D9 1kBxLlAAFwfvVJtSUCBdG3fkfFioLN9du/EPH7ao= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:14 +0200 Subject: [PATCH 52/65] media: st: delta: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-52-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2303; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=Gv9lbTXbRA6yPchkZ3lS+TOW5kUSmV4lOuM2BHAl6rc=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj9vdOmSnLOUwNwZy60z/PGCExXr86n8sWQN A1xKQtQDdiJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/QAKCRByNAaPFqFW PM7LEADD+AAAj6JZRdP++0YsTAt4fObDpya+EVPh0Cb6TnbK5FzsF4T3lKA6HhvS/ZooVnw7Qt6 ZpWIDwjI5j7u+vUeC1Do3HIjmUMHE7dy6rPcFFFYJ8i/gRomOvyDoOZs+iBbQp/jNPmks7dD1/0 XvAOPjC8OwzdASEGKKnYyY7Nlx9vpxlhz/1PlG7c69xJu7QXyP6Oh14W7IEpbixZCSduafhQWDy anWvYa0l/kB3kjG0SvbpfqoyCoYyS7dOmtMccsrqvkN6Jg/P3cMEXaqjm7u+YPuwI6hbNbNzThW 2A6reQ1Ppsheu3gX/KTOuV1GbuBoEtugJuj2SYYrN2tkIwcs+b070nlaGrUjnaCjBR6vrl5rgg9 3r/tBLDf4cYBpghzvw9pWiNuxfaYcPmGta1lFZvZD6EvNKv7qpCJeubCbOY7+y4fSXliKRWunTv A6ghHNWLKUjZeIEG/SB9kODMGrjXog5eevGf8bg3APXdUQewvBQ5wtPLBJ5hDKa/nrrOpatS+73 S33mhSyYAbGnXk/FvdKW0CyYkhKhFYpAJD/G4PEFPl/KfH0FgL98LWJRailHu0zYoRvIN47ABBk A+HmZuJVgKFOB0gKqfCbqdNp9mK0h6YBD2sX8h0jI/O1LvaFppcRnZAMDdydv7fRr+pji3KSqGE /UkNMoMG/NlhRdg== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it, remove the now unused fh_to_ctx() macro. Signed-off-by: Jacopo Mondi --- drivers/media/platform/st/sti/delta/delta-v4l2.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/st/sti/delta/delta-v4l2.c b/drivers/med= ia/platform/st/sti/delta/delta-v4l2.c index adff43271b2dc059abbbf82d90cd13482f6bca30..6c1a53c771f746813a6062cb3ff= c139250ff7146 100644 --- a/drivers/media/platform/st/sti/delta/delta-v4l2.c +++ b/drivers/media/platform/st/sti/delta/delta-v4l2.c @@ -24,8 +24,6 @@ =20 #define DELTA_PREFIX "[---:----]" =20 -#define to_ctx(__fh) container_of(__fh, struct delta_ctx, fh) - static inline struct delta_ctx *file_to_ctx(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct delta_ctx, fh); @@ -727,7 +725,7 @@ static int delta_s_fmt_frame(struct file *file, void *f= h, struct v4l2_format *f) static int delta_g_selection(struct file *file, void *fh, struct v4l2_selection *s) { - struct delta_ctx *ctx =3D to_ctx(fh); + struct delta_ctx *ctx =3D file_to_ctx(file); struct delta_frameinfo *frameinfo =3D &ctx->frameinfo; struct v4l2_rect crop; =20 @@ -809,7 +807,7 @@ static int delta_try_decoder_cmd(struct file *file, voi= d *fh, return 0; } =20 -static int delta_decoder_stop_cmd(struct delta_ctx *ctx, void *fh) +static int delta_decoder_stop_cmd(struct delta_ctx *ctx) { const struct delta_dec *dec =3D ctx->dec; struct delta_dev *delta =3D ctx->dev; @@ -872,14 +870,14 @@ static int delta_decoder_stop_cmd(struct delta_ctx *c= tx, void *fh) static int delta_decoder_cmd(struct file *file, void *fh, struct v4l2_decoder_cmd *cmd) { - struct delta_ctx *ctx =3D to_ctx(fh); + struct delta_ctx *ctx =3D file_to_ctx(file); int ret =3D 0; =20 ret =3D delta_try_decoder_cmd(file, fh, cmd); if (ret) return ret; =20 - return delta_decoder_stop_cmd(ctx, fh); + return delta_decoder_stop_cmd(ctx); } =20 static int delta_subscribe_event(struct v4l2_fh *fh, --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 1A507221FDC; Sat, 2 Aug 2025 09:32:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127165; cv=none; b=GEIH803T0R0g+4Gn/bSuLDMe1vDfIT5t8R/ntkK8HDH67p9z+ZQwNzt73weOzb4ZW7zGh/JMOErK0qeIP3/fp9cJgud5YC7Vfo2nCXxZnpocvBkshpBmm28OpX1P77vRc0KVW7i74DiKQB52ZyQbHu4AXEE62kCIp95lL6WiDhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127165; c=relaxed/simple; bh=0Wm4/RCQ2ghH3Q7cxBC1m0z/ZhL6jcKl5NKq/nEvhYI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cGgWTZxbRXRL094+yw4h4eWtAvt/gMOTP6R5XN2r4tplta5amnRpawB/yzn47QnMpQo5aWcftS5Q6/hJwm3WdS3OULyAXBV83HzkrS6XbsoSkSGZ05JhXLDU61CsvpDY29/Sk6UEI/GT0K9EQxiIpuJs4lp3g0jaCwlVvJqp/JA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=LPbIFhtb; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="LPbIFhtb" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C5A563FAA; Sat, 2 Aug 2025 11:31:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127117; bh=0Wm4/RCQ2ghH3Q7cxBC1m0z/ZhL6jcKl5NKq/nEvhYI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LPbIFhtb7RUjGqKbpUtFGva4zIdr6qXUvUvDFh/PFG+cYiSj+FgviD2jOqNT74Pz5 +EpAhg551TGs5l1tFvNkXNdZXegg1X7xQE+psD2h5F2thd2vcKqYdCg481ysT9zIWB BA5sOSjJJ7OZAwyrUS5Xp7/3wwfNh0NkvQpY8PnE= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:15 +0200 Subject: [PATCH 53/65] media: stm32: dma2d: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-53-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1764; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=0Wm4/RCQ2ghH3Q7cxBC1m0z/ZhL6jcKl5NKq/nEvhYI=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj+iTlXHGapdCZ3Rdg3aaSFzezt7QmFvOAXT 3xC8gkCbA6JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/gAKCRByNAaPFqFW PKWrD/9Z2LlP8zp6jDlvAZhHO91/5WhfrQjAV4XA1pd7+h7Yt+lXpe+UXlwVv4eI9ip1UQbDJt5 KAhujyIApfJIsY7phLC1CYJ0wW6deOdDiZkKNLrPF4k8Oapv/g1zuMEZ1AUnk00IBEq2PvKu28u j3SSvyUfNmrS32OE4pFBpFkybWnElDESOcP0kI7c6ANVdXCeSSXxIU4jtkLGdKB33hu1IHtvBw4 lwvcUPkn/LMHTG2E8l4EdRTbrhYSpvmc0xoCg/oWaig36e7FP+u8cRfnFTXxvH0qgINZljl074p 3iplZeoKfdca8vbTg5MQ2EZvROg46v1T66Mf1Q6sJV14mLZ8hhI45bNg1xO9Z54ctxRvkIcPNKz 2FxEHGI8LsbEEun4RkALrJOGxqWPRQjH+ds9huudfym5ODBGUhLV2Y097pOcGTBM/Ys9+KJ3VFK H4sb+sd3Tn/jZdb25RXLxU3aJkiilRlE2fnMmW99QNbfPYUBYeFbdjZJ2Y0pofrUb5fYxxx7mQL HgaFOBdCSMtDlRFU15h4P6W8mJxSaRJ4YlEwxqrOedi1y5jMhjcEoWGsdrDivID8czR0jJ/JrDS d3idISE1xsuy9Bbwt53l266mU0QsZoo2f92kbFj1xZTXj4RnmyUnNFU28rEs0c/0tzjjBjHRftc YT3FGRxMpHovWtg== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- drivers/media/platform/st/stm32/dma2d/dma2d.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/st/stm32/dma2d/dma2d.c b/drivers/media/= platform/st/stm32/dma2d/dma2d.c index bc0f81e78018b20c38677eaea44358ddad7a9a52..a22f587a5f83fe114e5b1f0a7a0= 299638701fa71 100644 --- a/drivers/media/platform/st/stm32/dma2d/dma2d.c +++ b/drivers/media/platform/st/stm32/dma2d/dma2d.c @@ -354,7 +354,7 @@ static int vidioc_enum_fmt(struct file *file, void *prv= , struct v4l2_fmtdesc *f) =20 static int vidioc_g_fmt(struct file *file, void *prv, struct v4l2_format *= f) { - struct dma2d_ctx *ctx =3D prv; + struct dma2d_ctx *ctx =3D file2ctx(file); struct vb2_queue *vq; struct dma2d_frame *frm; =20 @@ -379,7 +379,7 @@ static int vidioc_g_fmt(struct file *file, void *prv, s= truct v4l2_format *f) =20 static int vidioc_try_fmt(struct file *file, void *prv, struct v4l2_format= *f) { - struct dma2d_ctx *ctx =3D prv; + struct dma2d_ctx *ctx =3D file2ctx(file); struct dma2d_fmt *fmt; enum v4l2_field *field; u32 fourcc =3D f->fmt.pix.pixelformat; @@ -422,7 +422,7 @@ static int vidioc_try_fmt(struct file *file, void *prv,= struct v4l2_format *f) =20 static int vidioc_s_fmt(struct file *file, void *prv, struct v4l2_format *= f) { - struct dma2d_ctx *ctx =3D prv; + struct dma2d_ctx *ctx =3D file2ctx(file); struct vb2_queue *vq; struct dma2d_frame *frm; struct dma2d_fmt *fmt; --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 33F4123506A; Sat, 2 Aug 2025 09:32:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127174; cv=none; b=N7LGWQazaImx9/KWLfFkuYJ1Y/sRxQwBIgHZnCaqTGrar3/8UqvjxlNehRFR+wcYDadazlj3zd/svcp5FHfOkoy80A/sduhU8Levb/4JynGlenS80Sh0qCk+BvB/+ekUR1IElJtM3YrXm3Io8R2fDnIq+6QWSOmMtPjGN7YJkRs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127174; c=relaxed/simple; bh=ZvKqCdGZE5NgMq9FgjAr1nh972WU8DfmRgsFRNhSxA0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pjN+U/zy+6BxbJY8Qvd1T39N9YR398DTneBFawj6Zp+wy+ECVewLll3OqQ1yxeWVcMbPbT8m9yCHDi8DMGJcyEUDAsAADRwpEKdwLd9tguutQAhq9/7Kig+I5GQt2ZyKq+dIruVniwm4GrcAUv9JfA8VT5sJQU7BiS5M2i/a0Og= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=ZXo/EEzc; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ZXo/EEzc" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A389B4341; Sat, 2 Aug 2025 11:31:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127126; bh=ZvKqCdGZE5NgMq9FgjAr1nh972WU8DfmRgsFRNhSxA0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZXo/EEzcfsoL0MCa0VKqSc4UA5axyvQVuHLoi9PYTpH5UJUkT2i4azMziity5n17n lOZZ5sH5vxI65RRDd2i3s0YLyAHu39FQGq7oZqXow2Kk85lFObsrct7vP3YMhsD9au MTS/L47BsL2tMyoLNdIZZFgOLwJ9TOKGzzcImVHg= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:16 +0200 Subject: [PATCH 54/65] media: hantro: Access v4l2_fh from file->private_data Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-54-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5314; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=CbTiDL7FaHYjSvCqveksypLiZlWBs+5bYF3cQ2sKHO0=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj+lwkDLh/f2fAT4DbemdRP1NEXwtCLWEulL 0mj3tdsleyJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/gAKCRByNAaPFqFW PCyVD/9ZvVxYe+kKWfjMKd1gPcchNYPcCnnB9QNb0/iOSUaZB1x8Njr2SeKLeDXOuOxxIMQiz9P 6enRBLF1KwDYciWImRSrgBo6FEgFSlfyirZsjERXxJ8TWU+ZWEqmFmJw5QoTentbcc3BYIdBER2 pBR9J83jgE9Qgz8RwlrXUAIFc0Lu1HyOScJ1U5I6eMgm9fdfwQF4eQta2LjroTFYpY9b/mxIipF 3IdKC9KXADMaC9jdgOKLGXAiKW1/x7x+WdpyRqh1gnTjb73+OXg8HLqmb//XioVMc6mB/pRp6Al t/KnsKCXelL+Xv0tkK7Ox7KobRN1G83G7ICsAmQ1mZfyG5zgvYCQ3qUFsKNm+YQs40odlXG794M 5BoByEfzxbVwlrvWnLSZLGawdVtm72mtO5hXk9lIKgVD9Gq6x2N6/MXBWFgRgiFPPa5oIkpUWke zj050fb32iGn01ouJNo/DcbyC3DcvSZKXKn2Z5akPRqj/AfNU1ybXdXKtd8DQqIQzwc4ND/ez6q TauCRrh8KNMZAoHlV63x48z8cVTXiGiAJo7zhFWBWKxcGAt/TKbN3LIsQAKAFCkVydWPp0r+/zn 10ukeG9UeMYKPVpecH4n6yQ5g9ufCTaCLjqHf0UixURCC120DZCEGfyNwp+n/pr1auQZ6TCoPJH TV3J2u1bDozZx4g== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart 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. 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. While at it remove the only left user of fh_to_ctx() and remove the macro completely. 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(-) diff --git a/drivers/media/platform/verisilicon/hantro.h b/drivers/media/pl= atform/verisilicon/hantro.h index 0f10714f1953945472e11d8c8ad87f8ec009b39f..e0fdc4535b2d73c5260057b0a89= aee67a4732dd2 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/med= ia/platform/verisilicon/hantro_v4l2.c index 7c3515cf7d64a090adfb8d8aff368f9a617f8c8a..6bcd892e7bb49c654aae5841664= d68c1692064bd 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 *pri= v, 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 *pri= v, 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, v= oid *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, v= oid *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 *ct= x, 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 *ctx, static int vidioc_s_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format = *f) { - return hantro_set_fmt_out(fh_to_ctx(priv), &f->fmt.pix_mp, HANTRO_AUTO_PO= STPROC); + return hantro_set_fmt_out(file_to_ctx(file), &f->fmt.pix_mp, HANTRO_AUTO_= POSTPROC); } =20 static int vidioc_s_fmt_cap_mplane(struct file *file, void *priv, struct v4l2_format = *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 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 64CAB23644D; Sat, 2 Aug 2025 09:33:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127183; cv=none; b=GzecR9z3hFg3ycQ5/MW7n8rnigv1jHAWp/rpcqXnSh6rnWIBoRr7EA+8jWaedDiTOYosvV+0wlo8sBqkSUUczDc/cMNu6KLX8057H+n4OmsQr7ENUWrb3hqdBeoWXpnb2UNG20ZUTo2l2eS2NqSkuBer6T40atkph1TaMaN33HQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127183; c=relaxed/simple; bh=66BEglrdeD2FnJRtm4kSgXnN6HNo5xlbirCCT8rWe5c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=m0fPav0AHNS+0WBVwEEAT/zWB18TAC8cctwThvoJvSTJs5E8GyL4zpbmEBQEOWd8wsesizfMGTQjPYzKH8aIHnqOeApKR/CORz5ljKZj3obiEpKSIzqpW5S/FoOdSWSJR8xeuY2pYGF/vlfgphTqoYC8cdmbeIbiNpz74KJCbkk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=p5R3K+Ce; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="p5R3K+Ce" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 730FA4334; Sat, 2 Aug 2025 11:32:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127134; bh=66BEglrdeD2FnJRtm4kSgXnN6HNo5xlbirCCT8rWe5c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=p5R3K+CeygVp1bnLJzVyIkEJ5l/7ByRskXoCAOaCf3ToWRKzFMbhQXQYpLw6nhHEa FFMFIGTMmqDaVfCCeQNnIPyfyBVXEpak3bs4wQI1Vj6+oQvfkvg6kSNo1BWYeTIb6x IaNd+uNpROhN3ds5QUTW0OfEJilYLfuyEFzGg+cs= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:17 +0200 Subject: [PATCH 55/65] media: omap3isp: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-55-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5850; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=66BEglrdeD2FnJRtm4kSgXnN6HNo5xlbirCCT8rWe5c=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj+uQ6AVm7vuiTX095tLRMegUIn5F62kjDrQ 0psRthrsRWJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/gAKCRByNAaPFqFW PHIiD/4uYOsKvXm2CPF0UtRBkVwC9+EC4KyRliMfJRXvQmbWJkIh7DYXOESnZ4bBTa8c3UEZDk4 fjo44DHrjN7BD+1T3lRuHTQVA95aQyol1CygcjtqDw9uInfUeNmKfaHpTBlVtV2/RLdafLyKR09 g2Yx/R5hn9YMAdNI+jFWGTQf/AYD/xHm2kJnIhlSLvV7FyY/fzKOcuEB5j2t4Om3l2OHeSp4EU6 Q+KWZGIHhdgucc1721ryoG34r1nIP3BM2fe72cGri7jjkmA0wi3T9lEsLVv6+9LlX44JY56gzkU U1paLPSLsLgXpzDIGT9vv9ZaGEFuA0ZtB/2yRm/8CjX3mfN6cKH9FpJjOxwLvSqva/yl1KBCF+r +YsqNA0ii2zHxXje8LUuxGiHVglCrpYeX+TeQfsKA0/+gdHQZILwKUx8rPRZ5nTBKi2xz0AZ7Di QFeqJ+7yYr9VU4Dff5V4PrmbEE8slWWFfpNdddD+WenrrrP7ol8VG+uOynol37PqJ4SsXoBRx1R mo/hAXX2A3Zcll+A0qXPwSskXV7rmPeOWUNTblTB4B1uaCgS0/eCzkBbuCdYLjQtUlnOky0ryWc ZWvkhrmk/NaRbd+2VrJI1ccq0/eWhrhe1WN0mQtzSAq1DT5C8vNb4TRENSMHWTjGQvkI8MPRwlJ PAyInkkQkAcd1DQ== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it remove the only left user of to_isp_video_fh() and remove the macro completely. Signed-off-by: Jacopo Mondi --- drivers/media/platform/ti/omap3isp/ispvideo.c | 22 +++++++++++----------- drivers/media/platform/ti/omap3isp/ispvideo.h | 2 -- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/media/platform/ti/omap3isp/ispvideo.c b/drivers/media/= platform/ti/omap3isp/ispvideo.c index 2c0008444b7e2b532c9af061760e7399cdf3e45d..0e7f0bf2b3463b7ef6678f7bd83= 6a952e0b707a7 100644 --- a/drivers/media/platform/ti/omap3isp/ispvideo.c +++ b/drivers/media/platform/ti/omap3isp/ispvideo.c @@ -657,7 +657,7 @@ isp_video_querycap(struct file *file, void *fh, struct = v4l2_capability *cap) static int isp_video_get_format(struct file *file, void *fh, struct v4l2_format *form= at) { - struct isp_video_fh *vfh =3D to_isp_video_fh(fh); + struct isp_video_fh *vfh =3D file_to_isp_video_fh(file); struct isp_video *video =3D video_drvdata(file); =20 if (format->type !=3D video->type) @@ -673,7 +673,7 @@ isp_video_get_format(struct file *file, void *fh, struc= t v4l2_format *format) static int isp_video_set_format(struct file *file, void *fh, struct v4l2_format *form= at) { - struct isp_video_fh *vfh =3D to_isp_video_fh(fh); + struct isp_video_fh *vfh =3D file_to_isp_video_fh(file); struct isp_video *video =3D video_drvdata(file); struct v4l2_mbus_framefmt fmt; =20 @@ -858,7 +858,7 @@ isp_video_set_selection(struct file *file, void *fh, st= ruct v4l2_selection *sel) static int isp_video_get_param(struct file *file, void *fh, struct v4l2_streamparm *a) { - struct isp_video_fh *vfh =3D to_isp_video_fh(fh); + struct isp_video_fh *vfh =3D file_to_isp_video_fh(file); struct isp_video *video =3D video_drvdata(file); =20 if (video->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT || @@ -876,7 +876,7 @@ isp_video_get_param(struct file *file, void *fh, struct= v4l2_streamparm *a) static int isp_video_set_param(struct file *file, void *fh, struct v4l2_streamparm *a) { - struct isp_video_fh *vfh =3D to_isp_video_fh(fh); + struct isp_video_fh *vfh =3D file_to_isp_video_fh(file); struct isp_video *video =3D video_drvdata(file); =20 if (video->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT || @@ -894,7 +894,7 @@ isp_video_set_param(struct file *file, void *fh, struct= v4l2_streamparm *a) static int isp_video_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers = *rb) { - struct isp_video_fh *vfh =3D to_isp_video_fh(fh); + struct isp_video_fh *vfh =3D file_to_isp_video_fh(file); struct isp_video *video =3D video_drvdata(file); int ret; =20 @@ -908,7 +908,7 @@ isp_video_reqbufs(struct file *file, void *fh, struct v= 4l2_requestbuffers *rb) static int isp_video_querybuf(struct file *file, void *fh, struct v4l2_buffer *b) { - struct isp_video_fh *vfh =3D to_isp_video_fh(fh); + struct isp_video_fh *vfh =3D file_to_isp_video_fh(file); struct isp_video *video =3D video_drvdata(file); int ret; =20 @@ -922,7 +922,7 @@ isp_video_querybuf(struct file *file, void *fh, struct = v4l2_buffer *b) static int isp_video_qbuf(struct file *file, void *fh, struct v4l2_buffer *b) { - struct isp_video_fh *vfh =3D to_isp_video_fh(fh); + struct isp_video_fh *vfh =3D file_to_isp_video_fh(file); struct isp_video *video =3D video_drvdata(file); int ret; =20 @@ -936,7 +936,7 @@ isp_video_qbuf(struct file *file, void *fh, struct v4l2= _buffer *b) static int isp_video_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b) { - struct isp_video_fh *vfh =3D to_isp_video_fh(fh); + struct isp_video_fh *vfh =3D file_to_isp_video_fh(file); struct isp_video *video =3D video_drvdata(file); int ret; =20 @@ -1074,7 +1074,7 @@ static int isp_video_check_external_subdevs(struct is= p_video *video, static int isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) { - struct isp_video_fh *vfh =3D to_isp_video_fh(fh); + struct isp_video_fh *vfh =3D file_to_isp_video_fh(file); struct isp_video *video =3D video_drvdata(file); enum isp_pipeline_state state; struct isp_pipeline *pipe; @@ -1180,7 +1180,7 @@ isp_video_streamon(struct file *file, void *fh, enum = v4l2_buf_type type) static int isp_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type) { - struct isp_video_fh *vfh =3D to_isp_video_fh(fh); + struct isp_video_fh *vfh =3D file_to_isp_video_fh(file); struct isp_video *video =3D video_drvdata(file); struct isp_pipeline *pipe =3D to_isp_pipeline(&video->video.entity); enum isp_pipeline_state state; @@ -1348,7 +1348,7 @@ static int isp_video_release(struct file *file) { struct isp_video *video =3D video_drvdata(file); struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); - struct isp_video_fh *handle =3D to_isp_video_fh(vfh); + struct isp_video_fh *handle =3D file_to_isp_video_fh(file); =20 /* Disable streaming and free the buffers queue resources. */ isp_video_streamoff(file, vfh, video->type); diff --git a/drivers/media/platform/ti/omap3isp/ispvideo.h b/drivers/media/= platform/ti/omap3isp/ispvideo.h index 355812770e18ef5353ac68e65426a3180a6d91ab..537da59cff6258cb66ff4eac6ad= 2739c3f9465c4 100644 --- a/drivers/media/platform/ti/omap3isp/ispvideo.h +++ b/drivers/media/platform/ti/omap3isp/ispvideo.h @@ -194,8 +194,6 @@ struct isp_video_fh { struct v4l2_fract timeperframe; }; =20 -#define to_isp_video_fh(fh) container_of(fh, struct isp_video_fh, vfh) - static inline struct isp_video_fh *file_to_isp_video_fh(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct isp_video_fh, vfh); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 0DFEE2367A6; Sat, 2 Aug 2025 09:33:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127193; cv=none; b=ZW6oLpcwSkypxbiyKVQR90Qa7YcOyjZJzK6whBelxEg4C55pEIY25qg9MMAYl6hyjgB1oh5rNytR207sHcZwsetVvi/AG9z75ToQLxihEY/ypHZRr8EKZIek82AXDWs4I93HBKRxR11wk9H1VQtG/x8Z6Tyeghbz0XXXM4/siPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127193; c=relaxed/simple; bh=miW0R2xYtxU5IpQyW/2QNq3ARYOqYEt7oDwJXWluDGc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K2vXWV4H+BchBrU74Dv/9oX9/KnAO6PnO5Ez+ySOUDr0VZMFM7P2fR4fIH/43rM/3okvvxekdkxZVwMVIz+GINBBaUUaJhTnAI867ca2hin9d8eRleKCr/P/Ld5bYTLEQGdKAkIAnznF9GDmIcLSt2TGm+9JZv8/U/kfLHlmXr8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=az8gjqsy; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="az8gjqsy" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1A4ED4370; Sat, 2 Aug 2025 11:32:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127143; bh=miW0R2xYtxU5IpQyW/2QNq3ARYOqYEt7oDwJXWluDGc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=az8gjqsyXEti0JeVSm77geSmA7AkpCysThF60WhNPtJM1uNt7bbBCDUakaT72hVhp l1GEVpO9e8XGH0VXe1MBRi2SnPKVb88n3ZKKaA2ZQlRkgmHZNFLOH75+TXNUtFCuFY RzGTt8HUu1W6qrgy51RvHIBcPJ9wsdrXruX+PJT8= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:18 +0200 Subject: [PATCH 56/65] media: cx18: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-56-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=11351; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=miW0R2xYtxU5IpQyW/2QNq3ARYOqYEt7oDwJXWluDGc=; b=kA0DAAoBcjQGjxahVjwByyZiAGiN2P6hMeCxCr0Vka9Jl65Kl6jOUQEBXEv4+uSblIpUX075K YkCMwQAAQoAHRYhBLXEPUiAmiCKj1g4wHI0Bo8WoVY8BQJojdj+AAoJEHI0Bo8WoVY8yzYP/jvk Cn3ngJT9BnSoIQGO0difqKYaY1cOKFJbaTdTzoLYKZ69MckDT1/9I3IehU8xvX/UhTdz5n6QdKD BAQS9lATwrt7P4Xq5uAKscHSkqZWRqV2OCe62nOwrWce6tsEaSznl9IIW9IltgMfA7LzjugyXed pzGRV0ByLbznHIYPOjUfErQNkQ4HlLMIXRSdSdCM21OZb2eYnEgRDKQv66Kh3kZWlUM3PnOnSAS 82Xha7svCmWPYkLpOTtSuPaUveRcfcmkz3IBjsJY3JX34RZDY6IGhgNPYzNAVyCdkz6QI7LuFj6 9phgs8UVK17Dd45xpXRFdgKVmKkM7uJayjqrWAVeuiyvJXKCT4DPMgMCf2LyxX9u3vE3z0x8pE9 GG5jEhOBFOh8QJNV7BuWk8ivRC6QBX6h1BxwBCjCUTgo8/ktEcuaNR6AA7Y3FlgQRbKSR2XyZ5q NkiBoasrxsyCUPw5hhXrXTPJDIVRrV85Y2uT5wyiXTUuflm5bIbRQO3Pb3qDMDNU6/l/KsJo37N cvU+EkKMPwpJe6rktlQWrLqLW0TT2HQArsVlpZrTUmuQ8wVJJafbqFYwcEitbxi3ZqAQF22uiVn 17W9hTzoSrtIKSM8NAfNewUYnTvyQPQ7/oEQVj3m3/HLXss/LiU6hE2+R0lnThzbpJNCVXBYjSQ 5ybBH X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- drivers/media/pci/cx18/cx18-ioctl.c | 64 ++++++++++++++++++---------------= ---- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/c= x18-ioctl.c index 9a1512b1ccaafd991c0422616a0d7b3e6c7c49cc..bf16d36448f888d9326b5f4a8f9= c8f0e13d0c3a1 100644 --- a/drivers/media/pci/cx18/cx18-ioctl.c +++ b/drivers/media/pci/cx18/cx18-ioctl.c @@ -52,7 +52,7 @@ static const struct v4l2_fmtdesc cx18_formats_mpeg[] =3D { static int cx18_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) { - struct cx18_open_id *id =3D fh2id(fh); + struct cx18_open_id *id =3D file2id(file); struct cx18 *cx =3D id->cx; struct cx18_stream *s =3D &cx->streams[id->type]; struct v4l2_pix_format *pixfmt =3D &fmt->fmt.pix; @@ -76,7 +76,7 @@ static int cx18_g_fmt_vid_cap(struct file *file, void *fh, static int cx18_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) { - struct cx18_open_id *id =3D fh2id(fh); + struct cx18_open_id *id =3D file2id(file); struct cx18 *cx =3D id->cx; struct v4l2_pix_format *pixfmt =3D &fmt->fmt.pix; int w =3D pixfmt->width; @@ -121,7 +121,7 @@ static int cx18_try_fmt_vid_cap(struct file *file, void= *fh, static int cx18_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) { - struct cx18_open_id *id =3D fh2id(fh); + struct cx18_open_id *id =3D file2id(file); struct cx18 *cx =3D id->cx; struct v4l2_subdev_format format =3D { .which =3D V4L2_SUBDEV_FORMAT_ACTIVE, @@ -261,7 +261,7 @@ u16 cx18_get_service_set(struct v4l2_sliced_vbi_format = *fmt) static int cx18_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; struct v4l2_vbi_format *vbifmt =3D &fmt->fmt.vbi; =20 vbifmt->sampling_rate =3D 27000000; @@ -280,7 +280,7 @@ static int cx18_g_fmt_vbi_cap(struct file *file, void *= fh, static int cx18_g_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; struct v4l2_sliced_vbi_format *vbifmt =3D &fmt->fmt.sliced; =20 /* sane, V4L2 spec compliant, defaults */ @@ -311,7 +311,7 @@ static int cx18_try_fmt_vbi_cap(struct file *file, void= *fh, static int cx18_try_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; struct v4l2_sliced_vbi_format *vbifmt =3D &fmt->fmt.sliced; =20 vbifmt->io_size =3D sizeof(struct v4l2_sliced_vbi_data) * 36; @@ -330,7 +330,7 @@ static int cx18_try_fmt_sliced_vbi_cap(struct file *fil= e, void *fh, static int cx18_s_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) { - struct cx18_open_id *id =3D fh2id(fh); + struct cx18_open_id *id =3D file2id(file); struct cx18 *cx =3D id->cx; int ret; =20 @@ -360,7 +360,7 @@ static int cx18_s_fmt_vbi_cap(struct file *file, void *= fh, static int cx18_s_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) { - struct cx18_open_id *id =3D fh2id(fh); + struct cx18_open_id *id =3D file2id(file); struct cx18 *cx =3D id->cx; int ret; struct v4l2_sliced_vbi_format *vbifmt =3D &fmt->fmt.sliced; @@ -392,7 +392,7 @@ static int cx18_s_fmt_sliced_vbi_cap(struct file *file,= void *fh, static int cx18_g_register(struct file *file, void *fh, struct v4l2_dbg_register *reg) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 if (reg->reg & 0x3) return -EINVAL; @@ -406,7 +406,7 @@ static int cx18_g_register(struct file *file, void *fh, static int cx18_s_register(struct file *file, void *fh, const struct v4l2_dbg_register *reg) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 if (reg->reg & 0x3) return -EINVAL; @@ -420,7 +420,7 @@ static int cx18_s_register(struct file *file, void *fh, static int cx18_querycap(struct file *file, void *fh, struct v4l2_capability *vcap) { - struct cx18_open_id *id =3D fh2id(fh); + struct cx18_open_id *id =3D file2id(file); struct cx18 *cx =3D id->cx; =20 strscpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); @@ -431,14 +431,14 @@ static int cx18_querycap(struct file *file, void *fh, =20 static int cx18_enumaudio(struct file *file, void *fh, struct v4l2_audio *= vin) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 return cx18_get_audio_input(cx, vin->index, vin); } =20 static int cx18_g_audio(struct file *file, void *fh, struct v4l2_audio *vi= n) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 vin->index =3D cx->audio_input; return cx18_get_audio_input(cx, vin->index, vin); @@ -446,7 +446,7 @@ static int cx18_g_audio(struct file *file, void *fh, st= ruct v4l2_audio *vin) =20 static int cx18_s_audio(struct file *file, void *fh, const struct v4l2_aud= io *vout) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 if (vout->index >=3D cx->nof_audio_inputs) return -EINVAL; @@ -457,7 +457,7 @@ static int cx18_s_audio(struct file *file, void *fh, co= nst struct v4l2_audio *vo =20 static int cx18_enum_input(struct file *file, void *fh, struct v4l2_input = *vin) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 /* set it to defaults from our table */ return cx18_get_input(cx, vin->index, vin); @@ -466,7 +466,7 @@ static int cx18_enum_input(struct file *file, void *fh,= struct v4l2_input *vin) static int cx18_g_pixelaspect(struct file *file, void *fh, int type, struct v4l2_fract *f) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 if (type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; @@ -479,7 +479,7 @@ static int cx18_g_pixelaspect(struct file *file, void *= fh, static int cx18_g_selection(struct file *file, void *fh, struct v4l2_selection *sel) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 if (sel->type !=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; @@ -499,7 +499,7 @@ static int cx18_g_selection(struct file *file, void *fh, static int cx18_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdesc *fmt) { - struct cx18_open_id *id =3D fh2id(fh); + struct cx18_open_id *id =3D file2id(file); =20 if (id->type =3D=3D CX18_ENC_STREAM_TYPE_YUV) { if (fmt->index >=3D ARRAY_SIZE(cx18_formats_yuv)) @@ -515,7 +515,7 @@ static int cx18_enum_fmt_vid_cap(struct file *file, voi= d *fh, =20 static int cx18_g_input(struct file *file, void *fh, unsigned int *i) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 *i =3D cx->active_input; return 0; @@ -523,7 +523,7 @@ static int cx18_g_input(struct file *file, void *fh, un= signed int *i) =20 int cx18_s_input(struct file *file, void *fh, unsigned int inp) { - struct cx18_open_id *id =3D fh2id(fh); + struct cx18_open_id *id =3D file2id(file); struct cx18 *cx =3D id->cx; v4l2_std_id std =3D V4L2_STD_ALL; const struct cx18_card_video_input *card_input =3D @@ -561,7 +561,7 @@ int cx18_s_input(struct file *file, void *fh, unsigned = int inp) static int cx18_g_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 if (vf->tuner !=3D 0) return -EINVAL; @@ -572,7 +572,7 @@ static int cx18_g_frequency(struct file *file, void *fh, =20 int cx18_s_frequency(struct file *file, void *fh, const struct v4l2_freque= ncy *vf) { - struct cx18_open_id *id =3D fh2id(fh); + struct cx18_open_id *id =3D file2id(file); struct cx18 *cx =3D id->cx; =20 if (vf->tuner !=3D 0) @@ -587,7 +587,7 @@ int cx18_s_frequency(struct file *file, void *fh, const= struct v4l2_frequency *v =20 static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 *std =3D cx->std; return 0; @@ -595,7 +595,7 @@ static int cx18_g_std(struct file *file, void *fh, v4l2= _std_id *std) =20 int cx18_s_std(struct file *file, void *fh, v4l2_std_id std) { - struct cx18_open_id *id =3D fh2id(fh); + struct cx18_open_id *id =3D file2id(file); struct cx18 *cx =3D id->cx; =20 if ((std & V4L2_STD_ALL) =3D=3D 0) @@ -644,7 +644,7 @@ int cx18_s_std(struct file *file, void *fh, v4l2_std_id= std) =20 static int cx18_s_tuner(struct file *file, void *fh, const struct v4l2_tun= er *vt) { - struct cx18_open_id *id =3D fh2id(fh); + struct cx18_open_id *id =3D file2id(file); struct cx18 *cx =3D id->cx; =20 if (vt->index !=3D 0) @@ -656,7 +656,7 @@ static int cx18_s_tuner(struct file *file, void *fh, co= nst struct v4l2_tuner *vt =20 static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 if (vt->index !=3D 0) return -EINVAL; @@ -673,7 +673,7 @@ static int cx18_g_tuner(struct file *file, void *fh, st= ruct v4l2_tuner *vt) static int cx18_g_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_sliced_vbi_cap *cap) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; int set =3D cx->is_50hz ? V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525; int f, l; =20 @@ -794,7 +794,7 @@ static int cx18_process_idx_data(struct cx18_stream *s,= struct cx18_mdl *mdl, static int cx18_g_enc_index(struct file *file, void *fh, struct v4l2_enc_idx *idx) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; struct cx18_stream *s =3D &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; s32 tmp; struct cx18_mdl *mdl; @@ -841,7 +841,7 @@ static int cx18_g_enc_index(struct file *file, void *fh, static int cx18_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd *enc) { - struct cx18_open_id *id =3D fh2id(fh); + struct cx18_open_id *id =3D file2id(file); struct cx18 *cx =3D id->cx; u32 h; =20 @@ -900,7 +900,7 @@ static int cx18_encoder_cmd(struct file *file, void *fh, static int cx18_try_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd *enc) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 switch (enc->cmd) { case V4L2_ENC_CMD_START: @@ -932,7 +932,7 @@ static int cx18_try_encoder_cmd(struct file *file, void= *fh, =20 static int cx18_log_status(struct file *file, void *fh) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; struct v4l2_input vidin; struct v4l2_audio audin; int i; @@ -976,7 +976,7 @@ static int cx18_log_status(struct file *file, void *fh) static long cx18_default(struct file *file, void *fh, bool valid_prio, unsigned int cmd, void *arg) { - struct cx18 *cx =3D fh2id(fh)->cx; + struct cx18 *cx =3D file2id(file)->cx; =20 switch (cmd) { case VIDIOC_INT_RESET: { --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 A6666283159; Sat, 2 Aug 2025 09:33:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127201; cv=none; b=qNA4bfTbcC2EqPL2mxuG0Ctr8++ASs9VMaNiW24NYnHnBsTmgo3D8UxoJjC9LkmTkoVI4srhdxGJKx6up2sMTNpH80K2I2qhefHN1tTHemgjMGmKDhWHYUN+AaRzu3UCXB34rah6FinJTdHXbWQ6LKKty+ffrGLrBtL7ACVFtnA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127201; c=relaxed/simple; bh=Y80t6mB4iwBQesQdO4LMCe3YSMTXsJXe2CdPx2tZgnM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UFg/OFH1RzeL7Cc6n/9SSCgO7Q953Lp6qc9L8KoAFVcgLWPQ7PVC/qhasMH8uKeEb3IdhRIbSno/vNeO0tdxze87I5uAuQdu3V8RuJD3YjmgTeh/nvbvZtjF8fVHUyf7Agpo+creSBMsiqiBoFjwBG///buKwg2mVfAeb7sH5I0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=HbDZkGyP; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HbDZkGyP" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6D376EA0; Sat, 2 Aug 2025 11:32:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127152; bh=Y80t6mB4iwBQesQdO4LMCe3YSMTXsJXe2CdPx2tZgnM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HbDZkGyPReuTqOUXC4XHvtVbecmjFjkvn9QhJ0swKjQNlvhX4OF1EMulXh30ASkzt N9fqCk2OHTyciiwGn7MpBubDw2OX/r2v3IlRdXILvymYskKIxuLeBDm9MbMPNzNusL nwkNIoughd8Iq0CCaXEm6KLMQF2/2xUQeORvtiSM= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:19 +0200 Subject: [PATCH 57/65] media: ivtv: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-57-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=22060; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=Y80t6mB4iwBQesQdO4LMCe3YSMTXsJXe2CdPx2tZgnM=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj+/vd8qdz5//sT07XduRB8DRKCpHK7o4Fbl m7SrCBEp6OJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/gAKCRByNAaPFqFW PIvnD/93dcaaiVIv4xP4TjJUecfS+KksaInR7XVJ9lOTjDhNOGP/MA1HqTEI46kfkiDDOTqOwA6 Y4v43HX2/p9BqmBQ++L/6yhnRUHGpzMLbcYPl/plBKjEGX5Rq5f+WiBf185PrseXD4ZdxWkS7OO 5fkexLYYfixbUAYAKeSUF8K34JBxU6+xbaozfQqrtF5pPau0v5uJMCorHOY4PNbFiQQSZZKTISS 3J7f8BAim1cqQOxtXMIZDe72HYeI38zijMOr9GwPVdVVPB4Ha11Ab4Zk0hDiillEvLGcVM6aNDv jg2hyzmuzxqiEUrr1hDr2hFtLcD5hhoyAnbbplUggWrpk8axwRa5rFSAzriHn2mu0UORF0tNHUG St9yirJPpMVekNHIOsqJTfuzafUlZfwzY4tz72wlE2T6w+EKS1MMAsYte+k+7pzmYDKuNTb6HHV rzLa6zgKrW+uNul5J8y+Qg64ur0bR1bjQc27JZrSuk8kzI+/2W6/6nS7vB1SvPbL5WM5/bCRVrx aahTr+Rg0JDCSldHLSKOSQ4mbFvJFneyUnsRlEd4WrEGNBzBzLYZ/CuqP3A2UNMoUaAVS4Me1Xd NoPs417fSlc9Xu7lCqp7iFx01KI1tQ07uiHbunVdTpf+E7YTsYFTLVyIbBT8ueL0tdRtheyt7oM C3CCP/dgA/Ghuxw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. While at it remove the only left user of fh2id() and remove the macro completely. Signed-off-by: Jacopo Mondi --- drivers/media/pci/ivtv/ivtv-driver.h | 5 -- drivers/media/pci/ivtv/ivtv-fileops.c | 2 +- drivers/media/pci/ivtv/ivtv-ioctl.c | 124 +++++++++++++++++-------------= ---- 3 files changed, 63 insertions(+), 68 deletions(-) diff --git a/drivers/media/pci/ivtv/ivtv-driver.h b/drivers/media/pci/ivtv/= ivtv-driver.h index 38c4ceb04cf834906ed877b57c20fcbdb390da13..69c37f450c21f91abb4e4f73823= 097bd61d5abc2 100644 --- a/drivers/media/pci/ivtv/ivtv-driver.h +++ b/drivers/media/pci/ivtv/ivtv-driver.h @@ -384,11 +384,6 @@ struct ivtv_open_id { struct ivtv *itv; }; =20 -static inline struct ivtv_open_id *fh2id(struct v4l2_fh *fh) -{ - return container_of(fh, struct ivtv_open_id, fh); -} - static inline struct ivtv_open_id *file2id(struct file *filp) { return container_of(file_to_v4l2_fh(filp), struct ivtv_open_id, fh); diff --git a/drivers/media/pci/ivtv/ivtv-fileops.c b/drivers/media/pci/ivtv= /ivtv-fileops.c index 0040a5e7f654149eb429400dd1db7197a9a3b54e..814fe7989cdc11ed225f03a9168= be50c6b9ba595 100644 --- a/drivers/media/pci/ivtv/ivtv-fileops.c +++ b/drivers/media/pci/ivtv/ivtv-fileops.c @@ -878,7 +878,7 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id,= int flags, u64 pts) int ivtv_v4l2_close(struct file *filp) { struct v4l2_fh *fh =3D file_to_v4l2_fh(filp); - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(filp); struct ivtv *itv =3D id->itv; struct ivtv_stream *s =3D &itv->streams[id->type]; =20 diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/i= vtv-ioctl.c index d888435b71fb6f6873d9d884248a67364576bf33..8077a71d4850ec773caa20c3fca= 08f92f3117d69 100644 --- a/drivers/media/pci/ivtv/ivtv-ioctl.c +++ b/drivers/media/pci/ivtv/ivtv-ioctl.c @@ -308,7 +308,7 @@ static int ivtv_video_command(struct ivtv *itv, struct = ivtv_open_id *id, =20 static int ivtv_g_fmt_sliced_vbi_out(struct file *file, void *fh, struct v= 4l2_format *fmt) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; struct v4l2_sliced_vbi_format *vbifmt =3D &fmt->fmt.sliced; =20 vbifmt->reserved[0] =3D 0; @@ -330,7 +330,7 @@ static int ivtv_g_fmt_sliced_vbi_out(struct file *file,= void *fh, struct v4l2_fo =20 static int ivtv_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_for= mat *fmt) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; struct v4l2_pix_format *pixfmt =3D &fmt->fmt.pix; =20 @@ -353,7 +353,7 @@ static int ivtv_g_fmt_vid_cap(struct file *file, void *= fh, struct v4l2_format *f =20 static int ivtv_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_for= mat *fmt) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; struct v4l2_vbi_format *vbifmt =3D &fmt->fmt.vbi; =20 vbifmt->sampling_rate =3D 27000000; @@ -372,7 +372,7 @@ static int ivtv_g_fmt_vbi_cap(struct file *file, void *= fh, struct v4l2_format *f static int ivtv_g_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v= 4l2_format *fmt) { struct v4l2_sliced_vbi_format *vbifmt =3D &fmt->fmt.sliced; - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; =20 vbifmt->reserved[0] =3D 0; @@ -394,7 +394,7 @@ static int ivtv_g_fmt_sliced_vbi_cap(struct file *file,= void *fh, struct v4l2_fo =20 static int ivtv_g_fmt_vid_out(struct file *file, void *fh, struct v4l2_for= mat *fmt) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; struct v4l2_pix_format *pixfmt =3D &fmt->fmt.pix; =20 @@ -434,8 +434,8 @@ static int ivtv_g_fmt_vid_out(struct file *file, void *= fh, struct v4l2_format *f =20 static int ivtv_g_fmt_vid_out_overlay(struct file *file, void *fh, struct = v4l2_format *fmt) { - struct ivtv *itv =3D fh2id(fh)->itv; - struct ivtv_stream *s =3D &itv->streams[fh2id(fh)->type]; + struct ivtv *itv =3D file2id(file)->itv; + struct ivtv_stream *s =3D &itv->streams[file2id(file)->type]; struct v4l2_window *winfmt =3D &fmt->fmt.win; =20 if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) @@ -461,7 +461,7 @@ static int ivtv_try_fmt_sliced_vbi_out(struct file *fil= e, void *fh, struct v4l2_ =20 static int ivtv_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_f= ormat *fmt) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; int w =3D fmt->fmt.pix.width; int h =3D fmt->fmt.pix.height; @@ -490,7 +490,7 @@ static int ivtv_try_fmt_vbi_cap(struct file *file, void= *fh, struct v4l2_format static int ivtv_try_fmt_sliced_vbi_cap(struct file *file, void *fh, struct= v4l2_format *fmt) { struct v4l2_sliced_vbi_format *vbifmt =3D &fmt->fmt.sliced; - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; =20 if (id->type =3D=3D IVTV_DEC_STREAM_TYPE_VBI) @@ -510,7 +510,7 @@ static int ivtv_try_fmt_sliced_vbi_cap(struct file *fil= e, void *fh, struct v4l2_ =20 static int ivtv_try_fmt_vid_out(struct file *file, void *fh, struct v4l2_f= ormat *fmt) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); s32 w =3D fmt->fmt.pix.width; s32 h =3D fmt->fmt.pix.height; int field =3D fmt->fmt.pix.field; @@ -544,8 +544,8 @@ static int ivtv_try_fmt_vid_out(struct file *file, void= *fh, struct v4l2_format =20 static int ivtv_try_fmt_vid_out_overlay(struct file *file, void *fh, struc= t v4l2_format *fmt) { - struct ivtv *itv =3D fh2id(fh)->itv; - struct ivtv_stream *s =3D &itv->streams[fh2id(fh)->type]; + struct ivtv *itv =3D file2id(file)->itv; + struct ivtv_stream *s =3D &itv->streams[file2id(file)->type]; u32 chromakey =3D fmt->fmt.win.chromakey; u8 global_alpha =3D fmt->fmt.win.global_alpha; =20 @@ -566,7 +566,7 @@ static int ivtv_s_fmt_sliced_vbi_out(struct file *file,= void *fh, struct v4l2_fo =20 static int ivtv_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_for= mat *fmt) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; struct v4l2_subdev_format format =3D { .which =3D V4L2_SUBDEV_FORMAT_ACTIVE, @@ -597,7 +597,7 @@ static int ivtv_s_fmt_vid_cap(struct file *file, void *= fh, struct v4l2_format *f =20 static int ivtv_s_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_for= mat *fmt) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 if (!ivtv_raw_vbi(itv) && atomic_read(&itv->capturing) > 0) return -EBUSY; @@ -610,7 +610,7 @@ static int ivtv_s_fmt_vbi_cap(struct file *file, void *= fh, struct v4l2_format *f static int ivtv_s_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v= 4l2_format *fmt) { struct v4l2_sliced_vbi_format *vbifmt =3D &fmt->fmt.sliced; - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; int ret =3D ivtv_try_fmt_sliced_vbi_cap(file, fh, fmt); =20 @@ -628,7 +628,7 @@ static int ivtv_s_fmt_sliced_vbi_cap(struct file *file,= void *fh, struct v4l2_fo =20 static int ivtv_s_fmt_vid_out(struct file *file, void *fh, struct v4l2_for= mat *fmt) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; struct yuv_playback_info *yi =3D &itv->yuv_info; int ret =3D ivtv_try_fmt_vid_out(file, fh, fmt); @@ -673,7 +673,7 @@ static int ivtv_s_fmt_vid_out(struct file *file, void *= fh, struct v4l2_format *f =20 static int ivtv_s_fmt_vid_out_overlay(struct file *file, void *fh, struct = v4l2_format *fmt) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; int ret =3D ivtv_try_fmt_vid_out_overlay(file, fh, fmt); =20 if (ret =3D=3D 0) { @@ -710,7 +710,7 @@ static int ivtv_itvc(struct ivtv *itv, bool get, u64 re= g, u64 *val) =20 static int ivtv_g_register(struct file *file, void *fh, struct v4l2_dbg_re= gister *reg) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 reg->size =3D 4; return ivtv_itvc(itv, true, reg->reg, ®->val); @@ -718,7 +718,7 @@ static int ivtv_g_register(struct file *file, void *fh,= struct v4l2_dbg_register =20 static int ivtv_s_register(struct file *file, void *fh, const struct v4l2_= dbg_register *reg) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; u64 val =3D reg->val; =20 return ivtv_itvc(itv, false, reg->reg, &val); @@ -727,7 +727,7 @@ static int ivtv_s_register(struct file *file, void *fh,= const struct v4l2_dbg_re =20 static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capabili= ty *vcap) { - struct ivtv_open_id *id =3D fh2id(file_to_v4l2_fh(file)); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; =20 strscpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); @@ -738,14 +738,14 @@ static int ivtv_querycap(struct file *file, void *fh,= struct v4l2_capability *vc =20 static int ivtv_enumaudio(struct file *file, void *fh, struct v4l2_audio *= vin) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 return ivtv_get_audio_input(itv, vin->index, vin); } =20 static int ivtv_g_audio(struct file *file, void *fh, struct v4l2_audio *vi= n) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 vin->index =3D itv->audio_input; return ivtv_get_audio_input(itv, vin->index, vin); @@ -753,7 +753,7 @@ static int ivtv_g_audio(struct file *file, void *fh, st= ruct v4l2_audio *vin) =20 static int ivtv_s_audio(struct file *file, void *fh, const struct v4l2_aud= io *vout) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 if (vout->index >=3D itv->nof_audio_inputs) return -EINVAL; @@ -766,7 +766,7 @@ static int ivtv_s_audio(struct file *file, void *fh, co= nst struct v4l2_audio *vo =20 static int ivtv_enumaudout(struct file *file, void *fh, struct v4l2_audioo= ut *vin) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 /* set it to defaults from our table */ return ivtv_get_audio_output(itv, vin->index, vin); @@ -774,7 +774,7 @@ static int ivtv_enumaudout(struct file *file, void *fh,= struct v4l2_audioout *vi =20 static int ivtv_g_audout(struct file *file, void *fh, struct v4l2_audioout= *vin) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 vin->index =3D 0; return ivtv_get_audio_output(itv, vin->index, vin); @@ -782,7 +782,7 @@ static int ivtv_g_audout(struct file *file, void *fh, s= truct v4l2_audioout *vin) =20 static int ivtv_s_audout(struct file *file, void *fh, const struct v4l2_au= dioout *vout) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 if (itv->card->video_outputs =3D=3D NULL || vout->index !=3D 0) return -EINVAL; @@ -791,7 +791,7 @@ static int ivtv_s_audout(struct file *file, void *fh, c= onst struct v4l2_audioout =20 static int ivtv_enum_input(struct file *file, void *fh, struct v4l2_input = *vin) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 /* set it to defaults from our table */ return ivtv_get_input(itv, vin->index, vin); @@ -799,7 +799,7 @@ static int ivtv_enum_input(struct file *file, void *fh,= struct v4l2_input *vin) =20 static int ivtv_enum_output(struct file *file, void *fh, struct v4l2_outpu= t *vout) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 return ivtv_get_output(itv, vout->index, vout); } @@ -807,7 +807,7 @@ static int ivtv_enum_output(struct file *file, void *fh= , struct v4l2_output *vou static int ivtv_g_pixelaspect(struct file *file, void *fh, int type, struct v4l2_fract *f) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; =20 if (type =3D=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) { @@ -825,7 +825,7 @@ static int ivtv_g_pixelaspect(struct file *file, void *= fh, static int ivtv_s_selection(struct file *file, void *fh, struct v4l2_selection *sel) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; struct yuv_playback_info *yi =3D &itv->yuv_info; struct v4l2_rect r =3D { 0, 0, 720, 0 }; @@ -868,7 +868,7 @@ static int ivtv_s_selection(struct file *file, void *fh, static int ivtv_g_selection(struct file *file, void *fh, struct v4l2_selection *sel) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; struct yuv_playback_info *yi =3D &itv->yuv_info; struct v4l2_rect r =3D { 0, 0, 720, 0 }; @@ -924,8 +924,8 @@ static int ivtv_enum_fmt_vid_cap(struct file *file, voi= d *fh, struct v4l2_fmtdes .description =3D "MPEG", .pixelformat =3D V4L2_PIX_FMT_MPEG, }; - struct ivtv *itv =3D fh2id(fh)->itv; - struct ivtv_stream *s =3D &itv->streams[fh2id(fh)->type]; + struct ivtv *itv =3D file2id(file)->itv; + struct ivtv_stream *s =3D &itv->streams[file2id(file)->type]; =20 if (fmt->index) return -EINVAL; @@ -951,8 +951,8 @@ static int ivtv_enum_fmt_vid_out(struct file *file, voi= d *fh, struct v4l2_fmtdes .description =3D "MPEG", .pixelformat =3D V4L2_PIX_FMT_MPEG, }; - struct ivtv *itv =3D fh2id(fh)->itv; - struct ivtv_stream *s =3D &itv->streams[fh2id(fh)->type]; + struct ivtv *itv =3D file2id(file)->itv; + struct ivtv_stream *s =3D &itv->streams[file2id(file)->type]; =20 if (fmt->index) return -EINVAL; @@ -967,7 +967,7 @@ static int ivtv_enum_fmt_vid_out(struct file *file, voi= d *fh, struct v4l2_fmtdes =20 static int ivtv_g_input(struct file *file, void *fh, unsigned int *i) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 *i =3D itv->active_input; =20 @@ -976,7 +976,7 @@ static int ivtv_g_input(struct file *file, void *fh, un= signed int *i) =20 int ivtv_s_input(struct file *file, void *fh, unsigned int inp) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; v4l2_std_id std; int i; =20 @@ -1019,7 +1019,7 @@ int ivtv_s_input(struct file *file, void *fh, unsigne= d int inp) =20 static int ivtv_g_output(struct file *file, void *fh, unsigned int *i) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) return -EINVAL; @@ -1031,7 +1031,7 @@ static int ivtv_g_output(struct file *file, void *fh,= unsigned int *i) =20 static int ivtv_s_output(struct file *file, void *fh, unsigned int outp) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 if (outp >=3D itv->card->nof_outputs) return -EINVAL; @@ -1053,8 +1053,8 @@ static int ivtv_s_output(struct file *file, void *fh,= unsigned int outp) =20 static int ivtv_g_frequency(struct file *file, void *fh, struct v4l2_frequ= ency *vf) { - struct ivtv *itv =3D fh2id(fh)->itv; - struct ivtv_stream *s =3D &itv->streams[fh2id(fh)->type]; + struct ivtv *itv =3D file2id(file)->itv; + struct ivtv_stream *s =3D &itv->streams[file2id(file)->type]; =20 if (s->vdev.vfl_dir) return -ENOTTY; @@ -1067,8 +1067,8 @@ static int ivtv_g_frequency(struct file *file, void *= fh, struct v4l2_frequency * =20 int ivtv_s_frequency(struct file *file, void *fh, const struct v4l2_freque= ncy *vf) { - struct ivtv *itv =3D fh2id(fh)->itv; - struct ivtv_stream *s =3D &itv->streams[fh2id(fh)->type]; + struct ivtv *itv =3D file2id(file)->itv; + struct ivtv_stream *s =3D &itv->streams[file2id(file)->type]; =20 if (s->vdev.vfl_dir) return -ENOTTY; @@ -1084,7 +1084,7 @@ int ivtv_s_frequency(struct file *file, void *fh, con= st struct v4l2_frequency *v =20 static int ivtv_g_std(struct file *file, void *fh, v4l2_std_id *std) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 *std =3D itv->std; return 0; @@ -1157,7 +1157,7 @@ void ivtv_s_std_dec(struct ivtv *itv, v4l2_std_id std) =20 static int ivtv_s_std(struct file *file, void *fh, v4l2_std_id std) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 if ((std & V4L2_STD_ALL) =3D=3D 0) return -EINVAL; @@ -1185,7 +1185,7 @@ static int ivtv_s_std(struct file *file, void *fh, v4= l2_std_id std) =20 static int ivtv_s_tuner(struct file *file, void *fh, const struct v4l2_tun= er *vt) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; =20 if (vt->index !=3D 0) @@ -1198,7 +1198,7 @@ static int ivtv_s_tuner(struct file *file, void *fh, = const struct v4l2_tuner *vt =20 static int ivtv_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 if (vt->index !=3D 0) return -EINVAL; @@ -1214,7 +1214,7 @@ static int ivtv_g_tuner(struct file *file, void *fh, = struct v4l2_tuner *vt) =20 static int ivtv_g_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_= sliced_vbi_cap *cap) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; int set =3D itv->is_50hz ? V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525; int f, l; =20 @@ -1249,7 +1249,7 @@ static int ivtv_g_sliced_vbi_cap(struct file *file, v= oid *fh, struct v4l2_sliced =20 static int ivtv_g_enc_index(struct file *file, void *fh, struct v4l2_enc_i= dx *idx) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; struct v4l2_enc_idx_entry *e =3D idx->entry; int entries; int i; @@ -1275,7 +1275,7 @@ static int ivtv_g_enc_index(struct file *file, void *= fh, struct v4l2_enc_idx *id =20 static int ivtv_encoder_cmd(struct file *file, void *fh, struct v4l2_encod= er_cmd *enc) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; =20 =20 @@ -1327,7 +1327,7 @@ static int ivtv_encoder_cmd(struct file *file, void *= fh, struct v4l2_encoder_cmd =20 static int ivtv_try_encoder_cmd(struct file *file, void *fh, struct v4l2_e= ncoder_cmd *enc) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 switch (enc->cmd) { case V4L2_ENC_CMD_START: @@ -1357,8 +1357,8 @@ static int ivtv_try_encoder_cmd(struct file *file, vo= id *fh, struct v4l2_encoder =20 static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffe= r *fb) { - struct ivtv *itv =3D fh2id(fh)->itv; - struct ivtv_stream *s =3D &itv->streams[fh2id(fh)->type]; + struct ivtv *itv =3D file2id(file)->itv; + struct ivtv_stream *s =3D &itv->streams[file2id(file)->type]; u32 data[CX2341X_MBOX_MAX_DATA]; struct yuv_playback_info *yi =3D &itv->yuv_info; =20 @@ -1444,9 +1444,9 @@ static int ivtv_g_fbuf(struct file *file, void *fh, s= truct v4l2_framebuffer *fb) =20 static int ivtv_s_fbuf(struct file *file, void *fh, const struct v4l2_fram= ebuffer *fb) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; - struct ivtv_stream *s =3D &itv->streams[fh2id(fh)->type]; + struct ivtv_stream *s =3D &itv->streams[file2id(file)->type]; struct yuv_playback_info *yi =3D &itv->yuv_info; =20 if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) @@ -1465,9 +1465,9 @@ static int ivtv_s_fbuf(struct file *file, void *fh, c= onst struct v4l2_framebuffe =20 static int ivtv_overlay(struct file *file, void *fh, unsigned int on) { - struct ivtv_open_id *id =3D fh2id(fh); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; - struct ivtv_stream *s =3D &itv->streams[fh2id(fh)->type]; + struct ivtv_stream *s =3D &itv->streams[file2id(file)->type]; =20 if (!(s->vdev.device_caps & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) return -ENOTTY; @@ -1492,7 +1492,7 @@ static int ivtv_subscribe_event(struct v4l2_fh *fh, c= onst struct v4l2_event_subs =20 static int ivtv_log_status(struct file *file, void *fh) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; u32 data[CX2341X_MBOX_MAX_DATA]; =20 int has_output =3D itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT; @@ -1584,7 +1584,7 @@ static int ivtv_log_status(struct file *file, void *f= h) =20 static int ivtv_decoder_cmd(struct file *file, void *fh, struct v4l2_decod= er_cmd *dec) { - struct ivtv_open_id *id =3D fh2id(file_to_v4l2_fh(file)); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; =20 IVTV_DEBUG_IOCTL("VIDIOC_DECODER_CMD %d\n", dec->cmd); @@ -1593,7 +1593,7 @@ static int ivtv_decoder_cmd(struct file *file, void *= fh, struct v4l2_decoder_cmd =20 static int ivtv_try_decoder_cmd(struct file *file, void *fh, struct v4l2_d= ecoder_cmd *dec) { - struct ivtv_open_id *id =3D fh2id(file_to_v4l2_fh(file)); + struct ivtv_open_id *id =3D file2id(file); struct ivtv *itv =3D id->itv; =20 IVTV_DEBUG_IOCTL("VIDIOC_TRY_DECODER_CMD %d\n", dec->cmd); @@ -1602,7 +1602,7 @@ static int ivtv_try_decoder_cmd(struct file *file, vo= id *fh, struct v4l2_decoder =20 static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *= arg) { - struct ivtv_open_id *id =3D fh2id(file_to_v4l2_fh(filp)); + struct ivtv_open_id *id =3D file2id(filp); struct ivtv *itv =3D id->itv; struct ivtv_stream *s =3D &itv->streams[id->type]; =20 @@ -1645,7 +1645,7 @@ static int ivtv_decoder_ioctls(struct file *filp, uns= igned int cmd, void *arg) static long ivtv_default(struct file *file, void *fh, bool valid_prio, unsigned int cmd, void *arg) { - struct ivtv *itv =3D fh2id(fh)->itv; + struct ivtv *itv =3D file2id(file)->itv; =20 if (!valid_prio) { switch (cmd) { --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 53C8C26657D; Sat, 2 Aug 2025 09:33:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127212; cv=none; b=nH7FceDneMfGjpSPK0XTD7Nnp8yRPRNU2htS6xoS5HPK2+Qn+/3KyKl9zuTEVWVdp+MxWel+BjTrDeDmlatu7QnLOjlKLKHwfx+la+B8XdlwJwDoxK201NSF9WSxwuJrRnn+QdcNWlHmA2Kdg63wwceZ5LTbhmk7TlB24jpw424= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127212; c=relaxed/simple; bh=K/dzfOS0dkV05E8cvQoG7rwz6dZ9ZnnXvqtKDs2t7xo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nCZFI7SN6kfPWU0eCseELTtAZq/k46hETLqcTd41jwozeNAECqiqesmBkuSXIMf7T6LsX0QopQ/jWrSP7afowzztqdQBpLXhfA7kOkvEftfNz7++FFGvLQgzN+NmQP5S5odB/GRT0mIbCL60mPCOvZdYQXZE7h/nR/45+/0z39w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=WzvZ2DuT; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="WzvZ2DuT" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 65B522F8B; Sat, 2 Aug 2025 11:32:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127164; bh=K/dzfOS0dkV05E8cvQoG7rwz6dZ9ZnnXvqtKDs2t7xo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=WzvZ2DuTeTr9GaZYJYqUZ0wzA/oeg6yvYX0wZsUJFGdjrfZamwqsW67ol38XV9gwp kdyl8dDrLlE/F0D5V9Xqi/vjReFJX7jg/lwbTcK7TvBh541QqyFa7LeywALRlK5zzV hXdFNW5LxfxIjbogRPihvL8rs0OoosH5yzwzMaD0= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:20 +0200 Subject: [PATCH 58/65] media: zoran: Remove access to __fh Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-58-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1617; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=K/dzfOS0dkV05E8cvQoG7rwz6dZ9ZnnXvqtKDs2t7xo=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj+SsmP6BGofKCY4QKrL2701OyUXD717ITDG 7Ik2h8or36JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/gAKCRByNAaPFqFW PEGYEAC/vc5ffxbdnceLM5+KLumODTQTA1neOKuNhgMT8YpOzMtlVK+dF5JMoJu9D11t01DCqCo JkYJbGM3IjxD6odRWgYWcOW+XVJN9coQUv+6MDOKDpPZibuaZt2nrGJlvwFK2cwh8/pye7jMGwo EYlMCweT91Pwu/glbdctNofWZQH0kCBURg0VbT8s2bzOgqlD+483+LVSSl5VIYBXRRnGLXEh6qP E0rNx7KliVie3Bo7yRmkedmcWuHOuro9Ypu/3L3g3rR31ONnmHdjNK22QUJinRjV5dvHgL4bJl4 nxl9NA0ktz4tYk/PruS0Zwv05qMJtpsdgkbBD3JJ8CO7bUQbgPcqH2BbiO9lKUDzqVKVIjLh0Hi vgL7W9cg2DZ7x1p6ou9TOx5FS9UOxR5rHnYBLPRwbDo1skp/TvQK+dTgNxyN7+5eqz8Hcq4Ks09 NOSTRHu44Vn7RPSdf4RUbC0OqccCCL/UUnAvRYtKl/yrnOGuV/jCUq+R6wt/5nBSwWqDCV1mBr4 h5/1HqY2L6B0ZD6KOnflHG8B9JOJGt+luOyaRDGG3IGyQ4wqHChbDw/qd2YgwrjNwVJc+SAg05p 7HUKO0Tdh3VYf0edLQc7zgVxc1VzQcptntmErcuywAlnyBp0N3Tv0ND51Gg+L8W3gwhQ4RecDfW JboSxoPNrKexePw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B 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/zora= n.h index 1cd990468d3de9db8b14b72483972041c57bfee2..d05e222b392156bf1b3b4c83c65= 91db642c3c377 100644 --- a/drivers/media/pci/zoran/zoran.h +++ b/drivers/media/pci/zoran/zoran.h @@ -154,12 +154,6 @@ struct zoran_jpg_settings { =20 struct zoran; =20 -/* 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/zor= an/zoran_driver.c index f42f596d3e6295e31e3b33cd83c5f7243911bd30..ec7fc1da4cc02f5a344cb49bb9a= 783c41c758195 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, voi= d *__fh, struct v4l2_format *fmt) { struct zoran *zr =3D video_drvdata(file); - struct zoran_fh *fh =3D __fh; int i; int res =3D 0; =20 if (fmt->fmt.pix.pixelformat =3D=3D V4L2_PIX_FMT_MJPEG) - return zoran_s_fmt_vid_out(file, fh, fmt); + return zoran_s_fmt_vid_out(file, __fh, fmt); =20 for (i =3D 0; i < NUM_FORMATS; i++) if (fmt->fmt.pix.pixelformat =3D=3D zoran_formats[i].fourcc) --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 F3900265603; Sat, 2 Aug 2025 09:33:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127221; cv=none; b=E0EZsuL3CRXTEa99DtA4usKDQ7iSLzmrr6oMmgbaiyFShe6bqgxeIjhjp7TqW4FWY4ooeP1gI1zmUYh76agUBMXBRU3FBbZvMvW0vNgI47//4ojiIJwUp5LbsnYM3CD9fFLzIQstwN0W3BG9jTpxDSYDxfv5b1SQxbhqRI5+jJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127221; c=relaxed/simple; bh=iuKNDwtt8kKRQfGxKCSjEUYPIwMYunyGqFuuiLv3K0Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=o7EzNCKCaNbcvk+MDAscEA5EWjjmY4scDQ8763u5u90MH97+5Nyx0HxPDb1SAIEPJSctHjKQOzCyLwYduhQdkWSmltT0HZXVssZiKF5dUjQ0foCif7af7UTR5Gc56Kr0hkTV+fwDwAefuoFSeN1yNCkmAb99/DglH1CmkAhV6fc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=etIRH98N; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="etIRH98N" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A4D2132D9; Sat, 2 Aug 2025 11:32:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127173; bh=iuKNDwtt8kKRQfGxKCSjEUYPIwMYunyGqFuuiLv3K0Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=etIRH98NKbNN5H2qEksc93SH3XM0T+iHwBiOZ2zIIi9Jz5Nfq8I5gq/qqfZoLaGIf jwI5tLaeBjeNOiJimErQ6oMw555d/gVWivBRSyNQPaGhthmghohdU9eW2fyrzXMbKN YNAvg3Xt+DbgyFDC+JIZ+7yhFf9U81sDlxpvzS2A= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:21 +0200 Subject: [PATCH 59/65] media: usb: hdpvr: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-59-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3953; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=iuKNDwtt8kKRQfGxKCSjEUYPIwMYunyGqFuuiLv3K0Q=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj+3oIZOpPyRnUEOapjuFEBEhE8i4b15dP3j TFU3u0Zq82JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/gAKCRByNAaPFqFW PEWzD/wO0yY2ImRGI/xM/rt7O/iVxa6dL1bda4RnoBRoPjDFzI2D/JgAWB88ItgnHwmmeUYyrHD aj6Oer2TYNjkhdmVyApjHfcDzEVdnHmj0MCYdbR5oYRULICvDiv+kZJ0aPYK9Vr/rWjwbEbyxu8 TZoBzFl9CY4bK7bDY6qWTtl1Pv1l9xYj466g0Dez2B/ww/Ei1tJVucCoAdclB61xY0Njd5X0RVN D/y29IhK9YmbbIeAYOaN3iOnc67GIwI7A2gJfXZNbXwNrmfs3hTN0onFjIqGYA9CH98qnp8ZFOz dgNwNbCS2sscvB/QF+zhd1S+x7O6/818r7a9o1Vu31PLtAllughH3gzfaKL4oIfUJeSXe7uZQKZ y1V77hajADut4bY3tNpd4jdT66FUKAnZNVaKkBiiL8iRNSDwrGmsWcArE+SETAqLKrmJz9HkT73 JvjpNxuC5xbZ+4J/yBgaSlrh1Sd2i+cLtXzNftndJsiE8bsLMw09qnRtgyZtMjiGd7XN2BhbnBR RO3qRrFXEwntpdTPzHbs8a+S1xXGCeVbVKgWfkzcuel9H4TGqByb+6zSzkEpxmo38Agt5D/yYIQ dELD/16003/RrZ2xtraKeJ72lH62ckXJVyXXwjoQrysiGVxDAhvB+SQ2okXgKbbhWAudP7U5PYh qsmZdurZGwpzh6g== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- drivers/media/usb/hdpvr/hdpvr-video.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpv= r/hdpvr-video.c index 6c6e467f85549e86598e73d29352a84de7df2f4d..8a5c2c5227ebe6f64bf44fff50d= d4918f4f5394e 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -52,6 +52,11 @@ struct hdpvr_fh { bool legacy_mode; }; =20 +static inline struct hdpvr_fh *file_to_hdpvr_fh(struct file *file) +{ + return container_of(file_to_v4l2_fh(file), struct hdpvr_fh, fh); +} + static uint list_size(struct list_head *list) { struct list_head *tmp; @@ -589,7 +594,7 @@ static int vidioc_s_std(struct file *file, void *_fh, v4l2_std_id std) { struct hdpvr_device *dev =3D video_drvdata(file); - struct hdpvr_fh *fh =3D _fh; + struct hdpvr_fh *fh =3D file_to_hdpvr_fh(file); u8 std_type =3D 1; =20 if (!fh->legacy_mode && dev->options.video_input =3D=3D HDPVR_COMPONENT) @@ -609,7 +614,8 @@ static int vidioc_g_std(struct file *file, void *_fh, v4l2_std_id *std) { struct hdpvr_device *dev =3D video_drvdata(file); - struct hdpvr_fh *fh =3D _fh; + struct hdpvr_fh *fh =3D file_to_hdpvr_fh(file); + =20 if (!fh->legacy_mode && dev->options.video_input =3D=3D HDPVR_COMPONENT) return -ENODATA; @@ -620,8 +626,8 @@ static int vidioc_g_std(struct file *file, void *_fh, static int vidioc_querystd(struct file *file, void *_fh, v4l2_std_id *a) { struct hdpvr_device *dev =3D video_drvdata(file); + struct hdpvr_fh *fh =3D file_to_hdpvr_fh(file); struct hdpvr_video_info vid_info; - struct hdpvr_fh *fh =3D _fh; int ret; =20 *a =3D V4L2_STD_UNKNOWN; @@ -640,7 +646,7 @@ static int vidioc_s_dv_timings(struct file *file, void = *_fh, struct v4l2_dv_timings *timings) { struct hdpvr_device *dev =3D video_drvdata(file); - struct hdpvr_fh *fh =3D _fh; + struct hdpvr_fh *fh =3D file_to_hdpvr_fh(file); int i; =20 fh->legacy_mode =3D false; @@ -663,7 +669,7 @@ static int vidioc_g_dv_timings(struct file *file, void = *_fh, struct v4l2_dv_timings *timings) { struct hdpvr_device *dev =3D video_drvdata(file); - struct hdpvr_fh *fh =3D _fh; + struct hdpvr_fh *fh =3D file_to_hdpvr_fh(file); =20 fh->legacy_mode =3D false; if (dev->options.video_input) @@ -676,7 +682,7 @@ static int vidioc_query_dv_timings(struct file *file, v= oid *_fh, struct v4l2_dv_timings *timings) { struct hdpvr_device *dev =3D video_drvdata(file); - struct hdpvr_fh *fh =3D _fh; + struct hdpvr_fh *fh =3D file_to_hdpvr_fh(file); struct hdpvr_video_info vid_info; bool interlaced; int ret =3D 0; @@ -718,7 +724,7 @@ static int vidioc_enum_dv_timings(struct file *file, vo= id *_fh, struct v4l2_enum_dv_timings *timings) { struct hdpvr_device *dev =3D video_drvdata(file); - struct hdpvr_fh *fh =3D _fh; + struct hdpvr_fh *fh =3D file_to_hdpvr_fh(file); =20 fh->legacy_mode =3D false; memset(timings->reserved, 0, sizeof(timings->reserved)); @@ -734,7 +740,7 @@ static int vidioc_dv_timings_cap(struct file *file, voi= d *_fh, struct v4l2_dv_timings_cap *cap) { struct hdpvr_device *dev =3D video_drvdata(file); - struct hdpvr_fh *fh =3D _fh; + struct hdpvr_fh *fh =3D file_to_hdpvr_fh(file); =20 fh->legacy_mode =3D false; if (dev->options.video_input) @@ -994,7 +1000,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, voi= d *_fh, struct v4l2_format *f) { struct hdpvr_device *dev =3D video_drvdata(file); - struct hdpvr_fh *fh =3D _fh; + struct hdpvr_fh *fh =3D file_to_hdpvr_fh(file); int ret; =20 /* --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 51AB4269D06; Sat, 2 Aug 2025 09:33:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127230; cv=none; b=aMzoEETlSnXWPGNQCkpE6rA7Y3ea0w2g83ShL1I9XNJqgMSPLfSyEsYP89b8rLDc5gsue3xd+w+YEY2K0YxAIfU4H0RjLFpUn2WrqLau4Zwg5a5EJAglG/vd7K9pUOHkeJ0ArMDUUt6MigKtej5KGTU5syloO+FdR48GjloZvho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127230; c=relaxed/simple; bh=plUDcgbQkGw4JyRbthC79SLTx+gbob3U9axm5vZyPtk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M6mOrCdyvu3Meyc/mivnNVKSd+u+OumwlodhDjLpot7CzuNn50TQHxAup1Rb3b8wtomjGuvSKv9LnA63m9kBiSUyM6qL+L8gLClv6uAhGAeS+2mqq/Kx6X+WpyVz5sT+spOrQWdsiJUKzJEnp3TaBTg+qreJcJCBb0hIyRA6u8Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=SkX6QI0f; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="SkX6QI0f" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6F1A939D0; Sat, 2 Aug 2025 11:32:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127181; bh=plUDcgbQkGw4JyRbthC79SLTx+gbob3U9axm5vZyPtk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=SkX6QI0fVpdZyZWipUKoRAh6k0e+KWR2tAAJnBI4jQ23/Jqyuwg3nvBEqmr2hdkvu f3kK5CxdreRfQcAG/s/J8ryTY8EWe3hohBJEYgb614t2SVt/j3dRn/xosIhuT7TpD9 IIMKMGph9jDhippZQMTJbMZkOzAa9CJnWTL5yD2w= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:22 +0200 Subject: [PATCH 60/65] media: usb: uvc: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-60-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7314; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=plUDcgbQkGw4JyRbthC79SLTx+gbob3U9axm5vZyPtk=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj+Gv25IxJxmaQk2kge3awblRwS1LI4XdRw4 Rr8AM7v8PyJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/gAKCRByNAaPFqFW PKg0D/40XOP1ymiqV3UZQ3VXGNXxWoOIIzNeadTf1tfqQ0EWWeJ1hUxsU5M5ACuvX6TBofNvS50 kh+QpYAgXd6q4dudHmxvocEcg8NOyRQ5uW2Cyrs/GqSqaN7SMh6q76tjdsA8tbXXh0o3oyDe36B qjtT/cC2i5fIerKN3xco2Cpff20JshnqvaKgBVIcK8Ze+iVAqqAiO2cWAFUOts/lJk+5kN9yRDN qfGrm8F90EMGjayFJq6JiDsE+d3pCUIY9ZQb+zaqdNUGPGc1FzzQbYmd744+C9o8qo3OBLOgGT+ EFCV4vdHx7xoSCsRkBSiPnKCx/ztAthTj1AsUTGJyzsAGNRiTAJRIItVGRO8dXkgSv2+ZryniHl 9Bf1/2lj18fmhHdihFTmpREVk0r5kVu3+GmZMdRqaZN8iG4yB6UzGURtlj6ejN+rF6yOolxUf+N k/p3Lk+q7ULyckIqziFqIJ4v0pihZUwPacSTI2LXjwAoqSK1EQngHats7fi1V1PVOVMHNqeHr+e +trroR5QY+A8Oa/hYZbYaDpK1CvEhT1pzcwWvkToNgcrwafRJc5WCAU2lDs9CF4KnQCrpvcLqMy SXVP98AjcOz2xZDPMONZFIfxUuwv4TEh+ccR0/QCEUpUVsLzM28z9M5iF1oaU3d6+ktbS7+13FQ O+Ls+rwA+ykB7OA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- drivers/media/usb/uvc/uvc_v4l2.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v= 4l2.c index 09677ed639ae9252a57ce09cdbcfd567ad7aabc2..10196d62f287502b0dd472ac68e= c6914ca4eb06b 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -391,7 +391,7 @@ static int uvc_v4l2_try_format(struct uvc_streaming *st= ream, static int uvc_ioctl_g_fmt(struct file *file, void *fh, struct v4l2_format *fmt) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_streaming *stream =3D handle->stream; const struct uvc_format *format; const struct uvc_frame *frame; @@ -427,7 +427,7 @@ static int uvc_ioctl_g_fmt(struct file *file, void *fh, static int uvc_ioctl_s_fmt(struct file *file, void *fh, struct v4l2_format *fmt) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_streaming *stream =3D handle->stream; struct uvc_streaming_control probe; const struct uvc_format *format; @@ -460,7 +460,7 @@ static int uvc_ioctl_g_parm(struct file *file, void *fh, struct v4l2_streamparm *parm) { u32 numerator, denominator; - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_streaming *stream =3D handle->stream; =20 if (parm->type !=3D stream->type) @@ -496,7 +496,7 @@ static int uvc_ioctl_g_parm(struct file *file, void *fh, static int uvc_ioctl_s_parm(struct file *file, void *fh, struct v4l2_streamparm *parm) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_streaming *stream =3D handle->stream; struct uvc_streaming_control probe; struct v4l2_fract timeperframe; @@ -641,7 +641,7 @@ static int uvc_ioctl_querycap(struct file *file, void *= fh, static int uvc_ioctl_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *fmt) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_streaming *stream =3D handle->stream; enum v4l2_buf_type type =3D fmt->type; const struct uvc_format *format; @@ -665,7 +665,7 @@ static int uvc_ioctl_enum_fmt(struct file *file, void *= fh, static int uvc_ioctl_try_fmt(struct file *file, void *fh, struct v4l2_format *fmt) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_streaming *stream =3D handle->stream; struct uvc_streaming_control probe; =20 @@ -675,7 +675,7 @@ static int uvc_ioctl_try_fmt(struct file *file, void *f= h, static int uvc_ioctl_enum_input(struct file *file, void *fh, struct v4l2_input *input) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_video_chain *chain =3D handle->chain; const struct uvc_entity *selector =3D chain->selector; struct uvc_entity *iterm =3D NULL; @@ -717,7 +717,7 @@ static int uvc_ioctl_enum_input(struct file *file, void= *fh, =20 static int uvc_ioctl_g_input(struct file *file, void *fh, unsigned int *in= put) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_video_chain *chain =3D handle->chain; u8 *buf; int ret; @@ -745,7 +745,7 @@ static int uvc_ioctl_g_input(struct file *file, void *f= h, unsigned int *input) =20 static int uvc_ioctl_s_input(struct file *file, void *fh, unsigned int inp= ut) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_streaming *stream =3D handle->stream; struct uvc_video_chain *chain =3D handle->chain; u8 *buf; @@ -780,7 +780,7 @@ static int uvc_ioctl_s_input(struct file *file, void *f= h, unsigned int input) static int uvc_ioctl_query_ext_ctrl(struct file *file, void *fh, struct v4l2_query_ext_ctrl *qec) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_video_chain *chain =3D handle->chain; =20 return uvc_query_v4l2_ctrl(chain, qec); @@ -808,7 +808,7 @@ static int uvc_ctrl_check_access(struct uvc_video_chain= *chain, static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *ctrls) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_video_chain *chain =3D handle->chain; struct v4l2_ext_control *ctrl =3D ctrls->controls; unsigned int i; @@ -892,7 +892,7 @@ static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *han= dle, static int uvc_ioctl_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *ctrls) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); =20 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, VIDIOC_S_EXT_CTRLS); } @@ -900,7 +900,7 @@ static int uvc_ioctl_s_ext_ctrls(struct file *file, voi= d *fh, static int uvc_ioctl_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *ctrls) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); =20 return uvc_ioctl_s_try_ext_ctrls(handle, ctrls, VIDIOC_TRY_EXT_CTRLS); } @@ -908,7 +908,7 @@ static int uvc_ioctl_try_ext_ctrls(struct file *file, v= oid *fh, static int uvc_ioctl_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qm) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_video_chain *chain =3D handle->chain; =20 return uvc_query_v4l2_menu(chain, qm); @@ -917,7 +917,7 @@ static int uvc_ioctl_querymenu(struct file *file, void = *fh, static int uvc_ioctl_g_selection(struct file *file, void *fh, struct v4l2_selection *sel) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_streaming *stream =3D handle->stream; =20 if (sel->type !=3D stream->type) @@ -951,7 +951,7 @@ static int uvc_ioctl_g_selection(struct file *file, voi= d *fh, static int uvc_ioctl_enum_framesizes(struct file *file, void *fh, struct v4l2_frmsizeenum *fsize) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_streaming *stream =3D handle->stream; const struct uvc_format *format =3D NULL; const struct uvc_frame *frame =3D NULL; @@ -991,7 +991,7 @@ static int uvc_ioctl_enum_framesizes(struct file *file,= void *fh, static int uvc_ioctl_enum_frameintervals(struct file *file, void *fh, struct v4l2_frmivalenum *fival) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_streaming *stream =3D handle->stream; const struct uvc_format *format =3D NULL; const struct uvc_frame *frame =3D NULL; @@ -1063,7 +1063,7 @@ static int uvc_ioctl_subscribe_event(struct v4l2_fh *= fh, static long uvc_ioctl_default(struct file *file, void *fh, bool valid_prio, unsigned int cmd, void *arg) { - struct uvc_fh *handle =3D fh; + struct uvc_fh *handle =3D to_uvc_fh(file); struct uvc_video_chain *chain =3D handle->chain; =20 switch (cmd) { --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 8C7E926A1C4; Sat, 2 Aug 2025 09:33:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127238; cv=none; b=r2UjRn0W3gzvAJljeJ6rYZ3Gbetg3UkQOi7KEXLv74q03KJIUhT9dkwiyhx4UqGx+sCdwvTacFY/UAnZSeat43qwi/m2RuP3vdfdDRwqNfTay0CnCE79fcvV3p/ob1AJNGRidz6OHCkoWGTq6c5+BV4d5ponkNsosrQQ8wDzAQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127238; c=relaxed/simple; bh=HJZkrhFG+jzm747g4Ehf7uDDScTqxfq9NHQKM9RJ9+c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PRhzEurKXM0N5HVGxEdJ7pmmvnlZQwflrdkgP13IF03zWd5WSN/tFypAR25/kvISjnzTP/wQTt6LnRdBLpwggqewZalpL+7EcaRhTqHqGKOOhlhqSaBQJ2NcTpf/t9syG5/h54wsMLPwgxNMquUDPQr86EnfcolqYj/utYhYMrw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=drO4QQ4w; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="drO4QQ4w" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8FDB1434B; Sat, 2 Aug 2025 11:33:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127189; bh=HJZkrhFG+jzm747g4Ehf7uDDScTqxfq9NHQKM9RJ9+c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=drO4QQ4w5C/9gxSKad/aI2GIngo7vFtEHIHzrGgn7kZAWSwLR5wrEh4HQvq6Jm6OI ZusDu7tyhzItb/PJ3UgESd1YUquS1Fmh3fVSitOAj7wJomAczSa4RbhwDqiVZJfF3B Qtx/E4NpY2guxQIm3G7R7AMgxzqza3IQPTFKsu6c= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:23 +0200 Subject: [PATCH 61/65] media: staging: imx: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-61-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2886; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=HJZkrhFG+jzm747g4Ehf7uDDScTqxfq9NHQKM9RJ9+c=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj/LYqcTTKP5IO38I6jRkZtnPsad4yNU/BBM LhZkqOCQmyJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/wAKCRByNAaPFqFW PBUoD/9IzXwsCQmzZriXZwyHxu8ZbHSG9GOn5AFJ5yuxmyL+uefno6h2zKTZMm8PDQQEMO/jVe0 WSC2PXgtp2l2beUGIlkrSqMAWd2ooWmRvUskEkWBmBzeG506UdTZjbx/418DFC8Z8zaeB0nVCdc /wGf0Gy1y1swBI602aZLOtqjRfjKcD5vu9ozAisDD4RHfMWfPbDX7hndsvy/b185ErMEK6rG3SI Ux1cGTjjJ4rFaeg9XyTreQ3dPyg7tPSoaubiZa2cunxMtK5RPQmbqJkWG2EF56aX6LYWLUshWQm 1+WDzhvT0criVSZX0gp0EGUYaemxF1Gcd13bOgQ6l5Cmlq3KeKDlns0Q17hjXxdnwz6revxZAGl FrTVFgF3IyThahVOUI6yq/UMj0LI82p9bgOwi4Mu4aUOoLzz09jWVkYPdh+Jma4I3Ker4Qw8XYW mPuw1AHdEAi8T2Ygj8ksbEaFPQkxSNfmMk1ocWww69os41oVrZ0VF6a+r8xmZe/EudJmIWtW9Rb 4S+lSn8e7w2Jt7CcII/wZZJqnFDuYyP/Ty87GGVE8d7K9g7Bx4Z4dOZNVB1u2OPb+8W/gcu4E/5 TYrxi33Ung3k9TQRPV8LyxI/8QGtcQZubSmmlE2e7kjnp6Rzuo/gnwA9C0Ba04DByNeihtvEVG2 QGndJvaTcNt3y7g== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B The v4l2_fh associated with an open file handle is now guaranteed to be available in file->private_data, initialised by v4l2_fh_add(). Access the v4l2_fh, and from there the driver-specific structure, from the file * in all ioctl handlers. Signed-off-by: Jacopo Mondi --- drivers/staging/media/imx/imx-media-csc-scaler.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-csc-scaler.c b/drivers/sta= ging/media/imx/imx-media-csc-scaler.c index c4ee0eebb3730e709c3d4a95935d0047a645e411..1869c5792ecb46682491ecbf336= 74c6044915261 100644 --- a/drivers/staging/media/imx/imx-media-csc-scaler.c +++ b/drivers/staging/media/imx/imx-media-csc-scaler.c @@ -23,8 +23,6 @@ =20 #include "imx-media.h" =20 -#define fh_to_ctx(__fh) container_of(__fh, struct ipu_csc_scaler_ctx, fh) - #define IMX_CSC_SCALER_NAME "imx-csc-scaler" =20 enum { @@ -184,7 +182,7 @@ static int ipu_csc_scaler_enum_fmt(struct file *file, v= oid *fh, static int ipu_csc_scaler_g_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct ipu_csc_scaler_ctx *ctx =3D fh_to_ctx(priv); + struct ipu_csc_scaler_ctx *ctx =3D file_to_ctx(file); struct ipu_csc_scaler_q_data *q_data; =20 q_data =3D get_q_data(ctx, f->type); @@ -197,7 +195,7 @@ static int ipu_csc_scaler_g_fmt(struct file *file, void= *priv, static int ipu_csc_scaler_try_fmt(struct file *file, void *priv, struct v4l2_format *f) { - struct ipu_csc_scaler_ctx *ctx =3D fh_to_ctx(priv); + struct ipu_csc_scaler_ctx *ctx =3D file_to_ctx(file); struct ipu_csc_scaler_q_data *q_data =3D get_q_data(ctx, f->type); struct ipu_image test_in, test_out; enum v4l2_field field; @@ -245,8 +243,8 @@ static int ipu_csc_scaler_try_fmt(struct file *file, vo= id *priv, static int ipu_csc_scaler_s_fmt(struct file *file, void *priv, struct v4l2_format *f) { + struct ipu_csc_scaler_ctx *ctx =3D file_to_ctx(file); struct ipu_csc_scaler_q_data *q_data; - struct ipu_csc_scaler_ctx *ctx =3D fh_to_ctx(priv); struct vb2_queue *vq; int ret; =20 @@ -301,7 +299,7 @@ static int ipu_csc_scaler_s_fmt(struct file *file, void= *priv, static int ipu_csc_scaler_g_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct ipu_csc_scaler_ctx *ctx =3D fh_to_ctx(priv); + struct ipu_csc_scaler_ctx *ctx =3D file_to_ctx(file); struct ipu_csc_scaler_q_data *q_data; =20 switch (s->target) { @@ -339,7 +337,7 @@ static int ipu_csc_scaler_g_selection(struct file *file= , void *priv, static int ipu_csc_scaler_s_selection(struct file *file, void *priv, struct v4l2_selection *s) { - struct ipu_csc_scaler_ctx *ctx =3D fh_to_ctx(priv); + struct ipu_csc_scaler_ctx *ctx =3D file_to_ctx(file); struct ipu_csc_scaler_q_data *q_data; =20 switch (s->target) { --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 8042026A1CF; Sat, 2 Aug 2025 09:34:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127246; cv=none; b=rDNfT6rJKkGup3civp3Y5TaAU1yFhdYV9cYxnHc64E/wL3Y9Yokfh1HJyEJ4CbXGfwCWV3tmjrS6tUhhPBe9ukq3Wts7nVjDUikD3hMa0/7rj4VRQGWHpcW4V7V1hht29XC9c3EBSFqZb2D4/ypQ+EaklF5A7o8H3PyUIky/WTE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127246; c=relaxed/simple; bh=XdOe0hUHoRepWDL9PXLLZRQsffL0J6Xd5RC8oZQXv/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DN7DYNpm9HMXVRGRo2PGr8ujzWH6NS4Yn6IOyeAOkpfy+SWjNCBRlWaG5MBBmdZHG8gbjvxqeKcBkv9ZeORTO2rVtAmNpjUQqFeRqfte4ttIQX5oIof1b6dPkmVVbRbw7FDt3h+2WPJ1iXy0bK+rvK7hxwBa+RlbArrIaQdeofs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=SGcK94cr; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="SGcK94cr" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F10D443E9; Sat, 2 Aug 2025 11:33:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127197; bh=XdOe0hUHoRepWDL9PXLLZRQsffL0J6Xd5RC8oZQXv/4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=SGcK94cr5R4K6fWMgc6ZO+cWOzWTlglfalvYGrPcJNwLCt+GKIXEGJuoXTrsoaIIU zgvR//X2BjB32zxJtwfdqC+Rvv2+rJfEfAm6OoS1STQ4+in0GNP1szooJYEFRKRCoW R9V8vHcB+jSKYpUdsUKtAFJ49PFsKYRa+N/VMN2E= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:24 +0200 Subject: [PATCH 62/65] media: v4l2-ctrls: Move v4l2_fh retrieval after V4L2_FL_USES_V4L2_FH check Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-62-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1544; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=loLIKoL1ckx0+Do+cmV4JLVH2b3g2wpBnTvZTq5U/K0=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj/dlk/dxL7K7IYPuPuktjeyd8m0BEMDDL5V dGk/8P0KaWJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/wAKCRByNAaPFqFW PKJ6D/9X8HRdjahHSdhz5uUldd/PeaMg0s7lr8HBc8sXBSyTJTJ7X4vpyBjbQuWFRN5tHSqT0Zd IiN0LjHlvvNaO8nDUeGNJQX9/nYx2/BgMrR0lD11hujdp8j5D6T3yqpF8tVG4HOmf0vykUOmfav LtkqeLwZ92Ycxyw3L9Dpz2nd4dGGX2KI8kdTXCt+xTaCijUASZiqye1MVhU3jjOOCtYa5j60eTQ 7YcG4u10tCUyh38H4ysnFlwPZXiLfTEZhcH7hQmk84aH8LP6xcAJE69xsfZrWSd9aga/QBuS6+W vOi4UdCMMINpPW+UcDTt/wJgbV0g1Z9qzjw505d4SjNX7/XgZaiGrWl3SGJsEUOCtzutvNrxxNo 2ApceQE3LYD0OAu3OCjt0DOOYwTVdTkgKlhp7Gc21zkQWw5kPtjFPtgYnpvNSS9tPNBdbXaxvYb 3fYpJcyafppTgtZYzMoBk4INFxmUoyZOS2437cq3AJT2YKHI9FgC9tKdJUn3uywMdFrxIlTMZk/ EBjnEHhw2O6oyu5OfTnK7uiAChKQ5mB7uV1a2YGTnB2AFlJxyxiMV/oVStMF2npE2Uz5WBPpgsq +a7F7oJity3uP3TrCCAarrvHnB1icd0y+dAbmSz+kK7ENi7ckr86IJQ6or2369uTso9ahDAq6YD WL+Za2l7ALyDORA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart The v4l2_ctrl_log_status() function retrieves the v4l2_fh from the file with file_to_v4l2_fh() before checking the V4L2_FL_USES_V4L2_FH to see if the device makes use of v4l2_fh. While this doesn't cause any practical issue given the current implementation of file_to_v4l2_fh(), it is cleaner to retrieve the v4l2_fh after checking the flag. This could prevent future issues if the implementation of file_to_v4l2_fh() changes. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/v4l2-core/v4l2-ctrls-api.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ctrls-api.c b/drivers/media/v4l2-= core/v4l2-ctrls-api.c index d46b2c8f3d23596293210125b148c3da99c52cac..b0bba8eec143968b127368ee7de= 8bca76b427dbd 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-api.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-api.c @@ -1253,11 +1253,14 @@ EXPORT_SYMBOL(v4l2_querymenu); int v4l2_ctrl_log_status(struct file *file, void *fh) { struct video_device *vfd =3D video_devdata(file); - struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); =20 - if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) && vfd->v4l2_dev) + if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) && vfd->v4l2_dev) { + struct v4l2_fh *vfh =3D file_to_v4l2_fh(file); + v4l2_ctrl_handler_log_status(vfh->ctrl_handler, vfd->v4l2_dev->name); + } + return 0; } EXPORT_SYMBOL(v4l2_ctrl_log_status); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 57B6E23817F; Sat, 2 Aug 2025 09:34:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127253; cv=none; b=DX70ptA2I+XtpT3QJo+pEqj4ACDkGkSbrmBBbrdeKYTmr3fyPzAOx9F/35iKZfm8NjJU0Oj4/VP/1w7LtVJuzzCA1aja5qb1adYyLXSzSech5WpHKJ/shdmA/oUDFJXP++eZ8kfB9w5bYEqz+blyiekrJavNJpMZjDPOKJ89sz4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127253; c=relaxed/simple; bh=ugZh/KFY5LMHBtI9abTRXe3/VfduYxDNcYofd35iW9A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bDY/Jrrsq7HBfTJXUWOeFmxG689J84TQDgzQrwbk90xgj0Wv500qCf7Q5diyr/O2kkaAVefz6cjNFgpRzUCRIK3JsbqK+X/A+o4puwXvynzcyoUSJFmRzM38O2ovPxT/rPK+kvy3SkalWzTqyk7bJQYkFZJ3pftiBTuyUPD+llc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=EczlcoJF; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="EczlcoJF" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 01DB643F7; Sat, 2 Aug 2025 11:33:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127205; bh=ugZh/KFY5LMHBtI9abTRXe3/VfduYxDNcYofd35iW9A=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EczlcoJFbDCzor1UJYwkUixhGK8xZeYVEQgf2zjsTBoG5f3rAGBr7ZW1udpXzsSw+ PaCYNja9CGEUBK6a+A2RNVXvzoKvVL32iD4f04zH888Qbzd4RYSYDndijzhdNMtOLt NZnCMhc90PQkjsXpC98MWxGN6mqpLpHHRq5RnIBc= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:25 +0200 Subject: [PATCH 63/65] media: ipu6: isys: Don't set V4L2_FL_USES_V4L2_FH manually Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-63-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1027; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=JegptJK/Wh+Y3waXfEoaG6eqZD0SkxAIytfm8Tqanf8=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj/rV2onUyAj1Ve0S8AEhrBpSnCKsJ7/mmH6 Rix8TpQ+3qJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/wAKCRByNAaPFqFW PMNMD/sFA/FTtUQGAqxj6hcVIegtJidGsIWt+OwDUeT5SttZ1yGE+mxy2mXyIdarbOQRkDlWrMz B3b0dcbhFM4O+ag1TuALQllprFLcTPBkpxlhhWFyJykxUpkFgS1xtTSAd3OtI0g6WSnJbzxDCa0 C9cO3jGU0z8et+LJRu+rRi4ArnjZjaupgMEge5SBvFM89JAWolUppy8FnADTJtXrxOtgkO85LGj Hz0R4ns95HNI772/U/Q8VLX9xYHRe/uCOmhT54PffiApIqBNBR9o2GDX6ztDGTlvoT9hIK+PXdP eaa6kiu+1gExaMU7Aah5FJb57ikuODm3RKJ6XU7BZCul4E06C9JqYLCSCibSI+hSpiFe+HKe/Mb 3Rf8vrJXbkAmPOl1xZ9AmjJZxX9rqKaZfZJIM1cHRyD8D+GY84dqNby5rdwSvWCbp4MRCUq3Hgd GhhNicEEatld6fs7qLN4+BWYAuHCmAlTRAC6J63J+0Hq+aVAxo8M6vGGJbzJH2sFw4UWFO8WonQ JqhqQPdO/rK7VQd+3mnogYjsUfLjUF2J6M4D8sQrRcYJm1QTvq1ZAwhDmWWw0wW5fdT/AZUrem4 V6ryoP66+qtsLSW3sfdCkUEvbEq+eSSy9izUSKGe8I0631Q/ugWwMQ6GLbyuDYhoS5q8+3BajEh Q+6reTO4wHR944A== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart The V4L2_FL_USES_V4L2_FH flag is set by v4l2_fh_init(). It is not meant to be set manually by drivers. Drop it from the ipu6-isys driver. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/pci/intel/ipu6/ipu6-isys-video.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-video.c b/drivers/media= /pci/intel/ipu6/ipu6-isys-video.c index 24a2ef93474cc400f64eb1d50bc760ee66124d1b..f3f3bc0615e5dc698be5c479dfe= d8ef2eb49cbfb 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-isys-video.c +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-video.c @@ -1306,7 +1306,6 @@ int ipu6_isys_video_init(struct ipu6_isys_video *av) __ipu6_isys_vidioc_try_fmt_meta_cap(av, &format_meta); av->meta_fmt =3D format_meta.fmt.meta; =20 - set_bit(V4L2_FL_USES_V4L2_FH, &av->vdev.flags); video_set_drvdata(&av->vdev, av); =20 ret =3D video_register_device(&av->vdev, VFL_TYPE_VIDEO, -1); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 52CD721ABC9; Sat, 2 Aug 2025 09:34:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127266; cv=none; b=tpyutfegL6W38Wm/GTMgzwrhxUhfLL/YrX6cftI9BrzbI2WDtRlUK29K2KoteaazjwpMjHgng3rS4XIrcKGDw+FHqSzByqVqaAOfiWfXJ/RK8uvStvAPv5w+yOtVv4dDNOQ84eblHgVsQjIQ+aibzKGYg55KmPn6GwyjcDIcHQY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127266; c=relaxed/simple; bh=STH9snK10gtXsl0Tkj6PDu+gh4QvT10JOLkLT1jU1Tk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qEPTk/y8shOhE+TH7cGAethFniiMkQHIlKJYbNRJ2j8U8cJBTyVCguDXRF3TENSdz/1PdL65JupMJrx7cyg5DkT/Rv2I4VGZ1HCsOEI6wN22YzvMliH2y+ILRAP1m/eqm+HRK0+s6ApstPQUvGO2K2Esnu3H0TMqeWNnwpJW9cQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=GWqhxXE8; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GWqhxXE8" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 022AA467C; Sat, 2 Aug 2025 11:33:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127217; bh=STH9snK10gtXsl0Tkj6PDu+gh4QvT10JOLkLT1jU1Tk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=GWqhxXE8irHZjTwzjw01vy/67LkCfP0pfmdBF7ezLwvyg/uNIQNc+TtMFG9aSke3p NZulEiSKLMd11OqQyyXrX5YsDoHpqfjgzaGJIRoJ7eNeumumTzNYN1CzR1Eil0nkY6 WuWgQcq2WLxWmfoETRaKF36owSar3DypycTneFaU= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:26 +0200 Subject: [PATCH 64/65] media: staging: ipu7: isys: Don't set V4L2_FL_USES_V4L2_FH manually Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-64-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1003; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=p6i7vq6AGF+FzCieEq6uikbi372+gaeFOto0fi3HS6o=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj/W2cYpWyQz48RU91dp2DTutVfBmqMPGp+b WBa4MAGzGaJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/wAKCRByNAaPFqFW PMUSD/9KnL/eRvaIxpn9zFQhhB4f8NrjuBZWdfgaHkoDnaAqP1i19guBgcJE3f9tcOMNs3VJfDZ OWLWtP5TybilDpd3yyvSJo01d7v5vEUDoelSS6krxhp9p/0AJQxZOiZiXAokVzbF5Zfkdsp7TPk luOqefJFbETRJilJyM58wla5jNWMaffzAtHKLBChcvUofPfW1oYsgglGuzmEBcafZThzNqQZK3t F5Ma3lrVztWQBboT/QKUGXHnZ1d/2e0t6D3OEU8ZIE7CN/6ZGKOY7bNX6vBKkKOUaPlVh20SzvX L6P+QGDBoKq1oI8I3lx0eyIwfS5JeqysXHFE/oMB6LuRHFBqQoIwYdnZyDSmnIan9MrD7XwsSZq zrB3YBSb6Z5E2lPzqUYVE/sVJMz0QvQNwNmWm4fLdlSDl7Dwz/5cszF4QFIXWtydcVyJ4l5fOSK JKIB7XSb1c2qXe2TIQSCd8yEMmS3h8AouJat8td4arP/Pdi8mb5boQRMOgpeEe9EVCuNCfAkQO4 EX/HxyD0IWJ4n6tjJ8mzv/SAqJeqI1ZoHooJK7O9bWT5KbqDxQlhL9sUDB7JppOc3Cwct7bRRlB 2Tycx4bL9LvT1T3yAc/ni3fuaDQxyS6awmAgRZPFb1L3CUZDflx8hBAi8ITTNdMyYqaPij5mAw/ rRmA9IGOhm6GMYw== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart The V4L2_FL_USES_V4L2_FH flag is set by v4l2_fh_init(). It is not meant to be set manually by drivers. Drop it from the ipu7-isys driver. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/staging/media/ipu7/ipu7-isys-video.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/media/ipu7/ipu7-isys-video.c b/drivers/staging= /media/ipu7/ipu7-isys-video.c index 8756da3a8fb0bfaf88da199b4608c7850888e6a2..6b31c766bc5835f8b6e28ad75ef= ead918934349b 100644 --- a/drivers/staging/media/ipu7/ipu7-isys-video.c +++ b/drivers/staging/media/ipu7/ipu7-isys-video.c @@ -1082,7 +1082,6 @@ int ipu7_isys_video_init(struct ipu7_isys_video *av) __ipu_isys_vidioc_try_fmt_vid_cap(av, &format); av->pix_fmt =3D format.fmt.pix; =20 - set_bit(V4L2_FL_USES_V4L2_FH, &av->vdev.flags); video_set_drvdata(&av->vdev, av); =20 ret =3D video_register_device(&av->vdev, VFL_TYPE_VIDEO, -1); --=20 2.49.0 From nobody Sun Oct 5 14:34:09 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 B94CA26C3AE; Sat, 2 Aug 2025 09:34:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127277; cv=none; b=M1WSTLSw1zxbvpbOpi+FIRvvo6dCmAaF7EzVCSYeXmHVTXLGYqB5N15bC48w2GdXkpPbjTPtb5p/+cCw7mpsMpDYcld5KDzMwkE7npW9oLt8MRjOJm3x0xBKJM/MXESmghGXicnVKeu1u4LsQZ4avehPy02OvTszFE+QNxTZDGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754127277; c=relaxed/simple; bh=MrdfBuiJDJdoBv4b751iBqFa9M+7Xv1MvZGdO8+lnsg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rpIbutmOdbHzUxCMkxT78nnNVdPlOoLA0C/s3zVt8VppM5LPaOZdn4SFD1R1oHQ4w4eMl3eS7KT4uDT/8YqdwAom9LL69g0Qdw0eXKFZ7s8hKsoPoIzAKy+1du2LPoLaBeTakTnbbwGtEbpAxglR/cnFV1ZYUR75uY565x4fdgE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=psjuyqMB; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="psjuyqMB" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E440F472E; Sat, 2 Aug 2025 11:33:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754127227; bh=MrdfBuiJDJdoBv4b751iBqFa9M+7Xv1MvZGdO8+lnsg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=psjuyqMBRmDLNxP0IbxVTmyJevSFVbJIIUJQLgEg3gAWBSRg51n61EimOOnJLwU+k Lt1n5scq+Wt3bF9NYQCGXKu6eCTDWGz/iXZn/QawP4/LJbpxnyS1m/M2br02bHBVdy gBn1GluYkG0cc7OR4hEguBVPrXgRcBmA3zKok/bU= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:23:27 +0200 Subject: [PATCH 65/65] media: v4l2-ioctl: Stop passing fh pointer to ioctl handlers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-65-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: 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 , 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 Cc: 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, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=21492; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=VTiw2so+SRK4TLTBQ53Fo3MhY/lo6PzNuza3pazMdL0=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj/f5wCMdSH0vVY1Y7OlgvshETBYqe+XacX6 xT+775tH4SJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y/wAKCRByNAaPFqFW PHsnEACLr+gDJL9vZAkKrpe29fhBYt13xAnLsFvEFTlkxrJJ9U2KWg0U9bntFmMJrrNu27Nu31F 55mTivoaN/tzzNR4J0cra3HySA/fyoNX6ZpoPd7xyJtF6HYwXxzBaL+WQKNFBY4OSwiVjh6KD3w SLO36flHE4zXwhsp+a6X/fMWh5VmvESSEBMcGD5FnBoApzizkEZrebl/VA4xN9+e0ftuIdUoG4p PSiuusvVRSdQ/d1raXArwUL6R/Fifsv3Zqrwo1HxUFqAxDkclS3QiPHXQ4+EeH5WKvKPFd1+xyw 8zPu+k/jy3RR1awMEATVHjkRj2dqXwXpm7hF+fdFP+T9x9s9ThxcKuiI+U+uMTwG6xWNfyhxW+Y Fk72UStjWaKWm32MoHFIO2Xc/BirLt1gd8IypmfjA0uFZyWwOcXVKA7B4IlRE6uYBb++mKQ2/Fq +52K2oPkJDKD8Dd7/gYUdpu6nCa3IvFpyiBaXmStyZMnybeS5xOrZAIC0iI/XiGhs5EpDB97hU8 jPGz+SCjbgF0KXFLvnFTd4EtUGUvVk7snJ0oPgeNyWQJEnCkCGIXD0BHSuvQzxnVoHyLb809SRU tBWAZUqcUtJEtcg8TziQVZ+H11IDieNETbiTTNnAwlwPHWe+Hc6DrwoKe3D8NYZEKqdf99tKBvM wbvDLMjOt1CyO2A== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B From: Laurent Pinchart Now that all drivers access the v4l2_fh from the file structure, there is no need to pass it as an explicit argument to ioctl handlers. Set the argument to NULL in the w__video_do_ioctl(), and drop the name of the void *fh argument in the ioctl handler declarations to indicate it is not used. The argument could be removed altogether with a mechanical change (probably using coccinelle), but there are plans to pass a new argument to the ioctl handlers in the near future. The tree-wide change to remove the argument, only to add another one soon after, would be too much churn. Signed-off-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- drivers/media/v4l2-core/v4l2-ioctl.c | 5 +- include/media/v4l2-ioctl.h | 236 +++++++++++++++++--------------= ---- 2 files changed, 120 insertions(+), 121 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core= /v4l2-ioctl.c index 44c2f5ef3dae407d9786c5278d13efc982be2ff0..248a0b5b56ec7a09f2d4c61114f= 81aa5a9b8b041 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -3078,7 +3078,6 @@ static long __video_do_ioctl(struct file *file, bool write_only =3D false; struct v4l2_ioctl_info default_info; const struct v4l2_ioctl_info *info; - void *fh =3D file_to_v4l2_fh(file); struct v4l2_fh *vfh =3D NULL; int dev_debug =3D vfd->dev_debug; long ret =3D -ENOTTY; @@ -3140,11 +3139,11 @@ static long __video_do_ioctl(struct file *file, =20 write_only =3D _IOC_DIR(cmd) =3D=3D _IOC_WRITE; if (info !=3D &default_info) { - ret =3D info->func(ops, file, fh, arg); + ret =3D info->func(ops, file, NULL, arg); } else if (!ops->vidioc_default) { ret =3D -ENOTTY; } else { - ret =3D ops->vidioc_default(file, fh, + ret =3D ops->vidioc_default(file, NULL, vfh ? v4l2_prio_check(vfd->prio, vfh->prio) >=3D 0 : 0, cmd, arg); } diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 82695c3a300a73219f262fb556ed61a8f09d273e..223e2c7a3516fc96fb486ab6422= 6163e52f775a6 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -293,144 +293,144 @@ struct v4l2_ioctl_ops { /* ioctl callbacks */ =20 /* VIDIOC_QUERYCAP handler */ - int (*vidioc_querycap)(struct file *file, void *fh, + int (*vidioc_querycap)(struct file *file, void *, struct v4l2_capability *cap); =20 /* VIDIOC_ENUM_FMT handlers */ - int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *fh, + int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *, struct v4l2_fmtdesc *f); - int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *fh, + int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *, struct v4l2_fmtdesc *f); - int (*vidioc_enum_fmt_vid_out)(struct file *file, void *fh, + int (*vidioc_enum_fmt_vid_out)(struct file *file, void *, struct v4l2_fmtdesc *f); - int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh, + int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *, struct v4l2_fmtdesc *f); - int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh, + int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *, struct v4l2_fmtdesc *f); - int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *fh, + int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *, struct v4l2_fmtdesc *f); - int (*vidioc_enum_fmt_meta_out)(struct file *file, void *fh, + int (*vidioc_enum_fmt_meta_out)(struct file *file, void *, struct v4l2_fmtdesc *f); =20 /* VIDIOC_G_FMT handlers */ - int (*vidioc_g_fmt_vid_cap)(struct file *file, void *fh, + int (*vidioc_g_fmt_vid_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh, + int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_vid_out)(struct file *file, void *fh, + int (*vidioc_g_fmt_vid_out)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh, + int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *fh, + int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_vbi_out)(struct file *file, void *fh, + int (*vidioc_g_fmt_vbi_out)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh, + int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh, + int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh, + int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh, + int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *fh, + int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_sdr_out)(struct file *file, void *fh, + int (*vidioc_g_fmt_sdr_out)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_meta_cap)(struct file *file, void *fh, + int (*vidioc_g_fmt_meta_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_g_fmt_meta_out)(struct file *file, void *fh, + int (*vidioc_g_fmt_meta_out)(struct file *file, void *, struct v4l2_format *f); =20 /* VIDIOC_S_FMT handlers */ - int (*vidioc_s_fmt_vid_cap)(struct file *file, void *fh, + int (*vidioc_s_fmt_vid_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh, + int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_vid_out)(struct file *file, void *fh, + int (*vidioc_s_fmt_vid_out)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh, + int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *fh, + int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_vbi_out)(struct file *file, void *fh, + int (*vidioc_s_fmt_vbi_out)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh, + int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh, + int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh, + int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh, + int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *fh, + int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_sdr_out)(struct file *file, void *fh, + int (*vidioc_s_fmt_sdr_out)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_meta_cap)(struct file *file, void *fh, + int (*vidioc_s_fmt_meta_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_s_fmt_meta_out)(struct file *file, void *fh, + int (*vidioc_s_fmt_meta_out)(struct file *file, void *, struct v4l2_format *f); =20 /* VIDIOC_TRY_FMT handlers */ - int (*vidioc_try_fmt_vid_cap)(struct file *file, void *fh, + int (*vidioc_try_fmt_vid_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh, + int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_vid_out)(struct file *file, void *fh, + int (*vidioc_try_fmt_vid_out)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh, + int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *fh, + int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_vbi_out)(struct file *file, void *fh, + int (*vidioc_try_fmt_vbi_out)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh, + int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh, + int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh, + int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh, + int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *fh, + int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_sdr_out)(struct file *file, void *fh, + int (*vidioc_try_fmt_sdr_out)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_meta_cap)(struct file *file, void *fh, + int (*vidioc_try_fmt_meta_cap)(struct file *file, void *, struct v4l2_format *f); - int (*vidioc_try_fmt_meta_out)(struct file *file, void *fh, + int (*vidioc_try_fmt_meta_out)(struct file *file, void *, struct v4l2_format *f); =20 /* Buffer handlers */ - int (*vidioc_reqbufs)(struct file *file, void *fh, + int (*vidioc_reqbufs)(struct file *file, void *, struct v4l2_requestbuffers *b); - int (*vidioc_querybuf)(struct file *file, void *fh, + int (*vidioc_querybuf)(struct file *file, void *, struct v4l2_buffer *b); - int (*vidioc_qbuf)(struct file *file, void *fh, + int (*vidioc_qbuf)(struct file *file, void *, struct v4l2_buffer *b); - int (*vidioc_expbuf)(struct file *file, void *fh, + int (*vidioc_expbuf)(struct file *file, void *, struct v4l2_exportbuffer *e); - int (*vidioc_dqbuf)(struct file *file, void *fh, + int (*vidioc_dqbuf)(struct file *file, void *, struct v4l2_buffer *b); =20 - int (*vidioc_create_bufs)(struct file *file, void *fh, + int (*vidioc_create_bufs)(struct file *file, void *, struct v4l2_create_buffers *b); - int (*vidioc_prepare_buf)(struct file *file, void *fh, + int (*vidioc_prepare_buf)(struct file *file, void *, struct v4l2_buffer *b); - int (*vidioc_remove_bufs)(struct file *file, void *fh, + int (*vidioc_remove_bufs)(struct file *file, void *, struct v4l2_remove_buffers *d); =20 - int (*vidioc_overlay)(struct file *file, void *fh, unsigned int i); - int (*vidioc_g_fbuf)(struct file *file, void *fh, + int (*vidioc_overlay)(struct file *file, void *, unsigned int i); + int (*vidioc_g_fbuf)(struct file *file, void *, struct v4l2_framebuffer *a); - int (*vidioc_s_fbuf)(struct file *file, void *fh, + int (*vidioc_s_fbuf)(struct file *file, void *, const struct v4l2_framebuffer *a); =20 /* Stream on/off */ - int (*vidioc_streamon)(struct file *file, void *fh, + int (*vidioc_streamon)(struct file *file, void *, enum v4l2_buf_type i); - int (*vidioc_streamoff)(struct file *file, void *fh, + int (*vidioc_streamoff)(struct file *file, void *, enum v4l2_buf_type i); =20 /* @@ -438,135 +438,135 @@ struct v4l2_ioctl_ops { * * Note: ENUMSTD is handled by videodev.c */ - int (*vidioc_g_std)(struct file *file, void *fh, v4l2_std_id *norm); - int (*vidioc_s_std)(struct file *file, void *fh, v4l2_std_id norm); - int (*vidioc_querystd)(struct file *file, void *fh, v4l2_std_id *a); + int (*vidioc_g_std)(struct file *file, void *, v4l2_std_id *norm); + int (*vidioc_s_std)(struct file *file, void *, v4l2_std_id norm); + int (*vidioc_querystd)(struct file *file, void *, v4l2_std_id *a); =20 /* Input handling */ - int (*vidioc_enum_input)(struct file *file, void *fh, + int (*vidioc_enum_input)(struct file *file, void *, struct v4l2_input *inp); - int (*vidioc_g_input)(struct file *file, void *fh, unsigned int *i); - int (*vidioc_s_input)(struct file *file, void *fh, unsigned int i); + int (*vidioc_g_input)(struct file *file, void *, unsigned int *i); + int (*vidioc_s_input)(struct file *file, void *, unsigned int i); =20 /* Output handling */ - int (*vidioc_enum_output)(struct file *file, void *fh, + int (*vidioc_enum_output)(struct file *file, void *, struct v4l2_output *a); - int (*vidioc_g_output)(struct file *file, void *fh, unsigned int *i); - int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i); + int (*vidioc_g_output)(struct file *file, void *, unsigned int *i); + int (*vidioc_s_output)(struct file *file, void *, unsigned int i); =20 /* Control handling */ - int (*vidioc_query_ext_ctrl)(struct file *file, void *fh, + int (*vidioc_query_ext_ctrl)(struct file *file, void *, struct v4l2_query_ext_ctrl *a); - int (*vidioc_g_ext_ctrls)(struct file *file, void *fh, + int (*vidioc_g_ext_ctrls)(struct file *file, void *, struct v4l2_ext_controls *a); - int (*vidioc_s_ext_ctrls)(struct file *file, void *fh, + int (*vidioc_s_ext_ctrls)(struct file *file, void *, struct v4l2_ext_controls *a); - int (*vidioc_try_ext_ctrls)(struct file *file, void *fh, + int (*vidioc_try_ext_ctrls)(struct file *file, void *, struct v4l2_ext_controls *a); - int (*vidioc_querymenu)(struct file *file, void *fh, + int (*vidioc_querymenu)(struct file *file, void *, struct v4l2_querymenu *a); =20 /* Audio ioctls */ - int (*vidioc_enumaudio)(struct file *file, void *fh, + int (*vidioc_enumaudio)(struct file *file, void *, struct v4l2_audio *a); - int (*vidioc_g_audio)(struct file *file, void *fh, + int (*vidioc_g_audio)(struct file *file, void *, struct v4l2_audio *a); - int (*vidioc_s_audio)(struct file *file, void *fh, + int (*vidioc_s_audio)(struct file *file, void *, const struct v4l2_audio *a); =20 /* Audio out ioctls */ - int (*vidioc_enumaudout)(struct file *file, void *fh, + int (*vidioc_enumaudout)(struct file *file, void *, struct v4l2_audioout *a); - int (*vidioc_g_audout)(struct file *file, void *fh, + int (*vidioc_g_audout)(struct file *file, void *, struct v4l2_audioout *a); - int (*vidioc_s_audout)(struct file *file, void *fh, + int (*vidioc_s_audout)(struct file *file, void *, const struct v4l2_audioout *a); - int (*vidioc_g_modulator)(struct file *file, void *fh, + int (*vidioc_g_modulator)(struct file *file, void *, struct v4l2_modulator *a); - int (*vidioc_s_modulator)(struct file *file, void *fh, + int (*vidioc_s_modulator)(struct file *file, void *, const struct v4l2_modulator *a); /* Crop ioctls */ - int (*vidioc_g_pixelaspect)(struct file *file, void *fh, + int (*vidioc_g_pixelaspect)(struct file *file, void *, int buf_type, struct v4l2_fract *aspect); - int (*vidioc_g_selection)(struct file *file, void *fh, + int (*vidioc_g_selection)(struct file *file, void *, struct v4l2_selection *s); - int (*vidioc_s_selection)(struct file *file, void *fh, + int (*vidioc_s_selection)(struct file *file, void *, struct v4l2_selection *s); /* Compression ioctls */ - int (*vidioc_g_jpegcomp)(struct file *file, void *fh, + int (*vidioc_g_jpegcomp)(struct file *file, void *, struct v4l2_jpegcompression *a); - int (*vidioc_s_jpegcomp)(struct file *file, void *fh, + int (*vidioc_s_jpegcomp)(struct file *file, void *, const struct v4l2_jpegcompression *a); - int (*vidioc_g_enc_index)(struct file *file, void *fh, + int (*vidioc_g_enc_index)(struct file *file, void *, struct v4l2_enc_idx *a); - int (*vidioc_encoder_cmd)(struct file *file, void *fh, + int (*vidioc_encoder_cmd)(struct file *file, void *, struct v4l2_encoder_cmd *a); - int (*vidioc_try_encoder_cmd)(struct file *file, void *fh, + int (*vidioc_try_encoder_cmd)(struct file *file, void *, struct v4l2_encoder_cmd *a); - int (*vidioc_decoder_cmd)(struct file *file, void *fh, + int (*vidioc_decoder_cmd)(struct file *file, void *, struct v4l2_decoder_cmd *a); - int (*vidioc_try_decoder_cmd)(struct file *file, void *fh, + int (*vidioc_try_decoder_cmd)(struct file *file, void *, struct v4l2_decoder_cmd *a); =20 /* Stream type-dependent parameter ioctls */ - int (*vidioc_g_parm)(struct file *file, void *fh, + int (*vidioc_g_parm)(struct file *file, void *, struct v4l2_streamparm *a); - int (*vidioc_s_parm)(struct file *file, void *fh, + int (*vidioc_s_parm)(struct file *file, void *, struct v4l2_streamparm *a); =20 /* Tuner ioctls */ - int (*vidioc_g_tuner)(struct file *file, void *fh, + int (*vidioc_g_tuner)(struct file *file, void *, struct v4l2_tuner *a); - int (*vidioc_s_tuner)(struct file *file, void *fh, + int (*vidioc_s_tuner)(struct file *file, void *, const struct v4l2_tuner *a); - int (*vidioc_g_frequency)(struct file *file, void *fh, + int (*vidioc_g_frequency)(struct file *file, void *, struct v4l2_frequency *a); - int (*vidioc_s_frequency)(struct file *file, void *fh, + int (*vidioc_s_frequency)(struct file *file, void *, const struct v4l2_frequency *a); - int (*vidioc_enum_freq_bands)(struct file *file, void *fh, + int (*vidioc_enum_freq_bands)(struct file *file, void *, struct v4l2_frequency_band *band); =20 /* Sliced VBI cap */ - int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *fh, + int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *, struct v4l2_sliced_vbi_cap *a); =20 /* Log status ioctl */ - int (*vidioc_log_status)(struct file *file, void *fh); + int (*vidioc_log_status)(struct file *file, void *); =20 - int (*vidioc_s_hw_freq_seek)(struct file *file, void *fh, + int (*vidioc_s_hw_freq_seek)(struct file *file, void *, const struct v4l2_hw_freq_seek *a); =20 /* Debugging ioctls */ #ifdef CONFIG_VIDEO_ADV_DEBUG - int (*vidioc_g_register)(struct file *file, void *fh, + int (*vidioc_g_register)(struct file *file, void *, struct v4l2_dbg_register *reg); - int (*vidioc_s_register)(struct file *file, void *fh, + int (*vidioc_s_register)(struct file *file, void *, const struct v4l2_dbg_register *reg); =20 - int (*vidioc_g_chip_info)(struct file *file, void *fh, + int (*vidioc_g_chip_info)(struct file *file, void *, struct v4l2_dbg_chip_info *chip); #endif =20 - int (*vidioc_enum_framesizes)(struct file *file, void *fh, + int (*vidioc_enum_framesizes)(struct file *file, void *, struct v4l2_frmsizeenum *fsize); =20 - int (*vidioc_enum_frameintervals)(struct file *file, void *fh, + int (*vidioc_enum_frameintervals)(struct file *file, void *, struct v4l2_frmivalenum *fival); =20 /* DV Timings IOCTLs */ - int (*vidioc_s_dv_timings)(struct file *file, void *fh, + int (*vidioc_s_dv_timings)(struct file *file, void *, struct v4l2_dv_timings *timings); - int (*vidioc_g_dv_timings)(struct file *file, void *fh, + int (*vidioc_g_dv_timings)(struct file *file, void *, struct v4l2_dv_timings *timings); - int (*vidioc_query_dv_timings)(struct file *file, void *fh, + int (*vidioc_query_dv_timings)(struct file *file, void *, struct v4l2_dv_timings *timings); - int (*vidioc_enum_dv_timings)(struct file *file, void *fh, + int (*vidioc_enum_dv_timings)(struct file *file, void *, struct v4l2_enum_dv_timings *timings); - int (*vidioc_dv_timings_cap)(struct file *file, void *fh, + int (*vidioc_dv_timings_cap)(struct file *file, void *, struct v4l2_dv_timings_cap *cap); - int (*vidioc_g_edid)(struct file *file, void *fh, + int (*vidioc_g_edid)(struct file *file, void *, struct v4l2_edid *edid); - int (*vidioc_s_edid)(struct file *file, void *fh, + int (*vidioc_s_edid)(struct file *file, void *, struct v4l2_edid *edid); =20 int (*vidioc_subscribe_event)(struct v4l2_fh *fh, @@ -575,7 +575,7 @@ struct v4l2_ioctl_ops { const struct v4l2_event_subscription *sub); =20 /* For other private ioctls */ - long (*vidioc_default)(struct file *file, void *fh, + long (*vidioc_default)(struct file *file, void *, bool valid_prio, unsigned int cmd, void *arg); }; =20 --=20 2.49.0