diff options
Diffstat (limited to 'linux/drivers/media/video/v4l2-dev.c')
-rw-r--r-- | linux/drivers/media/video/v4l2-dev.c | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/linux/drivers/media/video/v4l2-dev.c b/linux/drivers/media/video/v4l2-dev.c index e1fdd6595..279f436fe 100644 --- a/linux/drivers/media/video/v4l2-dev.c +++ b/linux/drivers/media/video/v4l2-dev.c @@ -43,16 +43,14 @@ static ssize_t show_index(struct device *cd, struct device_attribute *attr, char *buf) { - struct video_device *vfd = container_of(cd, struct video_device, - class_dev); + struct video_device *vfd = container_of(cd, struct video_device, dev); return sprintf(buf, "%i\n", vfd->index); } static ssize_t show_name(struct device *cd, struct device_attribute *attr, char *buf) { - struct video_device *vfd = container_of(cd, struct video_device, - class_dev); + struct video_device *vfd = container_of(cd, struct video_device, dev); return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name); } @@ -64,15 +62,13 @@ static struct device_attribute video_device_attrs[] = { #else static ssize_t show_index(struct class_device *cd, char *buf) { - struct video_device *vfd = container_of(cd, struct video_device, - class_dev); + struct video_device *vfd = container_of(cd, struct video_device, dev); return sprintf(buf, "%i\n", vfd->index); } static ssize_t show_name(struct class_device *cd, char *buf) { - struct video_device *vfd = container_of(cd, struct video_device, - class_dev); + struct video_device *vfd = container_of(cd, struct video_device, dev); return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name); } @@ -101,8 +97,7 @@ static void video_release(struct class_device *cd) static void video_release(struct device *cd) #endif { - struct video_device *vfd = container_of(cd, struct video_device, - class_dev); + struct video_device *vfd = container_of(cd, struct video_device, dev); #if 1 /* keep */ /* needed until all drivers are fixed */ @@ -360,41 +355,41 @@ int video_register_device_index(struct video_device *vfd, int type, int nr, mutex_init(&vfd->lock); /* sysfs class */ - memset(&vfd->class_dev, 0x00, sizeof(vfd->class_dev)); + memset(&vfd->dev, 0x00, sizeof(vfd->dev)); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18) - vfd->class_dev.class = &video_class; - vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); + vfd->dev.class = &video_class; + vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) if (vfd->parent) - vfd->class_dev.dev = vfd->parent; - sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base); - ret = class_device_register(&vfd->class_dev); + vfd->dev.dev = vfd->parent; + sprintf(vfd->dev.class_id, "%s%d", name_base, i - base); + ret = class_device_register(&vfd->dev); #else if (vfd->parent) - vfd->class_dev.parent = vfd->parent; - sprintf(vfd->class_dev.bus_id, "%s%d", name_base, i - base); - ret = device_register(&vfd->class_dev); + vfd->dev.parent = vfd->parent; + sprintf(vfd->dev.bus_id, "%s%d", name_base, i - base); + ret = device_register(&vfd->dev); #endif if (ret < 0) { printk(KERN_ERR "%s: device_register failed\n", __func__); goto fail_minor; } #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) - ret = class_device_create_file(&vfd->class_dev, + ret = class_device_create_file(&vfd->dev, &class_device_attr_name); if (ret < 0) { printk(KERN_ERR "%s: class_device_create_file 'name' failed\n", __func__); - class_device_unregister(&vfd->class_dev); + class_device_unregister(&vfd->dev); goto fail_minor; } - ret = class_device_create_file(&vfd->class_dev, + ret = class_device_create_file(&vfd->dev, &class_device_attr_index); if (ret < 0) { printk(KERN_ERR "%s: class_device_create_file 'index' failed\n", __func__); - class_device_unregister(&vfd->class_dev); + class_device_unregister(&vfd->dev); goto fail_minor; } #endif @@ -433,9 +428,9 @@ void video_unregister_device(struct video_device *vfd) video_device[vfd->minor] = NULL; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) - class_device_unregister(&vfd->class_dev); + class_device_unregister(&vfd->dev); #else - device_unregister(&vfd->class_dev); + device_unregister(&vfd->dev); #endif mutex_unlock(&videodev_lock); } |