diff options
Diffstat (limited to 'linux/drivers/media/video/usbvision/usbvision-core.c')
-rw-r--r-- | linux/drivers/media/video/usbvision/usbvision-core.c | 110 |
1 files changed, 2 insertions, 108 deletions
diff --git a/linux/drivers/media/video/usbvision/usbvision-core.c b/linux/drivers/media/video/usbvision/usbvision-core.c index ce9348a07..bf464540c 100644 --- a/linux/drivers/media/video/usbvision/usbvision-core.c +++ b/linux/drivers/media/video/usbvision/usbvision-core.c @@ -45,13 +45,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> @@ -174,40 +168,6 @@ static void usbvision_rvfree(void *mem, unsigned long size) vfree(mem); } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,24) -/* helper functions to access driver private data. */ -static inline void *video_get_drvdata(struct video_device *dev) -{ - return dev->priv; -} - -static inline void video_set_drvdata(struct video_device *dev, void *data) -{ - dev->priv = data; -} - -struct video_device *video_device_alloc(void) -{ - struct video_device *vfd; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) - vfd = kmalloc(sizeof(*vfd),GFP_KERNEL); - if (NULL == vfd) - return NULL; - memset(vfd,0,sizeof(*vfd)); -#else - vfd = kzalloc(sizeof(*vfd),GFP_KERNEL); - if (NULL == vfd) - return NULL; -#endif - return vfd; -} - -void video_device_release(struct video_device *vfd) -{ - kfree(vfd); -} -#endif - #if ENABLE_HEXDUMP static void usbvision_hexdump(const unsigned char *data, int len) @@ -1485,7 +1445,7 @@ static int usbvision_compress_isochronous(struct usb_usbvision *usbvision, return totlen; } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) || LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) static void usbvision_isocIrq(struct urb *urb) { #else @@ -1559,7 +1519,6 @@ static void usbvision_isocIrq(struct urb *urb, struct pt_regs *regs) urb->iso_frame_desc[i].actual_length = 0; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) urb->status = 0; urb->dev = usbvision->dev; errCode = usb_submit_urb (urb, GFP_ATOMIC); @@ -1568,7 +1527,6 @@ static void usbvision_isocIrq(struct urb *urb, struct pt_regs *regs) err("%s: usb_submit_urb failed: error %d", __func__, errCode); } -#endif return; } @@ -1632,7 +1590,7 @@ int usbvision_write_reg(struct usb_usbvision *usbvision, unsigned char reg, } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) || LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) static void usbvision_ctrlUrb_complete(struct urb *urb) #else static void usbvision_ctrlUrb_complete(struct urb *urb, struct pt_regs *regs) @@ -1662,19 +1620,11 @@ static int usbvision_write_reg_irq(struct usb_usbvision *usbvision,int address, } usbvision->ctrlUrbBusy = 1; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20) - usbvision->ctrlUrbSetup.requesttype = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT; - usbvision->ctrlUrbSetup.request = USBVISION_OP_CODE; - usbvision->ctrlUrbSetup.value = 0; - usbvision->ctrlUrbSetup.index = cpu_to_le16(address); - usbvision->ctrlUrbSetup.length = cpu_to_le16(len); -#else usbvision->ctrlUrbSetup.bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT; usbvision->ctrlUrbSetup.bRequest = USBVISION_OP_CODE; usbvision->ctrlUrbSetup.wValue = 0; usbvision->ctrlUrbSetup.wIndex = cpu_to_le16(address); usbvision->ctrlUrbSetup.wLength = cpu_to_le16(len); -#endif usb_fill_control_urb (usbvision->ctrlUrb, usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), (unsigned char *)&usbvision->ctrlUrbSetup, @@ -1684,11 +1634,7 @@ static int usbvision_write_reg_irq(struct usb_usbvision *usbvision,int address, memcpy(usbvision->ctrlUrbBuffer, data, len); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - errCode = usb_submit_urb(usbvision->ctrlUrb); -#else errCode = usb_submit_urb(usbvision->ctrlUrb, GFP_ATOMIC); -#endif if (errCode < 0) { // error in usb_submit_urb() usbvision->ctrlUrbBusy = 0; @@ -2385,18 +2331,12 @@ static void usbvision_powerOffTimer(unsigned long data) PDEBUG(DBG_FUNC, ""); del_timer(&usbvision->powerOffTimer); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - INIT_TQUEUE(&usbvision->powerOffTask, call_usbvision_power_off, usbvision); - (void) schedule_task(&usbvision->powerOffTask); -#else #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) INIT_WORK(&usbvision->powerOffWork, call_usbvision_power_off, usbvision); #else INIT_WORK(&usbvision->powerOffWork, call_usbvision_power_off); #endif (void) schedule_work(&usbvision->powerOffWork); -#endif - } void usbvision_init_powerOffTimer(struct usb_usbvision *usbvision) @@ -2568,11 +2508,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) int j, k; struct urb *urb; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - urb = usb_alloc_urb(USBVISION_URB_FRAMES); -#else urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL); -#endif if (urb == NULL) { err("%s: usb_alloc_urb() failed", __func__); return -ENOMEM; @@ -2586,12 +2522,8 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) urb->dev = dev; urb->context = usbvision; urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - urb->transfer_flags = USB_ISO_ASAP; -#else urb->transfer_flags = URB_ISO_ASAP; urb->interval = 1; -#endif urb->transfer_buffer = usbvision->sbuf[bufIdx].data; urb->complete = usbvision_isocIrq; urb->number_of_packets = USBVISION_URB_FRAMES; @@ -2605,28 +2537,10 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) } } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - /* Link URBs into a ring so that they invoke each other infinitely */ - for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { - if ((bufIdx + 1) < USBVISION_NUMSBUF) { - usbvision->sbuf[bufIdx].urb->next = - usbvision->sbuf[bufIdx + 1].urb; - } - else { - usbvision->sbuf[bufIdx].urb->next = - usbvision->sbuf[0].urb; - } - } -#endif - /* Submit all URBs */ for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) - errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb); - #else errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb, GFP_KERNEL); - #endif if (errCode) { err("%s: usb_submit_urb(%d) failed: error %d", __func__, bufIdx, errCode); @@ -2656,7 +2570,6 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) return; /* Unschedule all of the iso td's */ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9) for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { usb_kill_urb(usbvision->sbuf[bufIdx].urb); if (usbvision->sbuf[bufIdx].data){ @@ -2668,25 +2581,6 @@ void usbvision_stop_isoc(struct usb_usbvision *usbvision) usb_free_urb(usbvision->sbuf[bufIdx].urb); usbvision->sbuf[bufIdx].urb = NULL; } -#else - for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { - errCode = usb_unlink_urb(usbvision->sbuf[bufIdx].urb); - if (errCode < 0) - err("%s: usb_unlink_urb() failed: error %d", - __func__, errCode); - } - - if (usbvision->sbuf[bufIdx].data){ - usb_buffer_free(usbvision->dev, - sb_size, - usbvision->sbuf[bufIdx].data, - usbvision->sbuf[bufIdx].urb->transfer_dma); - } - /* Delete them all */ - for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) - usb_free_urb(usbvision->sbuf[bufIdx].urb); -#endif - PDEBUG(DBG_ISOC, "%s: streaming=Stream_Off\n", __func__); usbvision->streaming = Stream_Off; |