--- ../../alsa-kernel/usb/usx2y/usX2Yhwdep.c	2005-03-22 23:57:30.000000000 +0100
+++ usX2Yhwdep.c	2005-03-23 23:50:12.000000000 +0100
@@ -1,3 +1,14 @@
+#include <linux/config.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
+#define SND_NEED_USB_SET_INTERFACE
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+#define SND_NEED_USB_WRAPPER
+#endif
+#define __NO_VERSION__
+#endif
+
 /*
  * Driver for Tascam US-X2Y USB soundcards
  *
@@ -34,7 +45,13 @@
 int usX2Y_hwdep_pcm_new(snd_card_t* card);
 
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
 static struct page * snd_us428ctls_vm_nopage(struct vm_area_struct *area, unsigned long address, int *type)
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0)
+static struct page * snd_us428ctls_vm_nopage(struct vm_area_struct *area, unsigned long address, int no_share)
+#else
+static unsigned long snd_us428ctls_vm_nopage(struct vm_area_struct *area, unsigned long address, int no_share)
+#endif
 {
 	unsigned long offset;
 	struct page * page;
@@ -46,7 +63,11 @@
 		   (address - area->vm_start) >> PAGE_SHIFT,
 		   address);
 	
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 25)
 	offset = area->vm_pgoff << PAGE_SHIFT;
+#else
+	offset = area->vm_offset;
+#endif
 	offset += address - area->vm_start;
 	snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM);
 	vaddr = (char*)((usX2Ydev_t*)area->vm_private_data)->us428ctls_sharedmem + offset;
@@ -54,10 +75,20 @@
 	get_page(page);
 	snd_printdd( "vaddr=%p made us428ctls_vm_nopage() return %p; offset=%lX\n", vaddr, page, offset);
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
 	if (type)
 		*type = VM_FAULT_MINOR;
+#endif
 
+#ifndef LINUX_2_2
 	return page;
+#else
+	/* why 2.2's kcomp.h redefines this? */
+#ifdef page_address
+#undef page_address
+#endif
+	return page_address(page);
+#endif
 }
 
 static struct vm_operations_struct us428ctls_vm_ops = {
@@ -88,8 +119,14 @@
 		us428->us428ctls_sharedmem->CtlSnapShotLast = -2;
 	}
 	area->vm_ops = &us428ctls_vm_ops;
+#ifdef VM_RESERVED
 	area->vm_flags |= VM_RESERVED;
+#endif
+#ifndef LINUX_2_2
 	area->vm_private_data = hw->private_data;
+#else
+	area->vm_private_data = (long)hw->private_data;
+#endif
 	return 0;
 }
 
@@ -129,7 +166,11 @@
 	};
 	int id = -1;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 	switch (le16_to_cpu(((usX2Ydev_t*)hw->private_data)->chip.dev->descriptor.idProduct)) {
+#else
+	switch (((usX2Ydev_t*)hw->private_data)->chip.dev->descriptor.idProduct) {
+#endif
 	case USB_ID_US122:
 		id = USX2Y_TYPE_122;
 		break;
@@ -181,7 +222,11 @@
 	};
 	struct usb_device *dev = usX2Y(card)->chip.dev;
 	struct usb_interface *iface = usb_ifnum_to_if(dev, 0);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 	snd_usb_audio_quirk_t *quirk = le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ? &quirk_2 : &quirk_1;
+#else
+	snd_usb_audio_quirk_t *quirk = dev->descriptor.idProduct == USB_ID_US428 ? &quirk_2 : &quirk_1;
+#endif
 
 	snd_printdd("usX2Y_create_usbmidi \n");
 	return snd_usb_create_midi_interface(&usX2Y(card)->chip, iface, quirk);
@@ -226,7 +271,11 @@
 		if (err)
 			snd_printk("usb_set_interface error \n");
 		else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 12)
 			err = usb_bulk_msg(dev, usb_sndbulkpipe(dev, 2), buf, dsp->length, &lret, 6000);
+#else
+			err = usb_bulk_msg(dev, usb_sndbulkpipe(dev, 2), buf, dsp->length, &lret, 6 * HZ);
+#endif
 		kfree(buf);
 	}
 	if (err)
