]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/media/platform/s5p-mfc/s5p_mfc.c
treewide: setup_timer() -> timer_setup()
[mirror_ubuntu-bionic-kernel.git] / drivers / media / platform / s5p-mfc / s5p_mfc.c
index 1afde5021ca6613ac096e07263b94367a26a6c8c..bc68dbbcaec1667e29088ecb35f17944ec1ba85f 100644 (file)
@@ -145,9 +145,9 @@ void s5p_mfc_cleanup_queue(struct list_head *lh, struct vb2_queue *vq)
        }
 }
 
-static void s5p_mfc_watchdog(unsigned long arg)
+static void s5p_mfc_watchdog(struct timer_list *t)
 {
-       struct s5p_mfc_dev *dev = (struct s5p_mfc_dev *)arg;
+       struct s5p_mfc_dev *dev = from_timer(dev, t, watchdog_timer);
 
        if (test_bit(0, &dev->hw_lock))
                atomic_inc(&dev->watchdog_cnt);
@@ -470,7 +470,7 @@ static void s5p_mfc_handle_error(struct s5p_mfc_dev *dev,
 {
        mfc_err("Interrupt Error: %08x\n", err);
 
-       if (ctx != NULL) {
+       if (ctx) {
                /* Error recovery is dependent on the state of context */
                switch (ctx->state) {
                case MFCINST_RES_CHANGE_INIT:
@@ -508,7 +508,7 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx,
 {
        struct s5p_mfc_dev *dev;
 
-       if (ctx == NULL)
+       if (!ctx)
                return;
        dev = ctx->dev;
        if (ctx->c_ops->post_seq_start) {
@@ -562,7 +562,7 @@ static void s5p_mfc_handle_init_buffers(struct s5p_mfc_ctx *ctx,
        struct s5p_mfc_buf *src_buf;
        struct s5p_mfc_dev *dev;
 
-       if (ctx == NULL)
+       if (!ctx)
                return;
        dev = ctx->dev;
        s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev);
@@ -1043,12 +1043,9 @@ end:
 static int s5p_mfc_mmap(struct file *file, struct vm_area_struct *vma)
 {
        struct s5p_mfc_ctx *ctx = fh_to_ctx(file->private_data);
-       struct s5p_mfc_dev *dev = ctx->dev;
        unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
        int ret;
 
-       if (mutex_lock_interruptible(&dev->mfc_mutex))
-               return -ERESTARTSYS;
        if (offset < DST_QUEUE_OFF_BASE) {
                mfc_debug(2, "mmaping source\n");
                ret = vb2_mmap(&ctx->vq_src, vma);
@@ -1057,7 +1054,6 @@ static int s5p_mfc_mmap(struct file *file, struct vm_area_struct *vma)
                vma->vm_pgoff -= (DST_QUEUE_OFF_BASE >> PAGE_SHIFT);
                ret = vb2_mmap(&ctx->vq_dst, vma);
        }
-       mutex_unlock(&dev->mfc_mutex);
        return ret;
 }
 
@@ -1083,7 +1079,7 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev,
        struct device *child;
        int ret;
 
-       child = devm_kzalloc(dev, sizeof(struct device), GFP_KERNEL);
+       child = devm_kzalloc(dev, sizeof(*child), GFP_KERNEL);
        if (!child)
                return NULL;
 
@@ -1270,10 +1266,8 @@ static int s5p_mfc_probe(struct platform_device *pdev)
 
        pr_debug("%s++\n", __func__);
        dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
-       if (!dev) {
-               dev_err(&pdev->dev, "Not enough memory for MFC device\n");
+       if (!dev)
                return -ENOMEM;
-       }
 
        spin_lock_init(&dev->irqlock);
        spin_lock_init(&dev->condlock);
@@ -1291,7 +1285,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)
                return PTR_ERR(dev->regs_base);
 
        res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-       if (res == NULL) {
+       if (!res) {
                dev_err(&pdev->dev, "failed to get irq resource\n");
                return -ENOENT;
        }
@@ -1320,9 +1314,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)
        dev->hw_lock = 0;
        INIT_WORK(&dev->watchdog_work, s5p_mfc_watchdog_worker);
        atomic_set(&dev->watchdog_cnt, 0);
-       init_timer(&dev->watchdog_timer);
-       dev->watchdog_timer.data = (unsigned long)dev;
-       dev->watchdog_timer.function = s5p_mfc_watchdog;
+       timer_setup(&dev->watchdog_timer, s5p_mfc_watchdog, 0);
 
        ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
        if (ret)