Skip to content

Commit

Permalink
[media] fsl-viu: replace .ioctl by .unlocked_ioctl
Browse files Browse the repository at this point in the history
Use the core-assisted locking in fsl-viu driver and switch
to .unlocked_ioctl.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Anatolij Gustschin authored and Mauro Carvalho Chehab committed May 20, 2011
1 parent 8d11593 commit 2f97000
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions drivers/media/video/fsl-viu.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,13 +825,11 @@ static int vidioc_s_fmt_overlay(struct file *file, void *priv,
if (err)
return err;

mutex_lock(&dev->lock);
fh->win = f->fmt.win;

spin_lock_irqsave(&dev->slock, flags);
viu_start_preview(dev, fh);
spin_unlock_irqrestore(&dev->slock, flags);
mutex_unlock(&dev->lock);
return 0;
}

Expand Down Expand Up @@ -1311,7 +1309,8 @@ static int viu_open(struct file *file)
videobuf_queue_dma_contig_init(&fh->vb_vidq, &viu_video_qops,
dev->dev, &fh->vbq_lock,
fh->type, V4L2_FIELD_INTERLACED,
sizeof(struct viu_buf), fh, NULL);
sizeof(struct viu_buf), fh,
&fh->dev->lock);
return 0;
}

Expand Down Expand Up @@ -1401,7 +1400,7 @@ static struct v4l2_file_operations viu_fops = {
.release = viu_release,
.read = viu_read,
.poll = viu_poll,
.ioctl = video_ioctl2, /* V4L2 ioctl handler */
.unlocked_ioctl = video_ioctl2, /* V4L2 ioctl handler */
.mmap = viu_mmap,
};

Expand Down Expand Up @@ -1498,9 +1497,6 @@ static int __devinit viu_of_probe(struct platform_device *op)
INIT_LIST_HEAD(&viu_dev->vidq.active);
INIT_LIST_HEAD(&viu_dev->vidq.queued);

/* initialize locks */
mutex_init(&viu_dev->lock);

snprintf(viu_dev->v4l2_dev.name,
sizeof(viu_dev->v4l2_dev.name), "%s", "VIU");
ret = v4l2_device_register(viu_dev->dev, &viu_dev->v4l2_dev);
Expand Down Expand Up @@ -1531,8 +1527,15 @@ static int __devinit viu_of_probe(struct platform_device *op)

viu_dev->vdev = vdev;

/* initialize locks */
mutex_init(&viu_dev->lock);
viu_dev->vdev->lock = &viu_dev->lock;
spin_lock_init(&viu_dev->slock);

video_set_drvdata(viu_dev->vdev, viu_dev);

mutex_lock(&viu_dev->lock);

ret = video_register_device(viu_dev->vdev, VFL_TYPE_GRABBER, -1);
if (ret < 0) {
video_device_release(viu_dev->vdev);
Expand All @@ -1559,6 +1562,8 @@ static int __devinit viu_of_probe(struct platform_device *op)
goto err_irq;
}

mutex_unlock(&viu_dev->lock);

dev_info(&op->dev, "Freescale VIU Video Capture Board\n");
return ret;

Expand All @@ -1568,6 +1573,7 @@ static int __devinit viu_of_probe(struct platform_device *op)
err_clk:
video_unregister_device(viu_dev->vdev);
err_vdev:
mutex_unlock(&viu_dev->lock);
i2c_put_adapter(ad);
v4l2_device_unregister(&viu_dev->v4l2_dev);
err:
Expand Down

0 comments on commit 2f97000

Please sign in to comment.