--- ../../alsa-kernel/usb/usx2y/usX2Yhwdep.c	2008-08-06 18:04:33.000000000 +0200
+++ usX2Yhwdep.c	2008-08-08 15:31:06.000000000 +0200
@@ -1,3 +1,20 @@
+#include "config.h"
+#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
+#include <linux/autoconf.h>
+#else
+#include <linux/config.h>
+#endif
+#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
+#include "adriver.h"
+
 /*
  * Driver for Tascam US-X2Y USB soundcards
  *
@@ -33,6 +50,7 @@
 int usX2Y_hwdep_pcm_new(struct snd_card *card);
 
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
 static int snd_us428ctls_vm_fault(struct vm_area_struct *area,
 				  struct vm_fault *vmf)
 {
@@ -55,9 +73,61 @@
 
 	return 0;
 }
+#else /* 2.6.24 */
+#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;
+	void *vaddr;
+
+	snd_printdd("ENTER, start %lXh, ofs %lXh, pgoff %ld, addr %lXh\n",
+		   area->vm_start,
+		   address - area->vm_start,
+		   (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;
+	if (snd_BUG_ON(offset % PAGE_SIZE))
+		return NOPAGE_SIGBUS;
+	vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->us428ctls_sharedmem + offset;
+	page = virt_to_page(vaddr);
+	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
+}
+#endif /* >= 2.6.24 */
 
 static struct vm_operations_struct us428ctls_vm_ops = {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
 	.fault = snd_us428ctls_vm_fault,
+#else
+	.nopage = snd_us428ctls_vm_nopage,
+#endif
 };
 
 static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct vm_area_struct *area)
@@ -84,8 +154,14 @@
 		us428->us428ctls_sharedmem->CtlSnapShotLast = -2;
 	}
 	area->vm_ops = &us428ctls_vm_ops;
+#ifdef VM_RESERVED
 	area->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
+#endif
+#ifndef LINUX_2_2
 	area->vm_private_data = hw->private_data;
+#else
+	area->vm_private_data = (long)hw->private_data;
+#endif
 	return 0;
 }
 
@@ -127,7 +203,11 @@
 	struct usX2Ydev	*us428 = hw->private_data;
 	int id = -1;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 	switch (le16_to_cpu(us428->chip.dev->descriptor.idProduct)) {
+#else
+	switch (((struct usX2Ydev*)hw->private_data)->chip.dev->descriptor.idProduct) {
+#endif
 	case USB_ID_US122:
 		id = USX2Y_TYPE_122;
 		break;
@@ -179,9 +259,15 @@
 	};
 	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)
 	struct snd_usb_audio_quirk *quirk =
 		le16_to_cpu(dev->descriptor.idProduct) == USB_ID_US428 ?
 		&quirk_2 : &quirk_1;
+#else
+	struct snd_usb_audio_quirk *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);
@@ -227,7 +313,11 @@
 		if (err)
 			snd_printk(KERN_ERR "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)
