linux/drivers/media/platform/amphion
Laurent Pinchart 277966749f media: Reset file->private_data to NULL in v4l2_fh_del()
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 = 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 = 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 <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2025-08-13 08:33:44 +02:00
..
Kconfig
Makefile
vdec.c media: amphion: Support dmabuf and v4l2 buffer without binding 2025-07-12 08:34:48 +02:00
venc.c media: amphion: Guard memory allocation to catch failures 2024-10-12 16:28:24 +02:00
vpu.h media: Replace file->private_data access with file_to_v4l2_fh() 2025-08-13 08:33:25 +02:00
vpu_cmds.c media: amphion: remove mutext lock in condition of wait_event 2023-12-13 11:04:45 +01:00
vpu_cmds.h
vpu_codec.h
vpu_color.c media: amphion: Remove unused functions 2025-06-17 10:35:17 +02:00
vpu_core.c media: amphion: Slightly simplify vpu_core_register() 2025-04-24 15:21:35 +02:00
vpu_core.h
vpu_dbg.c media: amphion: Support dmabuf and v4l2 buffer without binding 2025-07-12 08:34:48 +02:00
vpu_defs.h media: amphion: Add H264 and HEVC profile and level control 2025-06-20 12:39:54 +02:00
vpu_drv.c media: amphion: Fix pm_runtime_set_suspended() with runtime pm enabled 2024-11-07 09:05:57 +01:00
vpu_helpers.c media: amphion: Add H264 and HEVC profile and level control 2025-06-20 12:39:54 +02:00
vpu_helpers.h media: amphion: Add H264 and HEVC profile and level control 2025-06-20 12:39:54 +02:00
vpu_imx8q.c
vpu_imx8q.h
vpu_malone.c media: amphion: Add H264 and HEVC profile and level control 2025-06-20 12:39:54 +02:00
vpu_malone.h
vpu_mbox.c media: amphion: Remove unused functions 2025-06-17 10:35:17 +02:00
vpu_mbox.h media: amphion: Remove unused functions 2025-06-17 10:35:17 +02:00
vpu_msgs.c
vpu_msgs.h
vpu_rpc.c
vpu_rpc.h
vpu_v4l2.c media: Reset file->private_data to NULL in v4l2_fh_del() 2025-08-13 08:33:44 +02:00
vpu_v4l2.h media: amphion: Make some vpu_v4l2 functions static 2025-08-13 08:33:31 +02:00
vpu_windsor.c media: amphion: Report the average QP of current encoded frame 2024-06-10 10:24:30 +02:00
vpu_windsor.h