V4L/DVB (8750): V4L: check inval in video_register_device_index()
[safe/jmp/linux-2.6] / drivers / media / video / vino.c
index 6b6dff4..1edda45 100644 (file)
@@ -13,7 +13,7 @@
 /*
  * TODO:
  * - remove "mark pages reserved-hacks" from memory allocation code
- *   and implement nopage()
+ *   and implement fault()
  * - check decimation, calculating and reporting image size when
  *   using decimation
  * - implement read(), user mode buffers and overlay (?)
@@ -28,7 +28,6 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
-#include <linux/moduleparam.h>
 #include <linux/time.h>
 #include <linux/version.h>
 
 #include <linux/i2c.h>
 #include <linux/i2c-algo-sgi.h>
 
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
+#include <media/v4l2-ioctl.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-ioctl.h>
 #include <linux/video_decoder.h>
 #include <linux/mutex.h>
 
@@ -334,7 +335,7 @@ struct vino_settings {
  *
  * Use non-zero value to enable conversion.
  */
-static int vino_pixel_conversion = 0;
+static int vino_pixel_conversion;
 
 module_param_named(pixelconv, vino_pixel_conversion, int, 0);
 
@@ -782,7 +783,7 @@ static int vino_i2c_add_bus(void)
 
 static int vino_i2c_del_bus(void)
 {
-       return i2c_sgi_del_bus(&vino_i2c_adapter);
+       return i2c_del_adapter(&vino_i2c_adapter);
 }
 
 static int i2c_camera_command(unsigned int cmd, void *arg)
@@ -2077,12 +2078,10 @@ static int vino_wait_for_frame(struct vino_channel_settings *vcs)
        init_waitqueue_entry(&wait, current);
        /* add ourselves into wait queue */
        add_wait_queue(&vcs->fb_queue.frame_wait_queue, &wait);
-       /* and set current state */
-       set_current_state(TASK_INTERRUPTIBLE);
 
        /* to ensure that schedule_timeout will return immediately
-        * if VINO interrupt was triggred meanwhile */
-       schedule_timeout(HZ / 10);
+        * if VINO interrupt was triggered meanwhile */
+       schedule_timeout_interruptible(msecs_to_jiffies(100));
 
        if (signal_pending(current))
                err = -EINTR;
@@ -2592,11 +2591,7 @@ static int vino_acquire_input(struct vino_channel_settings *vcs)
        /* First try D1 and then SAA7191 */
        if (vino_drvdata->camera.driver
            && (vino_drvdata->camera.owner == VINO_NO_CHANNEL)) {
-               if (i2c_use_client(vino_drvdata->camera.driver)) {
-                       ret = -ENODEV;
-                       goto out;
-               }
-
+               i2c_use_client(vino_drvdata->camera.driver);
                vino_drvdata->camera.owner = vcs->channel;
                vcs->input = VINO_INPUT_D1;
                vcs->data_norm = VINO_DATA_NORM_D1;
@@ -2605,11 +2600,7 @@ static int vino_acquire_input(struct vino_channel_settings *vcs)
                int input, data_norm;
                int saa7191_input;
 
-               if (i2c_use_client(vino_drvdata->decoder.driver)) {
-                       ret = -ENODEV;
-                       goto out;
-               }
-
+               i2c_use_client(vino_drvdata->decoder.driver);
                input = VINO_INPUT_COMPOSITE;
 
                saa7191_input = vino_get_saa7191_input(input);
@@ -2691,10 +2682,7 @@ static int vino_set_input(struct vino_channel_settings *vcs, int input)
                }
 
                if (vino_drvdata->decoder.owner == VINO_NO_CHANNEL) {
-                       if (i2c_use_client(vino_drvdata->decoder.driver)) {
-                               ret = -ENODEV;
-                               goto out;
-                       }
+                       i2c_use_client(vino_drvdata->decoder.driver);
                        vino_drvdata->decoder.owner = vcs->channel;
                }
 
@@ -2762,10 +2750,7 @@ static int vino_set_input(struct vino_channel_settings *vcs, int input)
                }
 
                if (vino_drvdata->camera.owner == VINO_NO_CHANNEL) {
-                       if (i2c_use_client(vino_drvdata->camera.driver)) {
-                               ret = -ENODEV;
-                               goto out;
-                       }
+                       i2c_use_client(vino_drvdata->camera.driver);
                        vino_drvdata->camera.owner = vcs->channel;
                }
 
@@ -4387,10 +4372,10 @@ static int vino_ioctl(struct inode *inode, struct file *file,
 
 /* Initialization and cleanup */
 
-// __initdata
-static int vino_init_stage = 0;
+/* __initdata */
+static int vino_init_stage;
 
-static struct file_operations vino_fops = {
+static const struct file_operations vino_fops = {
        .owner          = THIS_MODULE,
        .open           = vino_open,
        .release        = vino_close,
@@ -4402,8 +4387,6 @@ static struct file_operations vino_fops = {
 
 static struct video_device v4l_device_template = {
        .name           = "NOT SET",
-       //.type         = VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE |
-       //      VID_TYPE_CLIPPING | VID_TYPE_SCALES, VID_TYPE_OVERLAY
        .fops           = &vino_fops,
        .minor          = -1,
 };