From 789d51c810626c90641912d4d260295be0b57d87 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 8 Oct 2007 16:26:13 -0300 Subject: V4L: convert struct class_device to struct device From: Kay Sievers The currently used "struct class_device" will be removed from the kernel. Here is a patch that converts all users in drivers/media/video/ to struct device. Reviewed-by: Thierry Merle Reviewed-by: Mike Isely Reviewed-by: Luca Risolia Signed-off-by: Kay Sievers --- linux/include/media/v4l2-dev.h | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'linux/include') diff --git a/linux/include/media/v4l2-dev.h b/linux/include/media/v4l2-dev.h index 45dfc7a04..1b19da01c 100644 --- a/linux/include/media/v4l2-dev.h +++ b/linux/include/media/v4l2-dev.h @@ -96,10 +96,17 @@ struct video_device struct file_operations *fops; #endif - /* device info */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - struct device *dev; + /* sysfs */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) + struct device class_dev; /* v4l device */ +#else + struct class_device class_dev; #endif + struct device *dev; /* device parent */ +#endif + + /* device info */ char name[32]; int type; /* v4l1 */ int type2; /* v4l2 */ @@ -358,9 +365,6 @@ void *priv; #else struct semaphore lock; /* ... helper function uses these */ #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - struct class_device class_dev; /* sysfs */ -#endif }; /* Class-dev to video-device */ @@ -383,25 +387,29 @@ extern int video_usercopy(struct inode *inode, struct file *file, int (*func)(struct inode *inode, struct file *file, unsigned int cmd, void *arg)); - #ifdef CONFIG_VIDEO_V4L1_COMPAT #include -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) static inline int __must_check +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) video_device_create_file(struct video_device *vfd, struct class_device_attribute *attr) +#else +video_device_create_file(struct video_device *vfd, + struct device_attribute *attr) +#endif { - int ret = class_device_create_file(&vfd->class_dev, attr); + int ret = device_create_file(&vfd->class_dev, attr); if (ret < 0) printk(KERN_WARNING "%s error: %d\n", __FUNCTION__, ret); return ret; } static inline void video_device_remove_file(struct video_device *vfd, - struct class_device_attribute *attr) + struct device_attribute *attr) { - class_device_remove_file(&vfd->class_dev, attr); + device_remove_file(&vfd->class_dev, attr); } #endif -- cgit v1.2.3