[PATCH 04/65] media: usb: hdpvr: Store v4l2_fh pointer in file->private_data

Jacopo Mondi <jacopo.mondi-ryLnwIuWjnjg/[email protected]> Sat, 02 Aug 2025 11:22:26 +0200
Newsgroups gmane.linux.ports.tegra,gmane.linux.drivers.video-input-infrastructure,gmane.linux.kernel,gmane.linux.documentation,gmane.linux.ports.arm.kernel,gmane.linux.ports.arm.mediatek,gmane.linux.kernel.renesas-soc,gmane.linux.ports.arm.msm,gmane.linux.kernel.samsung-soc,gmane.linux.usb.general,gmane.linux.ports.arm.rockchip,gmane.comp.video.mjpeg.user
Message-ID <[email protected]>
From: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/[email protected]>

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 <laurent.pinchart-ryLnwIuWjnjg/[email protected]>
Signed-off-by: Jacopo Mondi <jacopo.mondi-ryLnwIuWjnjg/[email protected]>
---
 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/hdpvr/hdpvr-video.c
index fd7d2a9d0449ab9ba68ddfa148a167797ea243fc..4c431bd9b50352ed1bd3da3e62625c9cff6c149d 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 = true;
 	v4l2_fh_init(&fh->fh, video_devdata(file));
 	v4l2_fh_add(&fh->fh);
-	file->private_data = fh;
+	file->private_data = &fh->fh;
 	return 0;
 }
 

-- 
2.49.0