diff options
Diffstat (limited to 'drivers/media/video/cpia.c')
-rw-r--r-- | drivers/media/video/cpia.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index 2a81376ef503..16c094f77852 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c | |||
@@ -39,10 +39,6 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | #include <linux/mutex.h> | 40 | #include <linux/mutex.h> |
41 | 41 | ||
42 | #ifdef CONFIG_KMOD | ||
43 | #include <linux/kmod.h> | ||
44 | #endif | ||
45 | |||
46 | #include "cpia.h" | 42 | #include "cpia.h" |
47 | 43 | ||
48 | static int video_nr = -1; | 44 | static int video_nr = -1; |
@@ -1351,7 +1347,7 @@ static void create_proc_cpia_cam(struct cam_data *cam) | |||
1351 | if (!cpia_proc_root || !cam) | 1347 | if (!cpia_proc_root || !cam) |
1352 | return; | 1348 | return; |
1353 | 1349 | ||
1354 | snprintf(name, sizeof(name), "video%d", cam->vdev.minor); | 1350 | snprintf(name, sizeof(name), "video%d", cam->vdev.num); |
1355 | 1351 | ||
1356 | ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root); | 1352 | ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root); |
1357 | if (!ent) | 1353 | if (!ent) |
@@ -1376,7 +1372,7 @@ static void destroy_proc_cpia_cam(struct cam_data *cam) | |||
1376 | if (!cam || !cam->proc_entry) | 1372 | if (!cam || !cam->proc_entry) |
1377 | return; | 1373 | return; |
1378 | 1374 | ||
1379 | snprintf(name, sizeof(name), "video%d", cam->vdev.minor); | 1375 | snprintf(name, sizeof(name), "video%d", cam->vdev.num); |
1380 | remove_proc_entry(name, cpia_proc_root); | 1376 | remove_proc_entry(name, cpia_proc_root); |
1381 | cam->proc_entry = NULL; | 1377 | cam->proc_entry = NULL; |
1382 | } | 1378 | } |
@@ -3155,7 +3151,7 @@ static void put_cam(struct cpia_camera_ops* ops) | |||
3155 | static int cpia_open(struct inode *inode, struct file *file) | 3151 | static int cpia_open(struct inode *inode, struct file *file) |
3156 | { | 3152 | { |
3157 | struct video_device *dev = video_devdata(file); | 3153 | struct video_device *dev = video_devdata(file); |
3158 | struct cam_data *cam = dev->priv; | 3154 | struct cam_data *cam = video_get_drvdata(dev); |
3159 | int err; | 3155 | int err; |
3160 | 3156 | ||
3161 | if (!cam) { | 3157 | if (!cam) { |
@@ -3202,7 +3198,7 @@ static int cpia_open(struct inode *inode, struct file *file) | |||
3202 | 3198 | ||
3203 | /* Set ownership of /proc/cpia/videoX to current user */ | 3199 | /* Set ownership of /proc/cpia/videoX to current user */ |
3204 | if(cam->proc_entry) | 3200 | if(cam->proc_entry) |
3205 | cam->proc_entry->uid = current->uid; | 3201 | cam->proc_entry->uid = current_uid(); |
3206 | 3202 | ||
3207 | /* set mark for loading first frame uncompressed */ | 3203 | /* set mark for loading first frame uncompressed */ |
3208 | cam->first_frame = 1; | 3204 | cam->first_frame = 1; |
@@ -3232,7 +3228,7 @@ static int cpia_open(struct inode *inode, struct file *file) | |||
3232 | static int cpia_close(struct inode *inode, struct file *file) | 3228 | static int cpia_close(struct inode *inode, struct file *file) |
3233 | { | 3229 | { |
3234 | struct video_device *dev = file->private_data; | 3230 | struct video_device *dev = file->private_data; |
3235 | struct cam_data *cam = dev->priv; | 3231 | struct cam_data *cam = video_get_drvdata(dev); |
3236 | 3232 | ||
3237 | if (cam->ops) { | 3233 | if (cam->ops) { |
3238 | /* Return ownership of /proc/cpia/videoX to root */ | 3234 | /* Return ownership of /proc/cpia/videoX to root */ |
@@ -3284,7 +3280,7 @@ static ssize_t cpia_read(struct file *file, char __user *buf, | |||
3284 | size_t count, loff_t *ppos) | 3280 | size_t count, loff_t *ppos) |
3285 | { | 3281 | { |
3286 | struct video_device *dev = file->private_data; | 3282 | struct video_device *dev = file->private_data; |
3287 | struct cam_data *cam = dev->priv; | 3283 | struct cam_data *cam = video_get_drvdata(dev); |
3288 | int err; | 3284 | int err; |
3289 | 3285 | ||
3290 | /* make this _really_ smp and multithread-safe */ | 3286 | /* make this _really_ smp and multithread-safe */ |
@@ -3341,7 +3337,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3341 | unsigned int ioctlnr, void *arg) | 3337 | unsigned int ioctlnr, void *arg) |
3342 | { | 3338 | { |
3343 | struct video_device *dev = file->private_data; | 3339 | struct video_device *dev = file->private_data; |
3344 | struct cam_data *cam = dev->priv; | 3340 | struct cam_data *cam = video_get_drvdata(dev); |
3345 | int retval = 0; | 3341 | int retval = 0; |
3346 | 3342 | ||
3347 | if (!cam || !cam->ops) | 3343 | if (!cam || !cam->ops) |
@@ -3739,7 +3735,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma) | |||
3739 | unsigned long start = vma->vm_start; | 3735 | unsigned long start = vma->vm_start; |
3740 | unsigned long size = vma->vm_end - vma->vm_start; | 3736 | unsigned long size = vma->vm_end - vma->vm_start; |
3741 | unsigned long page, pos; | 3737 | unsigned long page, pos; |
3742 | struct cam_data *cam = dev->priv; | 3738 | struct cam_data *cam = video_get_drvdata(dev); |
3743 | int retval; | 3739 | int retval; |
3744 | 3740 | ||
3745 | if (!cam || !cam->ops) | 3741 | if (!cam || !cam->ops) |
@@ -3799,10 +3795,9 @@ static const struct file_operations cpia_fops = { | |||
3799 | }; | 3795 | }; |
3800 | 3796 | ||
3801 | static struct video_device cpia_template = { | 3797 | static struct video_device cpia_template = { |
3802 | .owner = THIS_MODULE, | ||
3803 | .name = "CPiA Camera", | 3798 | .name = "CPiA Camera", |
3804 | .type = VID_TYPE_CAPTURE, | ||
3805 | .fops = &cpia_fops, | 3799 | .fops = &cpia_fops, |
3800 | .release = video_device_release_empty, | ||
3806 | }; | 3801 | }; |
3807 | 3802 | ||
3808 | /* initialise cam_data structure */ | 3803 | /* initialise cam_data structure */ |
@@ -3930,7 +3925,7 @@ static void init_camera_struct(struct cam_data *cam, | |||
3930 | cam->proc_entry = NULL; | 3925 | cam->proc_entry = NULL; |
3931 | 3926 | ||
3932 | memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template)); | 3927 | memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template)); |
3933 | cam->vdev.priv = cam; | 3928 | video_set_drvdata(&cam->vdev, cam); |
3934 | 3929 | ||
3935 | cam->curframe = 0; | 3930 | cam->curframe = 0; |
3936 | for (i = 0; i < FRAME_NUM; i++) { | 3931 | for (i = 0; i < FRAME_NUM; i++) { |
@@ -3957,7 +3952,7 @@ struct cam_data *cpia_register_camera(struct cpia_camera_ops *ops, void *lowleve | |||
3957 | camera->lowlevel_data = lowlevel; | 3952 | camera->lowlevel_data = lowlevel; |
3958 | 3953 | ||
3959 | /* register v4l device */ | 3954 | /* register v4l device */ |
3960 | if (video_register_device(&camera->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { | 3955 | if (video_register_device(&camera->vdev, VFL_TYPE_GRABBER, video_nr) < 0) { |
3961 | kfree(camera); | 3956 | kfree(camera); |
3962 | printk(KERN_DEBUG "video_register_device failed\n"); | 3957 | printk(KERN_DEBUG "video_register_device failed\n"); |
3963 | return NULL; | 3958 | return NULL; |
@@ -4010,7 +4005,7 @@ void cpia_unregister_camera(struct cam_data *cam) | |||
4010 | } | 4005 | } |
4011 | 4006 | ||
4012 | #ifdef CONFIG_PROC_FS | 4007 | #ifdef CONFIG_PROC_FS |
4013 | DBG("destroying /proc/cpia/video%d\n", cam->vdev.minor); | 4008 | DBG("destroying /proc/cpia/video%d\n", cam->vdev.num); |
4014 | destroy_proc_cpia_cam(cam); | 4009 | destroy_proc_cpia_cam(cam); |
4015 | #endif | 4010 | #endif |
4016 | if (!cam->open_count) { | 4011 | if (!cam->open_count) { |