diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-07-17 18:45:00 +0200 |
---|---|---|
committer | Hans Verkuil <hverkuil@xs4all.nl> | 2008-07-17 18:45:00 +0200 |
commit | ad2b972483262f7b5865dbfc824303de2c82b3aa (patch) | |
tree | f57077fd117283d8bd03d1fa93e38fd08de14c82 /linux/include | |
parent | 7b7b6e145e1bf05cdf3e5d82e8f30b288ad9e15a (diff) | |
download | mediapointer-dvb-s2-ad2b972483262f7b5865dbfc824303de2c82b3aa.tar.gz mediapointer-dvb-s2-ad2b972483262f7b5865dbfc824303de2c82b3aa.tar.bz2 |
videodev: add support for kernels < 2.6.19
From: Hans Verkuil <hverkuil@xs4all.nl>
Add the necessary compatibility code to handle the struct device/struct class_device
differences.
It was too much work (with uncertain benefits) to convert several drivers
to handle kernels <2.6.19, so they are not built on these older kernels.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/include')
-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 */ |