--- ../alsa-kernel/usb/usbaudio.c	2005-04-29 23:54:04.000000000 +0200
+++ usbaudio.c	2005-04-29 23:56:20.000000000 +0200
@@ -1,3 +1,4 @@
+#include "usbaudio.inc"
 /*
  *   (Tentative) USB Audio Driver for ALSA
  *
@@ -67,7 +68,12 @@
 static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; /* Vendor ID for this card */
 static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; /* Product ID for this card */
 static int nrpacks = 4;		/* max. number of packets per urb */
-static int async_unlink = 1;
+static int async_unlink =
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
+1;
+#else
+0; /* disabled as default for buggy async-unlink handling */
+#endif
 
 module_param_array(index, int, NULL, 0444);
 MODULE_PARM_DESC(index, "Index value for the USB audio adapter.");
@@ -1902,8 +1908,13 @@
 			return -ENOMEM;
 		memcpy(buf, data, size);
 	}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12)
 	err = usb_control_msg(dev, pipe, request, requesttype,
 			      value, index, buf, size, timeout);
+#else
+	err = usb_control_msg(dev, pipe, request, requesttype,
+			      value, index, buf, size, timeout * HZ / 1000);
+#endif
 	if (size > 0) {
 		memcpy(data, buf, size);
 		kfree(buf);
@@ -1916,9 +1927,11 @@
  * entry point for linux usb interface
  */
 
+#ifndef OLD_USB
 static int usb_audio_probe(struct usb_interface *intf,
 			   const struct usb_device_id *id);
 static void usb_audio_disconnect(struct usb_interface *intf);
+#endif
 
 static struct usb_device_id usb_audio_ids [] = {
 #include "usbquirks.h"
@@ -1931,10 +1944,15 @@
 MODULE_DEVICE_TABLE (usb, usb_audio_ids);
 
 static struct usb_driver usb_audio_driver = {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 70)	/* FIXME: find right number */
 	.owner =	THIS_MODULE,
+#endif
 	.name =		"snd-usb-audio",
 	.probe =	usb_audio_probe,
 	.disconnect =	usb_audio_disconnect,
+#ifdef OLD_USB
+	.driver_list =	LIST_HEAD_INIT(usb_audio_driver.driver_list), 
+#endif
 	.id_table =	usb_audio_ids,
 };
 
@@ -2460,7 +2478,11 @@
 		    (altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIO_STREAMING &&
 		     altsd->bInterfaceSubClass != USB_SUBCLASS_VENDOR_SPEC) ||
 		    altsd->bNumEndpoints < 1 ||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 		    le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) == 0)
+#else
+		    get_endpoint(alts, 0)->wMaxPacketSize == 0)
+#endif
 			continue;
 		/* must be isochronous */
 		if ((get_endpoint(alts, 0)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) !=
@@ -2523,7 +2545,11 @@
 		fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress;
 		fp->ep_attr = get_endpoint(alts, 0)->bmAttributes;
 		/* FIXME: decode wMaxPacketSize of high bandwith endpoints */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 		fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
+#else
+		fp->maxpacksize = get_endpoint(alts, 0)->wMaxPacketSize;
+#endif
 		fp->attributes = csep[3];
 
 		/* some quirks for attributes here */
@@ -2811,7 +2837,11 @@
 	fp->iface = altsd->bInterfaceNumber;
 	fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress;
 	fp->ep_attr = get_endpoint(alts, 0)->bmAttributes;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 	fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
+#else
+	fp->maxpacksize = get_endpoint(alts, 0)->wMaxPacketSize;
+#endif
 
 	switch (fp->maxpacksize) {
 	case 0x120:
@@ -2877,7 +2907,11 @@
 	fp->iface = altsd->bInterfaceNumber;
 	fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress;
 	fp->ep_attr = get_endpoint(alts, 0)->bmAttributes;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 	fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
+#else
+	fp->maxpacksize = get_endpoint(alts, 0)->wMaxPacketSize;
+#endif
 	fp->rate_max = fp->rate_min = combine_triple(&alts->extra[8]);
 
 	stream = (fp->endpoint & USB_DIR_IN)
@@ -2935,8 +2969,13 @@
 	struct usb_host_config *config = dev->actconfig;
 	int err;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 	if (le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_OLD ||
 	    le16_to_cpu(get_cfg_desc(config)->wTotalLength) == EXTIGY_FIRMWARE_SIZE_NEW) {
+#else
+	if (get_cfg_desc(config)->wTotalLength == EXTIGY_FIRMWARE_SIZE_OLD ||
+	    get_cfg_desc(config)->wTotalLength == EXTIGY_FIRMWARE_SIZE_NEW) {
+#endif
 		snd_printdd("sending Extigy boot sequence...\n");
 		/* Send message to force it to reconnect with full interface. */
 		err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev,0),
@@ -2948,8 +2987,13 @@
 		if (err < 0) snd_printdd("error usb_get_descriptor: %d\n", err);
 		err = usb_reset_configuration(dev);
 		if (err < 0) snd_printdd("error usb_reset_configuration: %d\n", err);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 		snd_printdd("extigy_boot: new boot length = %d\n",
 			    le16_to_cpu(get_cfg_desc(config)->wTotalLength));
+#else
+		snd_printdd("extigy_boot: new boot length = %d\n",
+			    get_cfg_desc(config)->wTotalLength);
+#endif
 		return -ENODEV; /* quit this anyway */
 	}
 	return 0;
@@ -3082,8 +3126,13 @@
 	chip->index = idx;
 	chip->dev = dev;
 	chip->card = card;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 	chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
 			      le16_to_cpu(dev->descriptor.idProduct));
+#else
+	chip->usb_id = USB_ID(dev->descriptor.idVendor,
+			      dev->descriptor.idProduct);
+#endif
 	INIT_LIST_HEAD(&chip->pcm_list);
 	INIT_LIST_HEAD(&chip->midi_list);
 	INIT_LIST_HEAD(&chip->mixer_list);
@@ -3171,8 +3220,12 @@
 
 	alts = &intf->altsetting[0];
 	ifnum = get_iface_desc(alts)->bInterfaceNumber;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 	id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
 		    le16_to_cpu(dev->descriptor.idProduct));
+#else
+	id = USB_ID(dev->descriptor.idVendor, dev->descriptor.idProduct);
+#endif
 
 	if (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum)
 		goto __err_val;
@@ -3293,12 +3346,17 @@
 		}
 		usb_chip[chip->index] = NULL;
 		up(&register_mutex);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
 		snd_card_free(card);
+#else
+		snd_card_free_in_thread(card);
+#endif
 	} else {
 		up(&register_mutex);
 	}
 }
 
+#ifndef OLD_USB
 /*
  * new 2.5 USB kernel API
  */
@@ -3319,6 +3377,8 @@
 	snd_usb_audio_disconnect(interface_to_usbdev(intf),
 				 dev_get_drvdata(&intf->dev));
 }
+#endif
+
 
 
 static int __init snd_usb_audio_init(void)
@@ -3339,3 +3399,5 @@
 
 module_init(snd_usb_audio_init);
 module_exit(snd_usb_audio_cleanup);
+
+#include "usbaudio.inc1"
