mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
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>
This commit is contained in:
committed by
Hans Verkuil
parent
7b6cf051df
commit
0fd7155307
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user