[PATCH 07/65] media: staging: most: Store v4l2_fh pointer in file->private_data
Jacopo Mondi
jacopo.mondi at ideasonboard.com
Sat Aug 2 02:22:29 PDT 2025
From: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
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 at ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
---
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/video/video.c
index 2b3cdb1ce1404cd13655c780f1215c364ce1a70f..bce7ffeac8fe50d3442f4993ae49ab5fc96ec3cd 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 @@ static int comp_vdev_open(struct file *filp)
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;
--
2.49.0
More information about the linux-amlogic
mailing list