more 2.4 kernel compilation fixes

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
diff --git a/i2c/other/Makefile b/i2c/other/Makefile
index b66d7df..3cb9884 100644
--- a/i2c/other/Makefile
+++ b/i2c/other/Makefile
@@ -5,7 +5,7 @@
 include $(SND_TOPDIR)/toplevel.config
 include $(SND_TOPDIR)/Makefile.conf
 
-export-objs += ak4xxx-adda.o al4113.o ak4114.o ak4117.o \
+export-objs += ak4xxx-adda.o ak4113.o ak4114.o ak4117.o \
 	       pt2258.o tea575x-tuner.o
 
 include $(SND_TOPDIR)/alsa-kernel/i2c/other/Makefile
diff --git a/pci/oxygen/xonar_cs43xx.c b/pci/oxygen/xonar_cs43xx.c
index c3fb896..4412a02 100644
--- a/pci/oxygen/xonar_cs43xx.c
+++ b/pci/oxygen/xonar_cs43xx.c
@@ -1,3 +1,4 @@
 #define __NO_VERSION__
 #include "adriver.h"
+#include "linux/mutex.h"
 #include "../../alsa-kernel/pci/oxygen/xonar_cs43xx.c"
diff --git a/usb/usbaudio.patch b/usb/usbaudio.patch
index aaf029c..9e655c3 100644
--- a/usb/usbaudio.patch
+++ b/usb/usbaudio.patch
@@ -1,5 +1,5 @@
---- ../alsa-kernel/usb/usbaudio.c	2009-12-14 18:05:48.000000000 +0100
-+++ usbaudio.c	2009-12-15 22:14:44.000000000 +0100
+--- ../alsa-kernel/usb/usbaudio.c	2009-12-14 15:40:14.000000000 +0100
++++ usbaudio.c	2009-12-16 19:25:04.000000000 +0100
 @@ -1,3 +1,4 @@
 +#include "usbaudio.inc"
  /*
@@ -152,7 +152,7 @@
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
  		    le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) ==
 +#else
-+		    get_endpoint(alts, 0)->wMaxPacketSize) ==
++		    get_endpoint(alts, 0)->wMaxPacketSize ==
 +#endif
  							fp->maxpacksize * 2)
  			continue;
diff --git a/usb/usbmidi.patch b/usb/usbmidi.patch
index 7cfa7a3..612dfa7 100644
--- a/usb/usbmidi.patch
+++ b/usb/usbmidi.patch
@@ -1,5 +1,5 @@
---- ../alsa-kernel/usb/usbmidi.c	2009-11-26 13:01:51.000000000 +0100
-+++ usbmidi.c	2009-12-15 22:16:22.000000000 +0100
+--- ../alsa-kernel/usb/usbmidi.c	2009-11-23 08:30:55.000000000 +0100
++++ usbmidi.c	2009-12-16 19:56:07.000000000 +0100
 @@ -1,3 +1,5 @@
 +#include "usbmidi.inc"
 +
@@ -38,13 +38,65 @@
  		err = usb_bulk_msg(ep->umidi->dev, ep->urbs[0].urb->pipe,
  				   buf, len, NULL, 250);
 +#else
-+		err = usb_bulk_msg(ep->umidi->chip->dev, ep->urbs[0].urb->pipe,
++		err = usb_bulk_msg(ep->umidi->dev, ep->urbs[0].urb->pipe,
 +				   buf, len, NULL, HZ);
 +#endif
  	kfree(buf);
  	return err;
  }
-@@ -1679,7 +1694,11 @@
+@@ -894,7 +909,12 @@
+ 	int is_light_load;
+ 
+ 	intf = umidi->iface;
++#ifndef OLD_USB
+ 	is_light_load = intf->cur_altsetting != intf->altsetting;
++#else
++	is_light_load = &intf->altsetting[intf->act_altsetting] !=
++							intf->altsetting;
++#endif
+ 	if (umidi->roland_load_ctl->private_value == is_light_load)
+ 		return;
+ 	hostif = &intf->altsetting[umidi->roland_load_ctl->private_value];
+@@ -981,7 +1001,11 @@
+ 	struct usbmidi_out_port* port = substream->runtime->private_data;
+ 	struct snd_usb_midi_out_endpoint *ep = port->ep;
+ 	unsigned int drain_urbs;
++#ifndef OLD_USB
+ 	DEFINE_WAIT(wait);
++#else
++	wait_queue_t wait;
++#endif
+ 	long timeout = msecs_to_jiffies(50);
+ 
+ 	/*
+@@ -992,6 +1016,7 @@
+ 	drain_urbs = ep->active_urbs;
+ 	if (drain_urbs) {
+ 		ep->drain_urbs |= drain_urbs;
++#ifndef OLD_USB
+ 		do {
+ 			prepare_to_wait(&ep->drain_wait, &wait,
+ 					TASK_UNINTERRUPTIBLE);
+@@ -1001,6 +1026,18 @@
+ 			drain_urbs &= ep->drain_urbs;
+ 		} while (drain_urbs && timeout);
+ 		finish_wait(&ep->drain_wait, &wait);
++#else
++		do {
++			init_waitqueue_entry(&wait, current);
++			add_wait_queue(&ep->drain_wait, &wait);
++			set_current_state(TASK_UNINTERRUPTIBLE);
++			spin_unlock_irq(&ep->buffer_lock);
++			timeout = schedule_timeout(timeout);
++			spin_lock_irq(&ep->buffer_lock);
++			drain_urbs &= ep->drain_urbs;
++			remove_wait_queue(&ep->drain_wait, &wait);
++		} while (drain_urbs && timeout);
++#endif
+ 	}
+ 	spin_unlock_irq(&ep->buffer_lock);
+ }
+@@ -1679,7 +1716,11 @@
  	intf = umidi->iface;
  	if (!intf || intf->num_altsetting < 1)
  		return -ENOENT;
@@ -56,7 +108,7 @@
  	intfd = get_iface_desc(hostif);
  
  	for (i = 0; i < intfd->bNumEndpoints; ++i) {
-@@ -2046,3 +2065,5 @@
+@@ -2046,3 +2087,5 @@
  EXPORT_SYMBOL(snd_usbmidi_input_stop);
  EXPORT_SYMBOL(snd_usbmidi_input_start);
  EXPORT_SYMBOL(snd_usbmidi_disconnect);
diff --git a/usb/usx2y/usX2Yhwdep.patch b/usb/usx2y/usX2Yhwdep.patch
index 57cc19c..b2569ae 100644
--- a/usb/usx2y/usX2Yhwdep.patch
+++ b/usb/usx2y/usX2Yhwdep.patch
@@ -1,5 +1,5 @@
 --- ../../alsa-kernel/usb/usx2y/usX2Yhwdep.c	2009-11-16 13:18:14.000000000 +0100
-+++ usX2Yhwdep.c	2009-11-24 08:19:28.000000000 +0100
++++ usX2Yhwdep.c	2009-12-16 19:58:29.000000000 +0100
 @@ -1,3 +1,21 @@
 +#include "config.h"
 +#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
@@ -30,7 +30,7 @@
  static int snd_us428ctls_vm_fault(struct vm_area_struct *area,
  				  struct vm_fault *vmf)
  {
-@@ -52,9 +71,66 @@ static int snd_us428ctls_vm_fault(struct
+@@ -52,9 +71,66 @@
  
  	return 0;
  }
@@ -97,7 +97,7 @@
  };
  
  static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct vm_area_struct *area)
-@@ -81,8 +157,14 @@ static int snd_us428ctls_mmap(struct snd
+@@ -81,8 +157,14 @@
  		us428->us428ctls_sharedmem->CtlSnapShotLast = -2;
  	}
  	area->vm_ops = &us428ctls_vm_ops;
@@ -112,19 +112,19 @@
  	return 0;
  }
  
-@@ -114,7 +196,11 @@ static int snd_usX2Y_hwdep_dsp_status(st
+@@ -114,7 +196,11 @@
  	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)->chip.dev->descriptor.idProduct)) {
++	switch (((struct usX2Ydev*)hw->private_data)->dev->descriptor.idProduct) {
 +#endif
  	case USB_ID_US122:
  		id = USX2Y_TYPE_122;
  		break;
-@@ -166,9 +252,15 @@ static int usX2Y_create_usbmidi(struct s
+@@ -166,9 +252,15 @@
  	};
  	struct usb_device *dev = usX2Y(card)->dev;
  	struct usb_interface *iface = usb_ifnum_to_if(dev, 0);
@@ -140,7 +140,7 @@
  
  	snd_printdd("usX2Y_create_usbmidi \n");
  	return snd_usbmidi_create(card, iface, &usX2Y(card)->midi_list, quirk);
-@@ -213,7 +305,11 @@ static int snd_usX2Y_hwdep_dsp_load(stru
+@@ -213,7 +305,11 @@
  		if (err)
  			snd_printk(KERN_ERR "usb_set_interface error \n");
  		else
diff --git a/usb/usx2y/usbusx2yaudio.patch b/usb/usx2y/usbusx2yaudio.patch
index 88dd47a..d559345 100644
--- a/usb/usx2y/usbusx2yaudio.patch
+++ b/usb/usx2y/usbusx2yaudio.patch
@@ -1,5 +1,5 @@
 --- ../../alsa-kernel/usb/usx2y/usbusx2yaudio.c	2009-11-16 13:18:14.000000000 +0100
-+++ usbusx2yaudio.c	2009-11-24 08:23:19.000000000 +0100
++++ usbusx2yaudio.c	2009-12-16 19:58:57.000000000 +0100
 @@ -1,3 +1,5 @@
 +#include "adriver.h"
 +#include "../usbcompat.h"
@@ -21,7 +21,7 @@
  static int usX2Y_urb_capt_retire(struct snd_usX2Y_substream *subs)
  {
  	struct urb	*urb = subs->completed_urb;
-@@ -306,7 +316,11 @@ static void usX2Y_error_sequence(struct
+@@ -306,7 +316,11 @@
  	usX2Y_clients_stop(usX2Y);
  }
  
@@ -33,7 +33,7 @@
  {
  	struct snd_usX2Y_substream *subs = urb->context;
  	struct usX2Ydev *usX2Y = subs->usX2Y;
-@@ -335,9 +349,15 @@ static void i_usX2Y_urb_complete(struct
+@@ -335,9 +349,15 @@
  		    atomic_read(&capsubs->state) >= state_PREPARED &&
  		    (playbacksubs->completed_urb ||
  		     atomic_read(&playbacksubs->state) < state_PREPARED)) {
@@ -52,7 +52,7 @@
  				snd_printdd("\n");
  				usX2Y_clients_stop(usX2Y);
  			}
-@@ -345,8 +365,13 @@ static void i_usX2Y_urb_complete(struct
+@@ -345,8 +365,13 @@
  	}
  }
  
@@ -66,7 +66,7 @@
  {
  	int s, u;
  	for (s = 0; s < 4; s++) {
-@@ -366,7 +391,11 @@ static void usX2Y_subs_startup_finish(st
+@@ -366,7 +391,11 @@
  	usX2Y->prepare_subs = NULL;
  }
  
@@ -78,7 +78,7 @@
  {
  	struct snd_usX2Y_substream *subs = urb->context;
  	struct usX2Ydev *usX2Y = subs->usX2Y;
-@@ -378,7 +407,11 @@ static void i_usX2Y_subs_startup(struct
+@@ -378,7 +407,11 @@
  			wake_up(&usX2Y->prepare_wait_queue);
  		}
  
@@ -90,7 +90,7 @@
  }
  
  static void usX2Y_subs_prepare(struct snd_usX2Y_substream *subs)
-@@ -491,7 +524,9 @@ static int usX2Y_urbs_start(struct snd_u
+@@ -491,7 +524,9 @@
  		if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED)
  			goto start;
  	}
@@ -101,7 +101,7 @@
   start:
  	usX2Y_subs_startup(subs);
  	for (i = 0; i < NRURBS; i++) {
-@@ -512,7 +547,11 @@ static int usX2Y_urbs_start(struct snd_u
+@@ -512,7 +547,11 @@
  				err = -EPIPE;
  				goto cleanup;
  			} else
@@ -113,7 +113,7 @@
  					usX2Y->wait_iso_frame = urb->start_frame;
  			urb->transfer_flags = 0;
  		} else {
-@@ -657,7 +696,11 @@ static struct s_c2 SetRate48000[] =
+@@ -657,7 +696,11 @@
  };
  #define NOOF_SETRATE_URBS ARRAY_SIZE(SetRate48000)
  
@@ -125,21 +125,21 @@
  {
  	struct usX2Ydev *usX2Y = urb->context;
  	
-@@ -1017,10 +1060,18 @@ int usX2Y_audio_create(struct snd_card *
+@@ -1017,10 +1060,18 @@
  
  	if (0 > (err = usX2Y_audio_stream_new(card, 0xA, 0x8)))
  		return err;
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
  	if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) == USB_ID_US428)
 +#else
-+	if (usX2Y(card)->chip.dev->descriptor.idProduct == USB_ID_US428)
++	if (usX2Y(card)->dev->descriptor.idProduct == USB_ID_US428)
 +#endif
  	     if (0 > (err = usX2Y_audio_stream_new(card, 0, 0xA)))
  		     return err;
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
  	if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) != USB_ID_US122)
 +#else
-+	if (usX2Y(card)->chip.dev->descriptor.idProduct != USB_ID_US122)
++	if (usX2Y(card)->dev->descriptor.idProduct != USB_ID_US122)
 +#endif
  		err = usX2Y_rate_set(usX2Y(card), 44100);	// Lets us428 recognize output-volume settings, disturbs us122.
  	return err;