--- ../../alsa-kernel/usb/usx2y/usbusx2y.c	2009-12-10 14:29:27.000000000 +0100
+++ usbusx2y.c	2010-01-20 11:06:09.000000000 +0100
@@ -1,3 +1,5 @@
+#include "usbusx2y.inc"
+
 /*
  * usbusy2y.c - ALSA USB US-428 Driver
  *
@@ -171,7 +173,11 @@ static void snd_usX2Y_card_private_free(
 /* 
  * pipe 4 is used for switching the lamps, setting samplerate, volumes ....   
  */
+#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER)
+static void i_usX2Y_Out04Int(struct urb *urb, struct pt_regs *regs)
+#else
 static void i_usX2Y_Out04Int(struct urb *urb)
+#endif
 {
 #ifdef CONFIG_SND_DEBUG
 	if (urb->status) {
@@ -183,7 +189,11 @@ static void i_usX2Y_Out04Int(struct urb
 #endif
 }
 
+#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER)
+static void i_usX2Y_In04Int(struct urb *urb, struct pt_regs *regs)
+#else
 static void i_usX2Y_In04Int(struct urb *urb)
+#endif
 {
 	int			err = 0;
 	struct usX2Ydev		*usX2Y = urb->context;
@@ -243,6 +253,9 @@ static void i_usX2Y_In04Int(struct urb *
 								  usb_sndbulkpipe(usX2Y->dev, 0x04), &p4out->val.vol,
 								  p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5,
 								  i_usX2Y_Out04Int, usX2Y);
+#ifdef OLD_USB
+						usX2Y->AS04.urb[j]->transfer_flags = USB_QUEUE_BULK;
+#endif
 						err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC);
 						us428ctls->p4outSent = send;
 						break;
@@ -253,8 +266,10 @@ static void i_usX2Y_In04Int(struct urb *
 	if (err)
 		snd_printk(KERN_ERR "In04Int() usb_submit_urb err=%i\n", err);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
 	urb->dev = usX2Y->dev;
 	usb_submit_urb(urb, GFP_ATOMIC);
+#endif
 }
 
 /*
@@ -297,6 +312,9 @@ int usX2Y_In04_init(struct usX2Ydev *usX
 			 usX2Y->In04Buf, 21,
 			 i_usX2Y_In04Int, usX2Y,
 			 10);
+#ifdef OLD_USB
+	usX2Y->In04urb->transfer_flags = USB_QUEUE_BULK;
+#endif
 	return usb_submit_urb(usX2Y->In04urb, GFP_KERNEL);
 }
 
@@ -358,8 +376,13 @@ static int usX2Y_create_card(struct usb_
 	sprintf(card->shortname, "TASCAM "NAME_ALLCAPS"");
 	sprintf(card->longname, "%s (%x:%x if %d at %03d/%03d)",
 		card->shortname, 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 		le16_to_cpu(device->descriptor.idVendor),
 		le16_to_cpu(device->descriptor.idProduct),
+#else
+		device->descriptor.idVendor,
+		device->descriptor.idProduct,
+#endif
 		0,//us428(card)->usbmidi.ifnum,
 		usX2Y(card)->dev->bus->busnum, usX2Y(card)->dev->devnum
 		);
@@ -377,10 +400,17 @@ static int usX2Y_usb_probe(struct usb_de
 	struct snd_card *	card;
 
 	*cardp = NULL;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 	if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 ||
 	    (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 &&
 	     le16_to_cpu(device->descriptor.idProduct) != USB_ID_US224 &&
 	     le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428))
+#else
+	if (device->descriptor.idVendor != 0x1604 ||
+	    (device->descriptor.idProduct != USB_ID_US122 &&
+	     device->descriptor.idProduct != USB_ID_US224 &&
+	     device->descriptor.idProduct != USB_ID_US428))
+#endif
 		return -EINVAL;
 
 	err = usX2Y_create_card(device, &card);
@@ -396,6 +426,7 @@ static int usX2Y_usb_probe(struct usb_de
 	return 0;
 }
 
+#ifndef OLD_USB
 /*
  * new 2.5 USB kernel API
  */
@@ -416,13 +447,35 @@ static void snd_usX2Y_disconnect(struct
 	usX2Y_usb_disconnect(interface_to_usbdev(intf),
 				 usb_get_intfdata(intf));
 }
+#else
+/*
+ * 2.4 USB kernel API
+ */
+static void *snd_usX2Y_probe(struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *id)
+{
+	struct snd_card *card;
+
+	return usX2Y_usb_probe(dev, usb_ifnum_to_if(dev, ifnum), id, &card);
+}
+                                       
+static void snd_usX2Y_disconnect(struct usb_device *dev, void *ptr)
+{
+	usX2Y_usb_disconnect(dev, ptr);
+}
+#endif
 
 MODULE_DEVICE_TABLE(usb, snd_usX2Y_usb_id_table);
 static struct usb_driver snd_usX2Y_usb_driver = {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 70) && LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)	/* FIXME: find right number */
+ 	.owner =	THIS_MODULE,
+#endif
 	.name =		"snd-usb-usx2y",
 	.probe =	snd_usX2Y_probe,
 	.disconnect =	snd_usX2Y_disconnect,
 	.id_table =	snd_usX2Y_usb_id_table,
+#ifdef OLD_USB
+	.driver_list =	LIST_HEAD_INIT(snd_usX2Y_usb_driver.driver_list), 
+#endif
 };
 
 static void snd_usX2Y_card_private_free(struct snd_card *card)
@@ -454,7 +507,11 @@ static void usX2Y_usb_disconnect(struct
 		}
 		if (usX2Y->us428ctls_sharedmem) 
 			wake_up(&usX2Y->us428ctls_wait_queue_head);
-		snd_card_free(card);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
+		snd_card_free(ptr);
+#else
+		snd_card_free_when_closed(ptr);
+#endif
 	}
 }
 
@@ -470,3 +527,5 @@ static void __exit snd_usX2Y_module_exit
 
 module_init(snd_usX2Y_module_init)
 module_exit(snd_usX2Y_module_exit)
+
+EXPORT_NO_SYMBOLS;
