aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2025-08-10 04:29:49 +0300
committerHans Verkuil <hverkuil+cisco@kernel.org>2025-08-13 08:33:21 +0200
commit0fd7155307bebb7daf946abae0ee8e50d20819ed (patch)
treee27f76c1d13ab5e36f11ba69d6ddd9c0d4960973 /drivers
parentmedia: usb: uvcvideo: Store v4l2_fh pointer in file->private_data (diff)
downloadlinux-0fd7155307bebb7daf946abae0ee8e50d20819ed.tar.gz
linux-0fd7155307bebb7daf946abae0ee8e50d20819ed.zip
media: staging: most: Store v4l2_fh pointer in file->private_data
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 <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/most/video/video.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index 2b3cdb1ce140..bce7ffeac8fe 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -52,6 +52,11 @@ struct comp_fh {
u32 offs;
};
+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);
@@ -91,7 +96,7 @@ static int comp_vdev_open(struct file *filp)
fh->mdev = mdev;
v4l2_fh_init(&fh->fh, vdev);
- filp->private_data = fh;
+ filp->private_data = &fh->fh;
v4l2_fh_add(&fh->fh);
@@ -115,7 +120,7 @@ err_dec:
static int comp_vdev_close(struct file *filp)
{
- struct comp_fh *fh = filp->private_data;
+ struct comp_fh *fh = to_comp_fh(filp);
struct most_video_dev *mdev = fh->mdev;
struct mbo *mbo, *tmp;
@@ -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 = filp->private_data;
+ struct comp_fh *fh = to_comp_fh(filp);
struct most_video_dev *mdev = fh->mdev;
int ret = 0;
@@ -200,7 +205,7 @@ static ssize_t comp_vdev_read(struct file *filp, char __user *buf,
static __poll_t comp_vdev_poll(struct file *filp, poll_table *wait)
{
- struct comp_fh *fh = filp->private_data;
+ struct comp_fh *fh = to_comp_fh(filp);
struct most_video_dev *mdev = fh->mdev;
__poll_t mask = 0;