]> err.no Git - linux-2.6/blobdiff - drivers/media/video/cafe_ccic.c
V4L/DVB (8482): videodev: move all ioctl callbacks to a new v4l2_ioctl_ops struct
[linux-2.6] / drivers / media / video / cafe_ccic.c
index 7ae499c9c54c8785e497e9ddabdcde740c017f01..4bbea458d0c00f896663bd4d006450a8da2a1057 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/spinlock.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-ioctl.h>
 #include <media/v4l2-chip-ident.h>
 #include <linux/device.h>
 #include <linux/wait.h>
@@ -65,7 +66,7 @@ MODULE_SUPPORTED_DEVICE("Video");
  */
 
 #define MAX_DMA_BUFS 3
-static int alloc_bufs_at_read = 0;
+static int alloc_bufs_at_read;
 module_param(alloc_bufs_at_read, bool, 0444);
 MODULE_PARM_DESC(alloc_bufs_at_read,
                "Non-zero value causes DMA buffers to be allocated when the "
@@ -99,7 +100,7 @@ MODULE_PARM_DESC(max_buffers,
                "will be allowed to allocate.  These buffers are big and live "
                "in vmalloc space.");
 
-static int flip = 0;
+static int flip;
 module_param(flip, bool, 0444);
 MODULE_PARM_DESC(flip,
                "If set, the sensor will be instructed to flip the image "
@@ -1593,7 +1594,7 @@ static struct v4l2_pix_format cafe_def_pix_format = {
        .sizeimage      = VGA_WIDTH*VGA_HEIGHT*2,
 };
 
-static int cafe_vidioc_enum_fmt_cap(struct file *filp,
+static int cafe_vidioc_enum_fmt_vid_cap(struct file *filp,
                void *priv, struct v4l2_fmtdesc *fmt)
 {
        struct cafe_camera *cam = priv;
@@ -1608,7 +1609,7 @@ static int cafe_vidioc_enum_fmt_cap(struct file *filp,
 }
 
 
-static int cafe_vidioc_try_fmt_cap (struct file *filp, void *priv,
+static int cafe_vidioc_try_fmt_vid_cap(struct file *filp, void *priv,
                struct v4l2_format *fmt)
 {
        struct cafe_camera *cam = priv;
@@ -1620,7 +1621,7 @@ static int cafe_vidioc_try_fmt_cap (struct file *filp, void *priv,
        return ret;
 }
 
-static int cafe_vidioc_s_fmt_cap(struct file *filp, void *priv,
+static int cafe_vidioc_s_fmt_vid_cap(struct file *filp, void *priv,
                struct v4l2_format *fmt)
 {
        struct cafe_camera *cam = priv;
@@ -1635,7 +1636,7 @@ static int cafe_vidioc_s_fmt_cap(struct file *filp, void *priv,
        /*
         * See if the formatting works in principle.
         */
-       ret = cafe_vidioc_try_fmt_cap(filp, priv, fmt);
+       ret = cafe_vidioc_try_fmt_vid_cap(filp, priv, fmt);
        if (ret)
                return ret;
        /*
@@ -1670,7 +1671,7 @@ static int cafe_vidioc_s_fmt_cap(struct file *filp, void *priv,
  * The V4l2 spec wants us to be smarter, and actually get this from
  * the camera (and not mess with it at open time).  Someday.
  */
-static int cafe_vidioc_g_fmt_cap(struct file *filp, void *priv,
+static int cafe_vidioc_g_fmt_vid_cap(struct file *filp, void *priv,
                struct v4l2_format *f)
 {
        struct cafe_camera *cam = priv;
@@ -1768,22 +1769,12 @@ static const struct file_operations cafe_v4l_fops = {
        .llseek = no_llseek,
 };
 
-static struct video_device cafe_v4l_template = {
-       .name = "cafe",
-       .type = VFL_TYPE_GRABBER,
-       .type2 = VID_TYPE_CAPTURE,
-       .minor = -1, /* Get one dynamically */
-       .tvnorms = V4L2_STD_NTSC_M,
-       .current_norm = V4L2_STD_NTSC_M,  /* make mplayer happy */
-
-       .fops = &cafe_v4l_fops,
-       .release = cafe_v4l_dev_release,
-
+static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = {
        .vidioc_querycap        = cafe_vidioc_querycap,
-       .vidioc_enum_fmt_cap    = cafe_vidioc_enum_fmt_cap,
-       .vidioc_try_fmt_cap     = cafe_vidioc_try_fmt_cap,
-       .vidioc_s_fmt_cap       = cafe_vidioc_s_fmt_cap,
-       .vidioc_g_fmt_cap       = cafe_vidioc_g_fmt_cap,
+       .vidioc_enum_fmt_vid_cap = cafe_vidioc_enum_fmt_vid_cap,
+       .vidioc_try_fmt_vid_cap = cafe_vidioc_try_fmt_vid_cap,
+       .vidioc_s_fmt_vid_cap   = cafe_vidioc_s_fmt_vid_cap,
+       .vidioc_g_fmt_vid_cap   = cafe_vidioc_g_fmt_vid_cap,
        .vidioc_enum_input      = cafe_vidioc_enum_input,
        .vidioc_g_input         = cafe_vidioc_g_input,
        .vidioc_s_input         = cafe_vidioc_s_input,
@@ -1801,6 +1792,19 @@ static struct video_device cafe_v4l_template = {
        .vidioc_s_parm          = cafe_vidioc_s_parm,
 };
 
+static struct video_device cafe_v4l_template = {
+       .name = "cafe",
+       .type = VFL_TYPE_GRABBER,
+       .type2 = VID_TYPE_CAPTURE,
+       .minor = -1, /* Get one dynamically */
+       .tvnorms = V4L2_STD_NTSC_M,
+       .current_norm = V4L2_STD_NTSC_M,  /* make mplayer happy */
+
+       .fops = &cafe_v4l_fops,
+       .ioctl_ops = &cafe_v4l_ioctl_ops,
+       .release = cafe_v4l_dev_release,
+};
+
 
 
 
@@ -2157,7 +2161,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
        cam->v4ldev = cafe_v4l_template;
        cam->v4ldev.debug = 0;
 //     cam->v4ldev.debug = V4L2_DEBUG_IOCTL_ARG;
-       cam->v4ldev.dev = &pdev->dev;
+       cam->v4ldev.parent = &pdev->dev;
        ret = video_register_device(&cam->v4ldev, VFL_TYPE_GRABBER, -1);
        if (ret)
                goto out_smbus;