diff options
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 58a9a4f4f..5afc92b0c 100644 --- a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c @@ -29,6 +29,7 @@ #include <linux/pci.h> #include "dvb_functions.h" +#include "dvb_compat.h" /* TTUSB_HWSECTIONS: @@ -728,8 +729,13 @@ void ttusb_process_frame(struct ttusb *ttusb, u8 *data, int len) } } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) static void ttusb_iso_irq (struct urb *urb) +#else +static +void ttusb_iso_irq (struct urb *urb, struct pt_regs *ptregs) +#endif { struct ttusb *ttusb = urb->context; @@ -745,7 +751,7 @@ void ttusb_iso_irq (struct urb *urb) if (! urb->status) { int i; for (i=0; i < urb->number_of_packets; ++i) { - struct iso_packet_descriptor *d; + struct usb_iso_packet_descriptor *d; u8 *data; int len; numpkt++; @@ -768,6 +774,10 @@ void ttusb_iso_irq (struct urb *urb) ttusb_process_frame(ttusb, data, len); } } + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) + usb_submit_urb(urb URB_MEM_FLAG); +#endif } @@ -800,7 +810,7 @@ int ttusb_alloc_iso_urbs (struct ttusb *ttusb) for (i=0; i<ISO_BUF_COUNT; i++) { struct urb *urb; - if (!(urb = usb_alloc_urb (FRAMES_PER_ISO_BUF))) { + if (!(urb = usb_alloc_urb (FRAMES_PER_ISO_BUF URB_MEM_FLAG))) { ttusb_free_iso_urbs (ttusb); return -ENOMEM; } @@ -846,7 +856,7 @@ int ttusb_start_iso_xfer (struct ttusb *ttusb) urb->context = ttusb; urb->complete = ttusb_iso_irq; urb->pipe = ttusb->isoc_in_pipe; - urb->transfer_flags = USB_ISO_ASAP; + urb->transfer_flags = URB_ISO_ASAP; urb->number_of_packets = FRAMES_PER_ISO_BUF; urb->transfer_buffer_length = ISO_FRAME_SIZE * FRAMES_PER_ISO_BUF; urb->transfer_buffer = ttusb->iso_buffer + buffer_offset; @@ -859,13 +869,15 @@ int ttusb_start_iso_xfer (struct ttusb *ttusb) } } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) for (i=0; i<ISO_BUF_COUNT; i++) { int next = (i + 1) % ISO_BUF_COUNT; - ttusb->iso_urb[i]->next = ttusb->iso_urb[next]; + ttusb->iso_urb[i]->next = ttusb->iso_urb[next]; } +#endif for (i=0; i<ISO_BUF_COUNT; i++) { - if ((err = usb_submit_urb (ttusb->iso_urb[i]))) { + if ((err = usb_submit_urb (ttusb->iso_urb[i] URB_MEM_FLAG))) { ttusb_stop_iso_xfer (ttusb); printk ("%s: failed urb submission (%i: err = %i)!\n", __FUNCTION__, i, err); @@ -1059,6 +1071,7 @@ struct file_operations stc_fops = { }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) static void* ttusb_probe (struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id) @@ -1073,7 +1086,24 @@ void* ttusb_probe (struct usb_device *udev, unsigned int ifnum, if (!(ttusb = kmalloc (sizeof (struct ttusb), GFP_KERNEL))) return NULL; - + +#else +static +int ttusb_probe (struct usb_interface *intf, + const struct usb_device_id *id) +{ + struct usb_device *udev; + struct ttusb *ttusb; + int result, channel; + + dprintk ("%s: TTUSB DVB connected\n", __FUNCTION__); + + udev = interface_to_usbdev(intf); + + if (!(ttusb = kmalloc (sizeof (struct ttusb), GFP_KERNEL))) + return -ENOMEM; + +#endif // MOD_INC_USE_COUNT; @@ -1147,14 +1177,29 @@ err: S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, &stc_fops, ttusb); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) return (void*) ttusb; +#else + usb_set_intfdata(intf, (void *)ttusb); + + return 0; +#endif } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) static void ttusb_disconnect (struct usb_device *udev, void *data) { struct ttusb *ttusb = data; +#else +static +void ttusb_disconnect (struct usb_interface *intf) +{ + struct ttusb *ttusb = usb_get_intfdata(intf); + + usb_set_intfdata(intf, NULL); +#endif ttusb->disconnecting = 1; |