]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
media: media/saa7146: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Mon, 16 Oct 2017 23:10:12 +0000 (19:10 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 31 Oct 2017 10:38:53 +0000 (06:38 -0400)
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly. This requires adding a pointer to
hold the timer's target file, as there won't be a way to pass this in the
future.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/common/saa7146/saa7146_fops.c
drivers/media/common/saa7146/saa7146_vbi.c
include/media/drv-intf/saa7146_vv.h

index 930d2c94d5d30458b7ef40ad72a5155454613516..c4664f0da8746f35e4abb8f1df8f523f17959f4a 100644 (file)
@@ -559,7 +559,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
        vbi->start[1] = 312;
        vbi->count[1] = 16;
 
-       init_timer(&vv->vbi_read_timeout);
+       timer_setup(&vv->vbi_read_timeout, NULL, 0);
 
        vv->ov_fb.capability = V4L2_FBUF_CAP_LIST_CLIPPING;
        vv->ov_fb.flags = V4L2_FBUF_FLAG_PRIMARY;
index 69525ca4f52c31b003b65a923166c738d84f26da..ae66c2325228d83a41d50a7d25d77efc519b69a3 100644 (file)
@@ -348,9 +348,10 @@ static void vbi_stop(struct saa7146_fh *fh, struct file *file)
        spin_unlock_irqrestore(&dev->slock, flags);
 }
 
-static void vbi_read_timeout(unsigned long data)
+static void vbi_read_timeout(struct timer_list *t)
 {
-       struct file *file = (struct file*)data;
+       struct saa7146_vv *vv = from_timer(vv, t, vbi_read_timeout);
+       struct file *file = vv->vbi_read_timeout_file;
        struct saa7146_fh *fh = file->private_data;
        struct saa7146_dev *dev = fh->dev;
 
@@ -401,8 +402,8 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
                            sizeof(struct saa7146_buf),
                            file, &dev->v4l2_lock);
 
-       vv->vbi_read_timeout.function = vbi_read_timeout;
-       vv->vbi_read_timeout.data = (unsigned long)file;
+       vv->vbi_read_timeout.function = (TIMER_FUNC_TYPE)vbi_read_timeout;
+       vv->vbi_read_timeout_file = file;
 
        /* initialize the brs */
        if ( 0 != (SAA7146_USE_PORT_B_FOR_VBI & dev->ext_vv_data->flags)) {
index 736f4f2d8290f74025ff45422e0b1cf084ac018d..926c5b1452796f0da1f981e3ab50daa601a92603 100644 (file)
@@ -107,6 +107,7 @@ struct saa7146_vv
        struct saa7146_dmaqueue         vbi_dmaq;
        struct v4l2_vbi_format          vbi_fmt;
        struct timer_list               vbi_read_timeout;
+       struct file                     *vbi_read_timeout_file;
        /* vbi workaround interrupt queue */
        wait_queue_head_t               vbi_wq;
        int                             vbi_fieldcount;