diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2019-07-17 16:29:09 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-07-23 18:50:13 +0300 |
commit | 854aca6d3ad14e041c19ecaa98aa708261189ade (patch) | |
tree | d0927e2b64c151bed1128d68e070c26155a03c5c /drivers/media/platform/omap/omap_vout.c | |
parent | b4133ad3a5c8fee195079bde0ed9fd470c49d3d8 (diff) | |
download | linux-854aca6d3ad14e041c19ecaa98aa708261189ade.tar.xz |
media: omap_vout: use struct v4l2_fh
This driver is one of the few that is still not using struct
v4l2_fh. Convert it.
Tested on a Pandaboard.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/omap/omap_vout.c')
-rw-r--r-- | drivers/media/platform/omap/omap_vout.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c index 151752de0d02..b0f03c2ca65d 100644 --- a/drivers/media/platform/omap/omap_vout.c +++ b/drivers/media/platform/omap/omap_vout.c @@ -836,7 +836,7 @@ static void omap_vout_buffer_release(struct videobuf_queue *q, static __poll_t omap_vout_poll(struct file *file, struct poll_table_struct *wait) { - struct omap_vout_device *vout = file->private_data; + struct omap_vout_device *vout = video_drvdata(file); struct videobuf_queue *q = &vout->vbq; return videobuf_poll_stream(file, q, wait); @@ -871,7 +871,7 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma) void *pos; unsigned long start = vma->vm_start; unsigned long size = (vma->vm_end - vma->vm_start); - struct omap_vout_device *vout = file->private_data; + struct omap_vout_device *vout = video_drvdata(file); struct videobuf_queue *q = &vout->vbq; v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, @@ -930,7 +930,7 @@ static int omap_vout_release(struct file *file) unsigned int ret, i; struct videobuf_queue *q; struct omapvideo_info *ovid; - struct omap_vout_device *vout = file->private_data; + struct omap_vout_device *vout = video_drvdata(file); v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, "Entering %s\n", __func__); ovid = &vout->vid_info; @@ -983,7 +983,7 @@ static int omap_vout_release(struct file *file) vout->mmap_count = 0; vout->opened -= 1; - file->private_data = NULL; + v4l2_fh_release(file); if (vout->buffer_allocated) videobuf_mmap_free(q); @@ -995,9 +995,8 @@ static int omap_vout_release(struct file *file) static int omap_vout_open(struct file *file) { struct videobuf_queue *q; - struct omap_vout_device *vout = NULL; - - vout = video_drvdata(file); + struct omap_vout_device *vout = video_drvdata(file); + int ret; if (vout == NULL) return -ENODEV; @@ -1008,9 +1007,11 @@ static int omap_vout_open(struct file *file) if (vout->opened) return -EBUSY; - vout->opened += 1; + ret = v4l2_fh_open(file); + if (ret) + return ret; - file->private_data = vout; + vout->opened += 1; vout->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; q = &vout->vbq; @@ -1034,7 +1035,7 @@ static int omap_vout_open(struct file *file) static int vidioc_querycap(struct file *file, void *fh, struct v4l2_capability *cap) { - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); strscpy(cap->driver, VOUT_NAME, sizeof(cap->driver)); strscpy(cap->card, vout->vfd->name, sizeof(cap->card)); @@ -1059,7 +1060,7 @@ static int vidioc_enum_fmt_vid_out(struct file *file, void *fh, static int vidioc_g_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *f) { - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); f->fmt.pix = vout->pix; return 0; @@ -1072,7 +1073,7 @@ static int vidioc_try_fmt_vid_out(struct file *file, void *fh, struct omap_overlay *ovl; struct omapvideo_info *ovid; struct omap_video_timings *timing; - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct omap_dss_device *dssdev; ovid = &vout->vid_info; @@ -1099,7 +1100,7 @@ static int vidioc_s_fmt_vid_out(struct file *file, void *fh, struct omap_overlay *ovl; struct omapvideo_info *ovid; struct omap_video_timings *timing; - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct omap_dss_device *dssdev; if (vout->streaming) @@ -1165,7 +1166,7 @@ static int vidioc_try_fmt_vid_overlay(struct file *file, void *fh, struct v4l2_format *f) { int ret = 0; - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct omap_overlay *ovl; struct omapvideo_info *ovid; struct v4l2_window *win = &f->fmt.win; @@ -1191,7 +1192,7 @@ static int vidioc_s_fmt_vid_overlay(struct file *file, void *fh, int ret = 0; struct omap_overlay *ovl; struct omapvideo_info *ovid; - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct v4l2_window *win = &f->fmt.win; mutex_lock(&vout->lock); @@ -1218,7 +1219,7 @@ static int vidioc_g_fmt_vid_overlay(struct file *file, void *fh, u32 key_value = 0; struct omap_overlay *ovl; struct omapvideo_info *ovid; - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct omap_overlay_manager_info info; struct v4l2_window *win = &f->fmt.win; @@ -1239,7 +1240,7 @@ static int vidioc_g_fmt_vid_overlay(struct file *file, void *fh, static int vidioc_g_selection(struct file *file, void *fh, struct v4l2_selection *sel) { - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct v4l2_pix_format *pix = &vout->pix; if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) @@ -1266,7 +1267,7 @@ static int vidioc_g_selection(struct file *file, void *fh, struct v4l2_selection static int vidioc_s_selection(struct file *file, void *fh, struct v4l2_selection *sel) { int ret = -EINVAL; - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct omapvideo_info *ovid; struct omap_overlay *ovl; struct omap_video_timings *timing; @@ -1408,7 +1409,7 @@ static int vidioc_reqbufs(struct file *file, void *fh, { int ret = 0; unsigned int i, num_buffers = 0; - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct videobuf_queue *q = &vout->vbq; if (req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) @@ -1473,7 +1474,7 @@ reqbuf_err: static int vidioc_querybuf(struct file *file, void *fh, struct v4l2_buffer *b) { - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); return videobuf_querybuf(&vout->vbq, b); } @@ -1481,7 +1482,7 @@ static int vidioc_querybuf(struct file *file, void *fh, static int vidioc_qbuf(struct file *file, void *fh, struct v4l2_buffer *buffer) { - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct videobuf_queue *q = &vout->vbq; if ((V4L2_BUF_TYPE_VIDEO_OUTPUT != buffer->type) || @@ -1508,7 +1509,7 @@ static int vidioc_qbuf(struct file *file, void *fh, static int vidioc_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b) { - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct videobuf_queue *q = &vout->vbq; int ret; @@ -1536,7 +1537,7 @@ static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i) { int ret = 0, j; u32 addr = 0, mask = 0; - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct videobuf_queue *q = &vout->vbq; struct omapvideo_info *ovid = &vout->vid_info; @@ -1621,7 +1622,7 @@ static int vidioc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i) { u32 mask = 0; int ret = 0, j; - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct omapvideo_info *ovid = &vout->vid_info; if (!vout->streaming) @@ -1659,7 +1660,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh, int enable = 0; struct omap_overlay *ovl; struct omapvideo_info *ovid; - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct omap_overlay_manager_info info; enum omap_dss_trans_key_type key_type = OMAP_DSS_COLOR_KEY_GFX_DST; @@ -1730,7 +1731,7 @@ static int vidioc_g_fbuf(struct file *file, void *fh, { struct omap_overlay *ovl; struct omapvideo_info *ovid; - struct omap_vout_device *vout = fh; + struct omap_vout_device *vout = video_drvdata(file); struct omap_overlay_manager_info info; ovid = &vout->vid_info; |