]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/cafe_ccic.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
[linux-2.6-omap-h63xx.git] / drivers / media / video / cafe_ccic.c
index d99453faaab79715d3723492e99a9ea9d9a92116..a8c068e1de1cb30956e227e9d14a933c0c36735d 100644 (file)
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/fs.h>
+#include <linux/mm.h>
 #include <linux/pci.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #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>
@@ -1474,9 +1476,12 @@ static int cafe_v4l_open(struct inode *inode, struct file *filp)
 {
        struct cafe_camera *cam;
 
+       lock_kernel();
        cam = cafe_find_dev(iminor(inode));
-       if (cam == NULL)
+       if (cam == NULL) {
+               unlock_kernel();
                return -ENODEV;
+       }
        filp->private_data = cam;
 
        mutex_lock(&cam->s_mutex);
@@ -1488,6 +1493,7 @@ static int cafe_v4l_open(struct inode *inode, struct file *filp)
        }
        (cam->users)++;
        mutex_unlock(&cam->s_mutex);
+       unlock_kernel();
        return 0;
 }
 
@@ -1768,17 +1774,7 @@ 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_vid_cap = cafe_vidioc_enum_fmt_vid_cap,
        .vidioc_try_fmt_vid_cap = cafe_vidioc_try_fmt_vid_cap,
@@ -1801,6 +1797,17 @@ static struct video_device cafe_v4l_template = {
        .vidioc_s_parm          = cafe_vidioc_s_parm,
 };
 
+static struct video_device cafe_v4l_template = {
+       .name = "cafe",
+       .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,
+};
+
 
 
 
@@ -2052,10 +2059,10 @@ static void cafe_dfs_cam_setup(struct cafe_camera *cam)
 
        if (!cafe_dfs_root)
                return;
-       sprintf(fname, "regs-%d", cam->v4ldev.minor);
+       sprintf(fname, "regs-%d", cam->v4ldev.num);
        cam->dfs_regs = debugfs_create_file(fname, 0444, cafe_dfs_root,
                        cam, &cafe_dfs_reg_ops);
-       sprintf(fname, "cam-%d", cam->v4ldev.minor);
+       sprintf(fname, "cam-%d", cam->v4ldev.num);
        cam->dfs_cam_regs = debugfs_create_file(fname, 0444, cafe_dfs_root,
                        cam, &cafe_dfs_cam_ops);
 }
@@ -2089,15 +2096,8 @@ static int cafe_pci_probe(struct pci_dev *pdev,
                const struct pci_device_id *id)
 {
        int ret;
-       u16 classword;
        struct cafe_camera *cam;
-       /*
-        * Make sure we have a camera here - we'll get calls for
-        * the other cafe devices as well.
-        */
-       pci_read_config_word(pdev, PCI_CLASS_DEVICE, &classword);
-       if (classword != PCI_CLASS_MULTIMEDIA_VIDEO)
-               return -ENODEV;
+
        /*
         * Start putting together one of our big camera structures.
         */
@@ -2157,7 +2157,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;
@@ -2285,8 +2285,8 @@ static int cafe_pci_resume(struct pci_dev *pdev)
 
 
 static struct pci_device_id cafe_ids[] = {
-       { PCI_DEVICE(0x11ab, 0x4100) }, /* Eventual real ID */
-       { PCI_DEVICE(0x11ab, 0x4102) }, /* Really eventual real ID */
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL,
+                    PCI_DEVICE_ID_MARVELL_88ALP01_CCIC) },
        { 0, }
 };