From patchwork Sat Feb 19 20:33:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 5919 Return-path: Envelope-to: mchehab@pedra Delivery-date: Sun, 20 Feb 2011 19:16:16 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1PrHZg-0002tS-Ei for mchehab@pedra; Sun, 20 Feb 2011 19:16:16 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Sun, 20 Feb 2011 19:16:16 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PqtUn-0005vM-8M; Sat, 19 Feb 2011 20:33:37 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752332Ab1BSUdZ (ORCPT + 1 other); Sat, 19 Feb 2011 15:33:25 -0500 Received: from mail-out.m-online.net ([212.18.0.10]:55464 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751407Ab1BSUdZ (ORCPT ); Sat, 19 Feb 2011 15:33:25 -0500 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 4C9B81853BAC; Sat, 19 Feb 2011 21:33:23 +0100 (CET) X-Auth-Info: DdOeZSkK+lz3dBDP6rXIWqFOsLlzzF/Sw9wbnfRT42k= Received: from localhost (p4FE3C67D.dip.t-dialin.net [79.227.198.125]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 492A01C00172; Sat, 19 Feb 2011 21:33:23 +0100 (CET) From: Anatolij Gustschin To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Hans Verkuil , Anatolij Gustschin Subject: [PATCH] fsl-viu: replace .ioctl by .unlocked_ioctl Date: Sat, 19 Feb 2011 21:33:18 +0100 Message-Id: <1298147598-2944-1-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.1 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Use the core-assisted locking in fsl-viu driver and switch to .unlocked_ioctl. Signed-off-by: Anatolij Gustschin --- drivers/media/video/fsl-viu.c | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c index e4bba88..a20b166 100644 --- a/drivers/media/video/fsl-viu.c +++ b/drivers/media/video/fsl-viu.c @@ -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; } @@ -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; } @@ -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, }; @@ -1499,9 +1498,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); @@ -1532,8 +1528,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); @@ -1560,6 +1563,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; @@ -1569,6 +1574,7 @@ err_irq: 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: