Commit 854aca6d authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

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: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent b4133ad3
...@@ -836,7 +836,7 @@ static void omap_vout_buffer_release(struct videobuf_queue *q, ...@@ -836,7 +836,7 @@ static void omap_vout_buffer_release(struct videobuf_queue *q,
static __poll_t omap_vout_poll(struct file *file, static __poll_t omap_vout_poll(struct file *file,
struct poll_table_struct *wait) 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; struct videobuf_queue *q = &vout->vbq;
return videobuf_poll_stream(file, q, wait); return videobuf_poll_stream(file, q, wait);
...@@ -871,7 +871,7 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -871,7 +871,7 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma)
void *pos; void *pos;
unsigned long start = vma->vm_start; unsigned long start = vma->vm_start;
unsigned long size = (vma->vm_end - 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; struct videobuf_queue *q = &vout->vbq;
v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev,
...@@ -930,7 +930,7 @@ static int omap_vout_release(struct file *file) ...@@ -930,7 +930,7 @@ static int omap_vout_release(struct file *file)
unsigned int ret, i; unsigned int ret, i;
struct videobuf_queue *q; struct videobuf_queue *q;
struct omapvideo_info *ovid; 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__); v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, "Entering %s\n", __func__);
ovid = &vout->vid_info; ovid = &vout->vid_info;
...@@ -983,7 +983,7 @@ static int omap_vout_release(struct file *file) ...@@ -983,7 +983,7 @@ static int omap_vout_release(struct file *file)
vout->mmap_count = 0; vout->mmap_count = 0;
vout->opened -= 1; vout->opened -= 1;
file->private_data = NULL; v4l2_fh_release(file);
if (vout->buffer_allocated) if (vout->buffer_allocated)
videobuf_mmap_free(q); videobuf_mmap_free(q);
...@@ -995,9 +995,8 @@ static int omap_vout_release(struct file *file) ...@@ -995,9 +995,8 @@ static int omap_vout_release(struct file *file)
static int omap_vout_open(struct file *file) static int omap_vout_open(struct file *file)
{ {
struct videobuf_queue *q; struct videobuf_queue *q;
struct omap_vout_device *vout = NULL; struct omap_vout_device *vout = video_drvdata(file);
int ret;
vout = video_drvdata(file);
if (vout == NULL) if (vout == NULL)
return -ENODEV; return -ENODEV;
...@@ -1008,9 +1007,11 @@ static int omap_vout_open(struct file *file) ...@@ -1008,9 +1007,11 @@ static int omap_vout_open(struct file *file)
if (vout->opened) if (vout->opened)
return -EBUSY; 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; vout->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
q = &vout->vbq; q = &vout->vbq;
...@@ -1034,7 +1035,7 @@ static int omap_vout_open(struct file *file) ...@@ -1034,7 +1035,7 @@ static int omap_vout_open(struct file *file)
static int vidioc_querycap(struct file *file, void *fh, static int vidioc_querycap(struct file *file, void *fh,
struct v4l2_capability *cap) 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->driver, VOUT_NAME, sizeof(cap->driver));
strscpy(cap->card, vout->vfd->name, sizeof(cap->card)); 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, ...@@ -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, static int vidioc_g_fmt_vid_out(struct file *file, void *fh,
struct v4l2_format *f) struct v4l2_format *f)
{ {
struct omap_vout_device *vout = fh; struct omap_vout_device *vout = video_drvdata(file);
f->fmt.pix = vout->pix; f->fmt.pix = vout->pix;
return 0; return 0;
...@@ -1072,7 +1073,7 @@ static int vidioc_try_fmt_vid_out(struct file *file, void *fh, ...@@ -1072,7 +1073,7 @@ static int vidioc_try_fmt_vid_out(struct file *file, void *fh,
struct omap_overlay *ovl; struct omap_overlay *ovl;
struct omapvideo_info *ovid; struct omapvideo_info *ovid;
struct omap_video_timings *timing; struct omap_video_timings *timing;
struct omap_vout_device *vout = fh; struct omap_vout_device *vout = video_drvdata(file);
struct omap_dss_device *dssdev; struct omap_dss_device *dssdev;
ovid = &vout->vid_info; ovid = &vout->vid_info;
...@@ -1099,7 +1100,7 @@ static int vidioc_s_fmt_vid_out(struct file *file, void *fh, ...@@ -1099,7 +1100,7 @@ static int vidioc_s_fmt_vid_out(struct file *file, void *fh,
struct omap_overlay *ovl; struct omap_overlay *ovl;
struct omapvideo_info *ovid; struct omapvideo_info *ovid;
struct omap_video_timings *timing; struct omap_video_timings *timing;
struct omap_vout_device *vout = fh; struct omap_vout_device *vout = video_drvdata(file);
struct omap_dss_device *dssdev; struct omap_dss_device *dssdev;
if (vout->streaming) if (vout->streaming)
...@@ -1165,7 +1166,7 @@ static int vidioc_try_fmt_vid_overlay(struct file *file, void *fh, ...@@ -1165,7 +1166,7 @@ static int vidioc_try_fmt_vid_overlay(struct file *file, void *fh,
struct v4l2_format *f) struct v4l2_format *f)
{ {
int ret = 0; int ret = 0;
struct omap_vout_device *vout = fh; struct omap_vout_device *vout = video_drvdata(file);
struct omap_overlay *ovl; struct omap_overlay *ovl;
struct omapvideo_info *ovid; struct omapvideo_info *ovid;
struct v4l2_window *win = &f->fmt.win; struct v4l2_window *win = &f->fmt.win;
...@@ -1191,7 +1192,7 @@ static int vidioc_s_fmt_vid_overlay(struct file *file, void *fh, ...@@ -1191,7 +1192,7 @@ static int vidioc_s_fmt_vid_overlay(struct file *file, void *fh,
int ret = 0; int ret = 0;
struct omap_overlay *ovl; struct omap_overlay *ovl;
struct omapvideo_info *ovid; 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; struct v4l2_window *win = &f->fmt.win;
mutex_lock(&vout->lock); mutex_lock(&vout->lock);
...@@ -1218,7 +1219,7 @@ static int vidioc_g_fmt_vid_overlay(struct file *file, void *fh, ...@@ -1218,7 +1219,7 @@ static int vidioc_g_fmt_vid_overlay(struct file *file, void *fh,
u32 key_value = 0; u32 key_value = 0;
struct omap_overlay *ovl; struct omap_overlay *ovl;
struct omapvideo_info *ovid; 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 omap_overlay_manager_info info;
struct v4l2_window *win = &f->fmt.win; struct v4l2_window *win = &f->fmt.win;
...@@ -1239,7 +1240,7 @@ static int vidioc_g_fmt_vid_overlay(struct file *file, void *fh, ...@@ -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) 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; struct v4l2_pix_format *pix = &vout->pix;
if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) 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 ...@@ -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) static int vidioc_s_selection(struct file *file, void *fh, struct v4l2_selection *sel)
{ {
int ret = -EINVAL; int ret = -EINVAL;
struct omap_vout_device *vout = fh; struct omap_vout_device *vout = video_drvdata(file);
struct omapvideo_info *ovid; struct omapvideo_info *ovid;
struct omap_overlay *ovl; struct omap_overlay *ovl;
struct omap_video_timings *timing; struct omap_video_timings *timing;
...@@ -1408,7 +1409,7 @@ static int vidioc_reqbufs(struct file *file, void *fh, ...@@ -1408,7 +1409,7 @@ static int vidioc_reqbufs(struct file *file, void *fh,
{ {
int ret = 0; int ret = 0;
unsigned int i, num_buffers = 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; struct videobuf_queue *q = &vout->vbq;
if (req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) if (req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
...@@ -1473,7 +1474,7 @@ static int vidioc_reqbufs(struct file *file, void *fh, ...@@ -1473,7 +1474,7 @@ static int vidioc_reqbufs(struct file *file, void *fh,
static int vidioc_querybuf(struct file *file, void *fh, static int vidioc_querybuf(struct file *file, void *fh,
struct v4l2_buffer *b) struct v4l2_buffer *b)
{ {
struct omap_vout_device *vout = fh; struct omap_vout_device *vout = video_drvdata(file);
return videobuf_querybuf(&vout->vbq, b); return videobuf_querybuf(&vout->vbq, b);
} }
...@@ -1481,7 +1482,7 @@ static int vidioc_querybuf(struct file *file, void *fh, ...@@ -1481,7 +1482,7 @@ static int vidioc_querybuf(struct file *file, void *fh,
static int vidioc_qbuf(struct file *file, void *fh, static int vidioc_qbuf(struct file *file, void *fh,
struct v4l2_buffer *buffer) struct v4l2_buffer *buffer)
{ {
struct omap_vout_device *vout = fh; struct omap_vout_device *vout = video_drvdata(file);
struct videobuf_queue *q = &vout->vbq; struct videobuf_queue *q = &vout->vbq;
if ((V4L2_BUF_TYPE_VIDEO_OUTPUT != buffer->type) || if ((V4L2_BUF_TYPE_VIDEO_OUTPUT != buffer->type) ||
...@@ -1508,7 +1509,7 @@ static int vidioc_qbuf(struct file *file, void *fh, ...@@ -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) 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; struct videobuf_queue *q = &vout->vbq;
int ret; int ret;
...@@ -1536,7 +1537,7 @@ static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i) ...@@ -1536,7 +1537,7 @@ static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i)
{ {
int ret = 0, j; int ret = 0, j;
u32 addr = 0, mask = 0; 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 videobuf_queue *q = &vout->vbq;
struct omapvideo_info *ovid = &vout->vid_info; 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) ...@@ -1621,7 +1622,7 @@ static int vidioc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i)
{ {
u32 mask = 0; u32 mask = 0;
int ret = 0, j; 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; struct omapvideo_info *ovid = &vout->vid_info;
if (!vout->streaming) if (!vout->streaming)
...@@ -1659,7 +1660,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh, ...@@ -1659,7 +1660,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh,
int enable = 0; int enable = 0;
struct omap_overlay *ovl; struct omap_overlay *ovl;
struct omapvideo_info *ovid; 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 omap_overlay_manager_info info;
enum omap_dss_trans_key_type key_type = OMAP_DSS_COLOR_KEY_GFX_DST; 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, ...@@ -1730,7 +1731,7 @@ static int vidioc_g_fbuf(struct file *file, void *fh,
{ {
struct omap_overlay *ovl; struct omap_overlay *ovl;
struct omapvideo_info *ovid; 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 omap_overlay_manager_info info;
ovid = &vout->vid_info; ovid = &vout->vid_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment