]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/cpia.c
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds
[linux-2.6-omap-h63xx.git] / drivers / media / video / cpia.c
index a661800b0e69fdefec154a23b69462fc448da2c1..16c094f7785294230cdb5d9e1423fbf248454aa7 100644 (file)
 #include <asm/io.h>
 #include <linux/mutex.h>
 
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
-
 #include "cpia.h"
 
 static int video_nr = -1;
@@ -1351,7 +1347,7 @@ static void create_proc_cpia_cam(struct cam_data *cam)
        if (!cpia_proc_root || !cam)
                return;
 
-       snprintf(name, sizeof(name), "video%d", cam->vdev.minor);
+       snprintf(name, sizeof(name), "video%d", cam->vdev.num);
 
        ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root);
        if (!ent)
@@ -1376,7 +1372,7 @@ static void destroy_proc_cpia_cam(struct cam_data *cam)
        if (!cam || !cam->proc_entry)
                return;
 
-       snprintf(name, sizeof(name), "video%d", cam->vdev.minor);
+       snprintf(name, sizeof(name), "video%d", cam->vdev.num);
        remove_proc_entry(name, cpia_proc_root);
        cam->proc_entry = NULL;
 }
@@ -3155,7 +3151,7 @@ static void put_cam(struct cpia_camera_ops* ops)
 static int cpia_open(struct inode *inode, struct file *file)
 {
        struct video_device *dev = video_devdata(file);
-       struct cam_data *cam = dev->priv;
+       struct cam_data *cam = video_get_drvdata(dev);
        int err;
 
        if (!cam) {
@@ -3202,7 +3198,7 @@ static int cpia_open(struct inode *inode, struct file *file)
 
        /* Set ownership of /proc/cpia/videoX to current user */
        if(cam->proc_entry)
-               cam->proc_entry->uid = current->uid;
+               cam->proc_entry->uid = current_uid();
 
        /* set mark for loading first frame uncompressed */
        cam->first_frame = 1;
@@ -3232,7 +3228,7 @@ static int cpia_open(struct inode *inode, struct file *file)
 static int cpia_close(struct inode *inode, struct file *file)
 {
        struct  video_device *dev = file->private_data;
-       struct cam_data *cam = dev->priv;
+       struct cam_data *cam = video_get_drvdata(dev);
 
        if (cam->ops) {
                /* Return ownership of /proc/cpia/videoX to root */
@@ -3284,7 +3280,7 @@ static ssize_t cpia_read(struct file *file, char __user *buf,
                         size_t count, loff_t *ppos)
 {
        struct video_device *dev = file->private_data;
-       struct cam_data *cam = dev->priv;
+       struct cam_data *cam = video_get_drvdata(dev);
        int err;
 
        /* make this _really_ smp and multithread-safe */
@@ -3341,7 +3337,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
                         unsigned int ioctlnr, void *arg)
 {
        struct video_device *dev = file->private_data;
-       struct cam_data *cam = dev->priv;
+       struct cam_data *cam = video_get_drvdata(dev);
        int retval = 0;
 
        if (!cam || !cam->ops)
@@ -3739,7 +3735,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
        unsigned long start = vma->vm_start;
        unsigned long size  = vma->vm_end - vma->vm_start;
        unsigned long page, pos;
-       struct cam_data *cam = dev->priv;
+       struct cam_data *cam = video_get_drvdata(dev);
        int retval;
 
        if (!cam || !cam->ops)
@@ -3801,6 +3797,7 @@ static const struct file_operations cpia_fops = {
 static struct video_device cpia_template = {
        .name           = "CPiA Camera",
        .fops           = &cpia_fops,
+       .release        = video_device_release_empty,
 };
 
 /* initialise cam_data structure  */
@@ -3928,7 +3925,7 @@ static void init_camera_struct(struct cam_data *cam,
        cam->proc_entry = NULL;
 
        memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template));
-       cam->vdev.priv = cam;
+       video_set_drvdata(&cam->vdev, cam);
 
        cam->curframe = 0;
        for (i = 0; i < FRAME_NUM; i++) {
@@ -4008,7 +4005,7 @@ void cpia_unregister_camera(struct cam_data *cam)
        }
 
 #ifdef CONFIG_PROC_FS
-       DBG("destroying /proc/cpia/video%d\n", cam->vdev.minor);
+       DBG("destroying /proc/cpia/video%d\n", cam->vdev.num);
        destroy_proc_cpia_cam(cam);
 #endif
        if (!cam->open_count) {