]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/em28xx/em28xx-video.c
[PATCH] Fixed em28xx based system lockup
[linux-2.6-omap-h63xx.git] / drivers / media / video / em28xx / em28xx-video.c
index 3323dffe26a479323be61337e1ae51a54b6bb796..5b267808a9d4a3d169e7847601bc3d5b9425e65a 100644 (file)
@@ -6,6 +6,9 @@
                      Mauro Carvalho Chehab <mchehab@brturbo.com.br>
                      Sascha Sommer <saschasommer@freenet.de>
 
+       Some parts based on SN9C10x PC Camera Controllers GPL driver made
+               by Luca Risolia <luca.risolia@studio.unibo.it>
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
@@ -29,6 +32,7 @@
 #include <linux/i2c.h>
 #include <linux/version.h>
 #include <linux/video_decoder.h>
+#include <linux/mutex.h>
 
 #include "em28xx.h"
 #include <media/tuner.h>
@@ -191,7 +195,7 @@ static struct v4l2_queryctrl saa711x_qctrl[] = {
 
 static struct usb_driver em28xx_usb_driver;
 
-static DECLARE_MUTEX(em28xx_sysfs_lock);
+static DEFINE_MUTEX(em28xx_sysfs_lock);
 static DECLARE_RWSEM(em28xx_disconnect);
 
 /*********************  v4l2 interface  ******************************************/
@@ -363,6 +367,9 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
        em28xx_capture_start(dev, 1);
        em28xx_resolution_set(dev);
 
+       /* device needs to be initialized before isoc transfer */
+       video_mux(dev, 0);
+
        /* start the transfer */
        errCode = em28xx_init_isoc(dev);
        if (errCode)
@@ -394,7 +401,7 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
 */
 static void em28xx_release_resources(struct em28xx *dev)
 {
-       down(&em28xx_sysfs_lock);
+       mutex_lock(&em28xx_sysfs_lock);
 
        em28xx_info("V4L2 device /dev/video%d deregistered\n",
                    dev->vdev->minor);
@@ -403,7 +410,7 @@ static void em28xx_release_resources(struct em28xx *dev)
 /*     video_unregister_device(dev->vbi_dev); */
        em28xx_i2c_unregister(dev);
        usb_put_dev(dev->udev);
-       up(&em28xx_sysfs_lock);
+       mutex_unlock(&em28xx_sysfs_lock);
 }
 
 /*