diff options
Diffstat (limited to 'linux/drivers/media/video/usbvision/usbvision-video.c')
-rw-r--r-- | linux/drivers/media/video/usbvision/usbvision-video.c | 183 |
1 files changed, 1 insertions, 182 deletions
diff --git a/linux/drivers/media/video/usbvision/usbvision-video.c b/linux/drivers/media/video/usbvision/usbvision-video.c index 55b3f5e60..073d30454 100644 --- a/linux/drivers/media/video/usbvision/usbvision-video.c +++ b/linux/drivers/media/video/usbvision/usbvision-video.c @@ -68,13 +68,7 @@ #include <media/tuner.h> #include <media/audiochip.h> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -#include <linux/proc_fs.h> -#include <linux/tqueue.h> -#include <linux/wrapper.h> -#else #include <linux/workqueue.h> -#endif #ifdef CONFIG_KMOD #include <linux/kmod.h> @@ -173,10 +167,8 @@ MODULE_PARM_DESC(vbi_nr, "Set vbi device number (/dev/vbiX). Default: -1 (autod MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE(DRIVER_LICENSE); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) MODULE_VERSION(USBVISION_VERSION_STRING); MODULE_ALIAS(DRIVER_ALIAS); -#endif /*****************************************************************************/ @@ -187,8 +179,6 @@ MODULE_ALIAS(DRIVER_ALIAS); /* /sys/bus/usb/drivers/USBVision Video Grabber */ /*****************************************************************************/ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) - #define YES_NO(x) ((x) ? "Yes" : "No") static inline struct usb_usbvision *cd_to_usbvision(struct device *cd) @@ -379,8 +369,6 @@ static void usbvision_remove_sysfs(struct video_device *vdev) } } -#endif - /* * usbvision_open() * @@ -389,25 +377,15 @@ static void usbvision_remove_sysfs(struct video_device *vdev) * then allocates buffers needed for video processing. * */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) -static int usbvision_v4l2_open(struct video_device *dev, int flags) -{ - struct usb_usbvision *usbvision = (struct usb_usbvision *) dev; -#else static int usbvision_v4l2_open(struct inode *inode, struct file *file) { struct video_device *dev = video_devdata(file); struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); -#endif int errCode = 0; PDEBUG(DBG_IO, "open"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - MOD_INC_USE_COUNT; -#endif - usbvision_reset_powerOffTimer(usbvision); if (usbvision->user) @@ -461,12 +439,6 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file) mutex_unlock(&usbvision->lock); } - if (errCode) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - MOD_DEC_USE_COUNT; -#endif - } - /* prepare queues */ usbvision_empty_framequeues(usbvision); @@ -482,17 +454,11 @@ static int usbvision_v4l2_open(struct inode *inode, struct file *file) * allocated in usbvision_v4l2_open(). * */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) -static void usbvision_v4l2_close(struct video_device *dev) -{ - struct usb_usbvision *usbvision = (struct usb_usbvision *) dev; -#else static int usbvision_v4l2_close(struct inode *inode, struct file *file) { struct video_device *dev = video_devdata(file); struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); -#endif PDEBUG(DBG_IO, "close"); mutex_lock(&usbvision->lock); @@ -523,14 +489,7 @@ static int usbvision_v4l2_close(struct inode *inode, struct file *file) } PDEBUG(DBG_IO, "success"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - MOD_DEC_USE_COUNT; -#endif - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19) return 0; -#endif } @@ -1123,12 +1082,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, return 0; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) -static long usbvision_v4l2_read(struct video_device *dev, char *buf, - unsigned long count, int noblock) -{ - struct usb_usbvision *usbvision = (struct usb_usbvision *) dev; -#else static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { @@ -1136,7 +1089,6 @@ static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf, struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); int noblock = file->f_flags & O_NONBLOCK; -#endif unsigned long lock_flags; int ret,i; @@ -1302,24 +1254,15 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma) * Here comes the stuff for radio on usbvision based devices * */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) -static int usbvision_radio_open(struct video_device *dev, int flags) -{ - struct usb_usbvision *usbvision = (struct usb_usbvision *)dev->priv; -#else static int usbvision_radio_open(struct inode *inode, struct file *file) { struct video_device *dev = video_devdata(file); struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); -#endif int errCode = 0; PDEBUG(DBG_IO, "%s:", __func__); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - MOD_INC_USE_COUNT; -#endif mutex_lock(&usbvision->lock); if (usbvision->user) { @@ -1351,9 +1294,6 @@ static int usbvision_radio_open(struct inode *inode, struct file *file) } if (errCode) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - MOD_DEC_USE_COUNT; -#endif if (PowerOnAtOpen) { usbvision_i2c_unregister(usbvision); usbvision_power_off(usbvision); @@ -1366,18 +1306,12 @@ out: } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) -static void usbvision_radio_close(struct video_device *dev) -{ - struct usb_usbvision *usbvision = (struct usb_usbvision *)dev->priv; -#else static int usbvision_radio_close(struct inode *inode, struct file *file) { struct video_device *dev = video_devdata(file); struct usb_usbvision *usbvision = (struct usb_usbvision *) video_get_drvdata(dev); int errCode = 0; -#endif PDEBUG(DBG_IO, ""); @@ -1404,42 +1338,22 @@ static int usbvision_radio_close(struct inode *inode, struct file *file) usbvision_release(usbvision); } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - MOD_DEC_USE_COUNT; -#endif - PDEBUG(DBG_IO, "success"); - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19) return errCode; -#endif } /* * Here comes the stuff for vbi on usbvision based devices * */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) -static int usbvision_vbi_open(struct video_device *dev, int flags) -{ - struct usb_usbvision *usbvision = (struct usb_usbvision *)dev->priv; -#else static int usbvision_vbi_open(struct inode *inode, struct file *file) { -#endif /* TODO */ return -ENODEV; - } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) -static void usbvision_vbi_close(struct video_device *dev) -{ - struct usb_usbvision *usbvision = (struct usb_usbvision *)dev->priv; -#else static int usbvision_vbi_close(struct inode *inode, struct file *file) { -#endif /* TODO */ return -ENODEV; } @@ -1463,21 +1377,8 @@ static int usbvision_vbi_ioctl(struct inode *inode, struct file *file, // // Video template -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) -static struct video_device usbvision_video_template = { - .type = VID_TYPE_TUNER | VID_TYPE_CAPTURE, - .open = usbvision_v4l2_open, - .close = usbvision_v4l2_close, - .read = usbvision_v4l2_read, - .mmap = usbvision_v4l2_mmap, - .ioctl = video_ioctl2, - .minor = -1, -}; -#else static const struct file_operations usbvision_fops = { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,31) .owner = THIS_MODULE, -#endif .open = usbvision_v4l2_open, .release = usbvision_v4l2_close, .read = usbvision_v4l2_read, @@ -1485,20 +1386,14 @@ static const struct file_operations usbvision_fops = { .ioctl = video_ioctl2, .llseek = no_llseek, /* .poll = video_poll, */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) .compat_ioctl = v4l_compat_ioctl32, -#endif }; static struct video_device usbvision_video_template = { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,31) .owner = THIS_MODULE, -#endif .type = VID_TYPE_TUNER | VID_TYPE_CAPTURE, .fops = &usbvision_fops, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) .name = "usbvision-video", .release = video_device_release, -#endif .minor = -1, .vidioc_querycap = vidioc_querycap, .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, @@ -1534,44 +1429,25 @@ static struct video_device usbvision_video_template = { .tvnorms = USBVISION_NORMS, .current_norm = V4L2_STD_PAL }; -#endif // Radio template -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) -static struct video_device usbvision_radio_template= -{ - .type = VID_TYPE_TUNER, - .open = usbvision_radio_open, - .close = usbvision_radio_close, - .ioctl = video_ioctl2, - .minor -1, -}; -#else static const struct file_operations usbvision_radio_fops = { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,31) .owner = THIS_MODULE, -#endif .open = usbvision_radio_open, .release = usbvision_radio_close, .ioctl = video_ioctl2, .llseek = no_llseek, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) .compat_ioctl = v4l_compat_ioctl32, -#endif }; static struct video_device usbvision_radio_template= { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,31) .owner = THIS_MODULE, -#endif .type = VID_TYPE_TUNER, .fops = &usbvision_radio_fops, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) .name = "usbvision-radio", .release = video_device_release, -#endif .minor = -1, .vidioc_querycap = vidioc_querycap, .vidioc_enum_input = vidioc_enum_input, @@ -1590,46 +1466,26 @@ static struct video_device usbvision_radio_template= .tvnorms = USBVISION_NORMS, .current_norm = V4L2_STD_PAL }; -#endif // vbi template -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,19) -static struct video_device usbvision_vbi_template= -{ - type: VID_TYPE_TELETEXT, - open: usbvision_vbi_open, - close: usbvision_vbi_close, - ioctl: usbvision_vbi_ioctl, - minor: -1, -}; -#else static const struct file_operations usbvision_vbi_fops = { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,31) .owner = THIS_MODULE, -#endif .open = usbvision_vbi_open, .release = usbvision_vbi_close, .ioctl = usbvision_vbi_ioctl, .llseek = no_llseek, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) .compat_ioctl = v4l_compat_ioctl32, -#endif }; static struct video_device usbvision_vbi_template= { -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,31) .owner = THIS_MODULE, -#endif .type = VID_TYPE_TUNER, .fops = &usbvision_vbi_fops, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) .release = video_device_release, .name = "usbvision-vbi", -#endif .minor = -1, }; -#endif static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision, @@ -1650,9 +1506,7 @@ static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision, } *vdev = *vdev_template; // vdev->minor = -1; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) vdev->dev = &usb_dev->dev; -#endif snprintf(vdev->name, sizeof(vdev->name), "%s", name); video_set_drvdata(vdev, usbvision); return vdev; @@ -1667,9 +1521,6 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) usbvision->vbi->minor & 0x1f); if (usbvision->vbi->minor != -1) { video_unregister_device(usbvision->vbi); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - video_device_release(usbvision->vbi); -#endif } else { video_device_release(usbvision->vbi); } @@ -1682,9 +1533,6 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) usbvision->rdev->minor & 0x1f); if (usbvision->rdev->minor != -1) { video_unregister_device(usbvision->rdev); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - video_device_release(usbvision->rdev); -#endif } else { video_device_release(usbvision->rdev); } @@ -1697,9 +1545,6 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) usbvision->vdev->minor & 0x1f); if (usbvision->vdev->minor != -1) { video_unregister_device(usbvision->vdev); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - video_device_release(usbvision->vdev); -#endif } else { video_device_release(usbvision->vdev); } @@ -1799,11 +1644,7 @@ static struct usb_usbvision *usbvision_alloc(struct usb_device *dev) mutex_init(&usbvision->lock); /* available */ // prepare control urb for control messages during interrupts -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - usbvision->ctrlUrb = usb_alloc_urb(USBVISION_URB_FRAMES); -#else usbvision->ctrlUrb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL); -#endif if (usbvision->ctrlUrb == NULL) { goto err_exit; } @@ -2006,12 +1847,7 @@ static int __devinit usbvision_probe(struct usb_interface *intf, usbvision_create_sysfs(usbvision->vdev); PDEBUG(DBG_PROBE, "success"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - MOD_DEC_USE_COUNT; - return usbvision; -#else return 0; -#endif } @@ -2023,15 +1859,9 @@ static int __devinit usbvision_probe(struct usb_interface *intf, * with no ill consequences. * */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) -static void usbvision_disconnect(struct usb_device *dev, void *ptr) -{ - struct usb_usbvision *usbvision = (struct usb_usbvision *) ptr; -#else static void __devexit usbvision_disconnect(struct usb_interface *intf) { struct usb_usbvision *usbvision = usb_get_intfdata(intf); -#endif PDEBUG(DBG_PROBE, ""); @@ -2039,11 +1869,7 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf) err("%s: usb_get_intfdata() failed", __func__); return; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - MOD_INC_USE_COUNT; -#else usb_set_intfdata (intf, NULL); -#endif mutex_lock(&usbvision->lock); @@ -2056,9 +1882,7 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf) } usbvision->remove_pending = 1; // Now all ISO data will be ignored -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) usb_put_dev(usbvision->dev); -#endif usbvision->dev = NULL; // USB device is no more mutex_unlock(&usbvision->lock); @@ -2073,15 +1897,10 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf) } PDEBUG(DBG_PROBE, "success"); - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - MOD_DEC_USE_COUNT; -#endif } static struct usb_driver usbvision_driver = { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,31)) && \ - (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16) .owner = THIS_MODULE, #endif .name = "usbvision", |