diff options
Diffstat (limited to 'linux/include/media/v4l2-dev.h')
-rw-r--r-- | linux/include/media/v4l2-dev.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/linux/include/media/v4l2-dev.h b/linux/include/media/v4l2-dev.h index 2d68db550..798622258 100644 --- a/linux/include/media/v4l2-dev.h +++ b/linux/include/media/v4l2-dev.h @@ -88,7 +88,11 @@ struct video_device const struct file_operations *fops; /* sysfs */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) struct device class_dev; /* v4l device */ +#else + struct class_device class_dev; +#endif struct device *dev; /* device parent */ /* device info */ @@ -379,13 +383,30 @@ extern int video_usercopy(struct inode *inode, struct file *file, #ifdef CONFIG_VIDEO_V4L1_COMPAT #include <linux/mm.h> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) +static inline int __must_check +video_device_create_file(struct video_device *vfd, + struct class_device_attribute *attr) +{ + int ret = class_device_create_file(&vfd->class_dev, attr); + if (ret < 0) + printk(KERN_WARNING "%s error: %d\n", __func__, ret); + return ret; +} +static inline void +video_device_remove_file(struct video_device *vfd, + struct class_device_attribute *attr) +{ + class_device_remove_file(&vfd->class_dev, attr); +} +#else static inline int __must_check video_device_create_file(struct video_device *vfd, struct device_attribute *attr) { int ret = device_create_file(&vfd->class_dev, attr); if (ret < 0) - printk(KERN_WARNING "%s error: %d\n", __FUNCTION__, ret); + printk(KERN_WARNING "%s error: %d\n", __func__, ret); return ret; } static inline void @@ -394,6 +415,7 @@ video_device_remove_file(struct video_device *vfd, { device_remove_file(&vfd->class_dev, attr); } +#endif #endif /* CONFIG_VIDEO_V4L1_COMPAT */ |