linux/drivers/media/platform/xilinx
Laurent Pinchart 618882c926 media: Wrap file->private_data access with a helper function
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 = filp->private_data;
+       struct v4l2_fh *fh = 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 <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
2025-08-13 08:33:23 +02:00
..
Kconfig media: platform: xilinx: Fix Kconfig indentation 2024-01-22 17:23:59 +01:00
Makefile
xilinx-csi2rxss.c media: Switch back to struct platform_driver::remove() 2024-10-12 16:28:25 +02:00
xilinx-dma.c media: Wrap file->private_data access with a helper function 2025-08-13 08:33:23 +02:00
xilinx-dma.h media: xilinx: Refactor struct xvip_dma 2024-05-31 13:51:16 +02:00
xilinx-tpg.c media: xilinx-tpg: fix double put in xtpg_parse_of() 2025-03-06 17:28:29 +01:00
xilinx-vip.c media: v4l: subdev: Switch to stream-aware state functions 2023-11-23 18:57:47 +01:00
xilinx-vip.h media: xilinx: Drop unexpected word 'with' in comments 2022-07-08 17:57:06 +01:00
xilinx-vipp.c media: xilinx-vipp: Use for_each_child_of_node_scoped() 2025-06-17 10:51:34 +02:00
xilinx-vipp.h
xilinx-vtc.c media: Switch back to struct platform_driver::remove() 2024-10-12 16:28:25 +02:00
xilinx-vtc.h