summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/videodev.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/videodev.c')
-rw-r--r--linux/drivers/media/video/videodev.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/videodev.c
index c12f88fe3..4ac9eb21a 100644
--- a/linux/drivers/media/video/videodev.c
+++ b/linux/drivers/media/video/videodev.c
@@ -37,7 +37,6 @@
#include <linux/init.h>
#include <linux/kmod.h>
#include <linux/slab.h>
-#include <linux/devfs_fs_kernel.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include "compat.h"
@@ -780,7 +779,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
ret=vfd->vidioc_overlay(file, fh, *i);
break;
}
-#ifdef HAVE_V4L1
+#ifdef CONFIG_V4L1_COMPAT
/* --- streaming capture ------------------------------------- */
case VIDIOCGMBUF:
{
@@ -1532,6 +1531,7 @@ int video_register_device(struct video_device *vfd, int type, int nr)
int i=0;
int base;
int end;
+ int ret;
char *name_base;
switch(type)
@@ -1557,6 +1557,8 @@ int video_register_device(struct video_device *vfd, int type, int nr)
name_base = "radio";
break;
default:
+ printk(KERN_ERR "%s called with unknown type: %d\n",
+ __FUNCTION__, type);
return -1;
}
@@ -1582,10 +1584,6 @@ int video_register_device(struct video_device *vfd, int type, int nr)
video_device[i]=vfd;
vfd->minor=i;
mutex_unlock(&videodev_lock);
-
- sprintf(vfd->devfs_name, "v4l/%s%d", name_base, i - base);
- devfs_mk_cdev(MKDEV(VIDEO_MAJOR, vfd->minor),
- S_IFCHR | S_IRUSR | S_IWUSR, vfd->devfs_name);
mutex_init(&vfd->lock);
/* sysfs class */
@@ -1596,13 +1594,26 @@ int video_register_device(struct video_device *vfd, int type, int nr)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
#endif
- strlcpy(vfd->class_dev.class_id, vfd->devfs_name + 4, BUS_ID_SIZE);
- class_device_register(&vfd->class_dev);
- class_device_create_file(&vfd->class_dev,
- &class_device_attr_name);
+ sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base);
+ ret = class_device_register(&vfd->class_dev);
+ if (ret < 0) {
+ printk(KERN_ERR "%s: class_device_register failed\n",
+ __FUNCTION__);
+ goto fail_minor;
+ }
+ ret = class_device_create_file(&vfd->class_dev, &class_device_attr_name);
+ if (ret < 0) {
+ printk(KERN_ERR "%s: class_device_create_file 'name' failed\n",
+ __FUNCTION__);
+ goto fail_classdev;
+ }
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
- class_device_create_file(&vfd->class_dev,
- &class_device_attr_dev);
+ ret = class_device_create_file(&vfd->class_dev, &class_device_attr_dev);
+ if (ret < 0) {
+ printk(KERN_ERR "%s: class_device_create_file 'dev' failed\n",
+ __FUNCTION__);
+ goto fail_classdev;
+ }
#endif
#if 1 /* keep */
@@ -1613,6 +1624,15 @@ int video_register_device(struct video_device *vfd, int type, int nr)
"http://lwn.net/Articles/36850/\n", vfd->name);
#endif
return 0;
+
+fail_classdev:
+ class_device_unregister(&vfd->class_dev);
+fail_minor:
+ mutex_lock(&videodev_lock);
+ video_device[vfd->minor] = NULL;
+ vfd->minor = -1;
+ mutex_unlock(&videodev_lock);
+ return ret;
}
/**
@@ -1629,7 +1649,6 @@ void video_unregister_device(struct video_device *vfd)
if(video_device[vfd->minor]!=vfd)
panic("videodev: bad unregister");
- devfs_remove(vfd->devfs_name);
video_device[vfd->minor]=NULL;
class_device_unregister(&vfd->class_dev);
mutex_unlock(&videodev_lock);