diff options
Diffstat (limited to 'drivers/media/video/v4l2-dev.c')
-rw-r--r-- | drivers/media/video/v4l2-dev.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 9cc2cf1a1c93..88eeee1d8baf 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -41,16 +41,14 @@ | |||
41 | static ssize_t show_index(struct device *cd, | 41 | static ssize_t show_index(struct device *cd, |
42 | struct device_attribute *attr, char *buf) | 42 | struct device_attribute *attr, char *buf) |
43 | { | 43 | { |
44 | struct video_device *vfd = container_of(cd, struct video_device, | 44 | struct video_device *vfd = container_of(cd, struct video_device, dev); |
45 | class_dev); | ||
46 | return sprintf(buf, "%i\n", vfd->index); | 45 | return sprintf(buf, "%i\n", vfd->index); |
47 | } | 46 | } |
48 | 47 | ||
49 | static ssize_t show_name(struct device *cd, | 48 | static ssize_t show_name(struct device *cd, |
50 | struct device_attribute *attr, char *buf) | 49 | struct device_attribute *attr, char *buf) |
51 | { | 50 | { |
52 | struct video_device *vfd = container_of(cd, struct video_device, | 51 | struct video_device *vfd = container_of(cd, struct video_device, dev); |
53 | class_dev); | ||
54 | return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name); | 52 | return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name); |
55 | } | 53 | } |
56 | 54 | ||
@@ -77,8 +75,7 @@ EXPORT_SYMBOL(video_device_release); | |||
77 | 75 | ||
78 | static void video_release(struct device *cd) | 76 | static void video_release(struct device *cd) |
79 | { | 77 | { |
80 | struct video_device *vfd = container_of(cd, struct video_device, | 78 | struct video_device *vfd = container_of(cd, struct video_device, dev); |
81 | class_dev); | ||
82 | 79 | ||
83 | #if 1 | 80 | #if 1 |
84 | /* needed until all drivers are fixed */ | 81 | /* needed until all drivers are fixed */ |
@@ -320,13 +317,13 @@ int video_register_device_index(struct video_device *vfd, int type, int nr, | |||
320 | mutex_init(&vfd->lock); | 317 | mutex_init(&vfd->lock); |
321 | 318 | ||
322 | /* sysfs class */ | 319 | /* sysfs class */ |
323 | memset(&vfd->class_dev, 0x00, sizeof(vfd->class_dev)); | 320 | memset(&vfd->dev, 0x00, sizeof(vfd->dev)); |
324 | vfd->class_dev.class = &video_class; | 321 | vfd->dev.class = &video_class; |
325 | vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); | 322 | vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); |
326 | if (vfd->parent) | 323 | if (vfd->parent) |
327 | vfd->class_dev.parent = vfd->parent; | 324 | vfd->dev.parent = vfd->parent; |
328 | sprintf(vfd->class_dev.bus_id, "%s%d", name_base, i - base); | 325 | sprintf(vfd->dev.bus_id, "%s%d", name_base, i - base); |
329 | ret = device_register(&vfd->class_dev); | 326 | ret = device_register(&vfd->dev); |
330 | if (ret < 0) { | 327 | if (ret < 0) { |
331 | printk(KERN_ERR "%s: device_register failed\n", __func__); | 328 | printk(KERN_ERR "%s: device_register failed\n", __func__); |
332 | goto fail_minor; | 329 | goto fail_minor; |
@@ -365,7 +362,7 @@ void video_unregister_device(struct video_device *vfd) | |||
365 | panic("videodev: bad unregister"); | 362 | panic("videodev: bad unregister"); |
366 | 363 | ||
367 | video_device[vfd->minor] = NULL; | 364 | video_device[vfd->minor] = NULL; |
368 | device_unregister(&vfd->class_dev); | 365 | device_unregister(&vfd->dev); |
369 | mutex_unlock(&videodev_lock); | 366 | mutex_unlock(&videodev_lock); |
370 | } | 367 | } |
371 | EXPORT_SYMBOL(video_unregister_device); | 368 | EXPORT_SYMBOL(video_unregister_device); |