--- ../../alsa-kernel/usb/usx2y/usX2Yhwdep.c	2009-12-10 14:29:27.000000000 +0100
+++ usX2Yhwdep.c	2010-01-20 11:10:01.000000000 +0100
@@ -1,3 +1,5 @@
+#include "usX2Yhwdep.inc"
+
 /*
  * Driver for Tascam US-X2Y USB soundcards
  *
@@ -30,6 +32,7 @@
 #include "usbusx2y.h"
 #include "usX2Yhwdep.h"
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
 static int snd_us428ctls_vm_fault(struct vm_area_struct *area,
 				  struct vm_fault *vmf)
 {
@@ -52,9 +55,66 @@ static int snd_us428ctls_vm_fault(struct
 
 	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 const 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)
@@ -81,8 +141,14 @@ static int snd_us428ctls_mmap(struct snd
 		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;
 }
 
@@ -114,7 +180,11 @@ static int snd_usX2Y_hwdep_dsp_status(st
 	struct usX2Ydev	*us428 = hw->private_data;
 	int id = -1;
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
 	switch (le16_to_cpu(us428->dev->descriptor.idProduct)) {
+#else
+	switch (((struct usX2Ydev*)hw->private_data)->dev->descriptor.idProduct) {
+#endif
 	case USB_ID_US122:
 		id = USX2Y_TYPE_122;
 		break;
@@ -166,9 +236,15 @@ static int usX2Y_create_usbmidi(struct s
 	};
 	struct usb_device *dev = usX2Y(card)->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_usbmidi_create(card, iface, &usX2Y(card)->midi_list, quirk);
@@ -213,7 +289,11 @@ static int snd_usX2Y_hwdep_dsp_load(stru
 		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)
