Index: GPL/branches/alsa-resync1/alsa-kernel/core/info.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/core/info.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/core/info.c	(revision 112)
@@ -43,4 +43,9 @@
  *
  */
+static inline void dec_mod_count(struct module *module)
+{
+	if (module)
+		__MOD_DEC_USE_COUNT(module);
+}
 
 int snd_info_check_reserved_words(const char *str)
@@ -54,5 +59,5 @@
         "detect",
         "devices",
-		"oss-devices",
+		"oss",
         "cards",
         "timers",
@@ -126,4 +131,5 @@
 
 static struct proc_dir_entry *snd_proc_root = NULL;
+struct proc_dir_entry *snd_proc_dev = NULL;
 snd_info_entry_t *snd_seq_root = NULL;
 #ifdef CONFIG_SND_OSSEMUL
@@ -643,4 +649,8 @@
         return -ENOMEM;
     snd_proc_root = p;
+	p = snd_create_proc_entry("dev", S_IFDIR | S_IRUGO | S_IXUGO, snd_proc_root);
+	if (p == NULL)
+		return -ENOMEM;
+	snd_proc_dev = p;
 #ifdef CONFIG_SND_OSSEMUL
     {
@@ -697,4 +707,9 @@
             snd_info_unregister(snd_seq_root);
 #endif
+#ifdef CONFIG_SND_OSSEMUL
+		if (snd_oss_root)
+			snd_info_unregister(snd_oss_root);
+#endif
+		snd_remove_proc_entry(snd_proc_root, snd_proc_dev);
         snd_remove_proc_entry(&proc_root, snd_proc_root);
     }
Index: GPL/branches/alsa-resync1/alsa-kernel/core/rtctimer.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/core/rtctimer.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/core/rtctimer.c	(revision 112)
@@ -19,12 +19,4 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
- * 
- *================================================================
- * For enabling this timer, apply the patch file to your kernel.
- * The configure script checks the patch automatically.
- * The patches, rtc-xxx.dif, are found under utils/patches, where
- * xxx is the kernel version.
- *================================================================
- *
  */
 
@@ -32,4 +24,5 @@
 #include <linux/init.h>
 #include <linux/time.h>
+#include <linux/interrupt.h>
 #include <sound/core.h>
 #include <sound/timer.h>
@@ -56,5 +49,5 @@
 
 /*
- * The harware depenant description for this timer.
+ * The hardware dependent description for this timer.
  */
 static struct _snd_timer_hardware rtc_hw = {
@@ -69,5 +62,5 @@
 int rtctimer_freq = RTC_FREQ;		/* frequency */
 static snd_timer_t *rtctimer;
-static volatile int rtc_inc = 0;
+static atomic_t rtc_inc = ATOMIC_INIT(0);
 static rtc_task_t rtc_task;
 
@@ -80,4 +73,10 @@
 rtctimer_open(snd_timer_t *t)
 {
+	int err;
+
+	err = rtc_register(&rtc_task);
+	if (err < 0)
+		return err;
+	t->private_data = &rtc_task;
 	MOD_INC_USE_COUNT;
 	return 0;
@@ -87,4 +86,9 @@
 rtctimer_close(snd_timer_t *t)
 {
+	rtc_task_t *rtc = t->private_data;
+	if (rtc) {
+		rtc_unregister(rtc);
+		t->private_data = NULL;
+	}
 	MOD_DEC_USE_COUNT;
 	return 0;
@@ -98,5 +102,5 @@
 	rtc_control(rtc, RTC_IRQP_SET, rtctimer_freq);
 	rtc_control(rtc, RTC_PIE_ON, 0);
-	rtc_inc = 0;
+	atomic_set(&rtc_inc, 0);
 	return 0;
 }
@@ -116,10 +120,13 @@
 static void rtctimer_interrupt(void *private_data)
 {
-	rtc_inc++;
+	atomic_inc(&rtc_inc);
 #ifdef USE_TASKLET
 	tasklet_hi_schedule(&rtc_tq);
 #else
-	snd_timer_interrupt((snd_timer_t*)private_data, rtc_inc);
-	rtc_inc = 0;
+	{
+		int ticks = atomic_read(&rtc_inc);
+		snd_timer_interrupt((snd_timer_t*)private_data, ticks);
+		atomic_sub(ticks, &rtc_inc);
+	}
 #endif /* USE_TASKLET */
 }
@@ -129,17 +136,13 @@
 {
 	snd_timer_t *timer = (snd_timer_t *)private_data;
+	int ticks;
+
 	snd_assert(timer != NULL, return);
 	do {
-		snd_timer_interrupt(timer, 1);
-	} while (--rtc_inc > 0);
+		ticks = atomic_read(&rtc_inc);
+		snd_timer_interrupt(timer, ticks);
+	} while (!atomic_sub_and_test(ticks, &rtc_inc));
 }
 #endif /* USE_TASKLET */
-
-static void rtctimer_private_free(snd_timer_t *timer)
-{
-	rtc_task_t *rtc = timer->private_data;
-	if (rtc)
-		rtc_unregister(rtc);
-}
 
 
@@ -176,14 +179,7 @@
 	timer->hw.resolution = NANO_SEC / rtctimer_freq;
 
-	/* register RTC callback */
+	/* set up RTC callback */
 	rtc_task.func = rtctimer_interrupt;
 	rtc_task.private_data = timer;
-	err = rtc_register(&rtc_task);
-	if (err < 0) {
-		snd_timer_global_free(timer);
-		return err;
-	}
-	timer->private_data = &rtc_task;
-	timer->private_free = rtctimer_private_free;
 
 	err = snd_timer_global_register(timer);
@@ -192,5 +188,5 @@
 		return err;
 	}
-	rtctimer = timer;
+	rtctimer = timer; /* remember this */
 
 	return 0;
@@ -207,5 +203,5 @@
 
 /*
- * exported stuffs
+ * exported stuff
  */
 module_init(rtctimer_init)
Index: GPL/branches/alsa-resync1/alsa-kernel/core/seq/makefile.os2
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/core/seq/makefile.os2	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/core/seq/makefile.os2	(revision 112)
@@ -36,6 +36,5 @@
 FILE2    = seq.obj seq_lock.obj seq_clientmgr.obj seq_memory.obj seq_queue.obj 
 FILE3    = seq_fifo.obj seq_prioq.obj seq_timer.obj 
-FILE4    = seq_system.obj seq_ports.obj seq_info.obj seq_sync.obj
-FILE5    = seq_midi_clock.obj seq_mtc.obj seq_dtl.obj
+FILE4    = seq_system.obj seq_ports.obj seq_info.obj
 FILELAST =
 FILES    = $(FILE0) $(FILE1) $(FILE2) $(FILE3) $(FILE4) $(FILE5) $(FILE6) $(FILE7) $(FILE8) $(FILE9) $(FILE10) $(FILE11) $(FILE12)
Index: GPL/branches/alsa-resync1/alsa-kernel/core/sound.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/core/sound.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/core/sound.c	(revision 112)
@@ -550,4 +550,7 @@
 EXPORT_SYMBOL(snd_verbose_printd);
 #endif
+#if defined(CONFIG_SND_DEBUG) && !defined(CONFIG_SND_VERBOSE_PRINTK)
+EXPORT_SYMBOL(snd_printd);
+#endif
 /* wrappers */
 #ifdef CONFIG_SND_DEBUG_MEMORY
Index: GPL/branches/alsa-resync1/alsa-kernel/include/sound/adriver.h
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/include/sound/adriver.h	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/include/sound/adriver.h	(revision 112)
@@ -106,5 +106,6 @@
 #define need_resched() (current->need_resched)
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 5) && !defined TARGET_OS2
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 4) && !defined TARGET_OS2
+#include <linux/fs.h>
 static inline struct proc_dir_entry *PDE(const struct inode *inode)
 {
Index: GPL/branches/alsa-resync1/alsa-kernel/include/sound/asoundef.h
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/include/sound/asoundef.h	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/include/sound/asoundef.h	(revision 112)
@@ -156,5 +156,5 @@
 #define MIDI_CTL_MSB_BREATH           	0x02
 #define MIDI_CTL_MSB_FOOT             	0x04
-#define MIDI_CTL_MSB_PORTNAMENTO_TIME 	0x05
+#define MIDI_CTL_MSB_PORTAMENTO_TIME 	0x05
 #define MIDI_CTL_MSB_DATA_ENTRY		0x06
 #define MIDI_CTL_MSB_MAIN_VOLUME      	0x07
@@ -172,5 +172,5 @@
 #define MIDI_CTL_LSB_BREATH           	0x22
 #define MIDI_CTL_LSB_FOOT             	0x24
-#define MIDI_CTL_LSB_PORTNAMENTO_TIME 	0x25
+#define MIDI_CTL_LSB_PORTAMENTO_TIME 	0x25
 #define MIDI_CTL_LSB_DATA_ENTRY		0x26
 #define MIDI_CTL_LSB_MAIN_VOLUME      	0x27
@@ -204,5 +204,5 @@
 #define MIDI_CTL_GENERAL_PURPOSE7     	0x52
 #define MIDI_CTL_GENERAL_PURPOSE8     	0x53
-#define MIDI_CTL_PORNAMENTO_CONTROL	0x54
+#define MIDI_CTL_PORTAMENTO_CONTROL	0x54
 #define MIDI_CTL_E1_REVERB_DEPTH	0x5b
 #define MIDI_CTL_E2_TREMOLO_DEPTH	0x5c
Index: GPL/branches/alsa-resync1/alsa-kernel/include/sound/core.h
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/include/sound/core.h	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/include/sound/core.h	(revision 112)
@@ -322,5 +322,11 @@
 int snd_task_name(struct task_struct *task, char *name, size_t size);
 #ifdef CONFIG_SND_VERBOSE_PRINTK
-int snd_verbose_printk(const char *file, int line, const char *format);
+void snd_verbose_printk(const char *file, int line, const char *format, ...);
+#endif
+#if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK)
+void snd_verbose_printd(const char *file, int line, const char *format, ...);
+#endif
+#if defined(CONFIG_SND_DEBUG) && !defined(CONFIG_SND_VERBOSE_PRINTK)
+void snd_printd(const char *format, ...);
 #endif
 
@@ -364,11 +370,9 @@
 
 #ifdef CONFIG_SND_VERBOSE_PRINTK
-#define snd_printk(format, args...) do { \
-	printk(snd_verbose_printk(__FILE__, __LINE__, format) ? format + 3 : format, ##args); \
-} while (0)
-#else
-#define snd_printk(format, args...) do { \
-	printk(format, ##args); \
-} while (0)
+#define snd_printk(format, args...) \
+	snd_verbose_printk(__FILE__, __LINE__, format, ##args)
+#else
+#define snd_printk(format, args...) \
+	printk(format, ##args)
 #endif
 
@@ -377,5 +381,8 @@
 #define __ASTRING__(x) #x
 
-#define snd_printd(format, args...) snd_printk(format, ##args)
+#ifdef CONFIG_SND_VERBOSE_PRINTK
+#define snd_printd(format, args...) \
+	snd_verbose_printd(__FILE__, __LINE__, format, ##args)
+#endif
 #define snd_assert(expr, args...) do {\
 	if (!(expr)) {\
Index: GPL/branches/alsa-resync1/alsa-kernel/include/sound/driver.h
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/include/sound/driver.h	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/include/sound/driver.h	(revision 112)
@@ -94,11 +94,3 @@
 #endif
 
-/*
- * Temporary hack, until linux/init.h is fixed.
- */
-#include <linux/init.h>
-#ifndef __devexit_p
-#define __devexit_p(x) x
-#endif
-
 #endif /* __SOUND_DRIVER_H */
Index: GPL/branches/alsa-resync1/alsa-kernel/include/sound/minors.h
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/include/sound/minors.h	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/include/sound/minors.h	(revision 112)
@@ -32,6 +32,6 @@
 #define SNDRV_MINOR_HWDEP		4	/* 4 - 7 */
 #define SNDRV_MINOR_HWDEPS		4
-#define SNDRV_MINOR_RAWMIDI		8	/* 8 - 11 */
-#define SNDRV_MINOR_RAWMIDIS		4
+#define SNDRV_MINOR_RAWMIDI		8	/* 8 - 15 */
+#define SNDRV_MINOR_RAWMIDIS		8
 #define SNDRV_MINOR_PCM_PLAYBACK	16	/* 16 - 23 */
 #define SNDRV_MINOR_PCM_CAPTURE		24	/* 24 - 31 */
Index: GPL/branches/alsa-resync1/alsa-kernel/include/sound/pcm_params.h
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/include/sound/pcm_params.h	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/include/sound/pcm_params.h	(revision 112)
@@ -22,6 +22,4 @@
  *
  */
-
-#include <linux/bitops.h>
 
 extern int snd_pcm_hw_param_mask(snd_pcm_substream_t *pcm, snd_pcm_hw_params_t *params,
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/ad1816a/ad1816a.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/ad1816a/ad1816a.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/ad1816a/ad1816a.c	(revision 112)
@@ -333,5 +333,5 @@
 					    const struct isapnp_card_id *id)
 {
-	static int dev = 0;
+	static int dev;
 	int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/ad1816a/ad1816a_lib.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/ad1816a/ad1816a_lib.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/ad1816a/ad1816a_lib.c	(revision 112)
@@ -25,4 +25,5 @@
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/ioport.h>
 #include <sound/core.h>
 #include <sound/ad1816a.h>
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/ad1848/ad1848_lib.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/ad1848/ad1848_lib.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/ad1848/ad1848_lib.c	(revision 112)
@@ -26,4 +26,5 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
+#include <linux/ioport.h>
 #include <sound/core.h>
 #include <sound/ad1848.h>
@@ -669,6 +670,13 @@
 			if (rev & 0x80) {
 				chip->hardware = AD1848_HW_CS4248;
-			} else if (rev & 0x0a) {
-				chip->hardware = AD1848_HW_CMI8330;
+			} else if ((rev & 0x0f) == 0x0a) {
+				snd_ad1848_out(chip, AD1848_MISC_INFO, 0x40);
+				for (i = 0; i < 16; ++i) {
+					if (snd_ad1848_in(chip, i) != snd_ad1848_in(chip, i + 16)) {
+						chip->hardware = AD1848_HW_CMI8330;
+						break;
+					}
+				}
+				snd_ad1848_out(chip, AD1848_MISC_INFO, 0x00);
 			}
 		}
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/als100.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/als100.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/als100.c	(revision 112)
@@ -354,5 +354,5 @@
 					   const struct isapnp_card_id *id)
 {
-	static int dev = 0;
+	static int dev;
 	int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/azt2320.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/azt2320.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/azt2320.c	(revision 112)
@@ -139,5 +139,5 @@
 	/* PRO16V */
 	ISAPNP_AZT2320('A','Z','T',0x1008,0x1008,0x2001),
-	/* --- */
+	/* Aztech Sound Galaxy 16 */
 	ISAPNP_AZT2320('A','Z','T',0x2320,0x0001,0x0002),
 	/* Packard Bell Sound III 336 AM/SP */
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/cmi8330.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/cmi8330.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/cmi8330.c	(revision 112)
@@ -190,5 +190,5 @@
 AD1848_SINGLE("Loud Playback Switch", 0, CMI8330_MUTEMUX, 6, 1, 1),
 AD1848_DOUBLE("PCM Playback Switch", 0, AD1848_LEFT_OUTPUT, AD1848_RIGHT_OUTPUT, 7, 7, 1, 1),
-AD1848_DOUBLE("PCM Playback Volume", 0, AD1848_LEFT_OUTPUT, AD1848_RIGHT_OUTPUT, 0, 0, 63, 0),
+AD1848_DOUBLE("PCM Playback Volume", 0, AD1848_LEFT_OUTPUT, AD1848_RIGHT_OUTPUT, 0, 0, 63, 1),
 AD1848_DOUBLE("Line Playback Switch", 0, CMI8330_MUTEMUX, CMI8330_MUTEMUX, 4, 3, 1, 0),
 AD1848_DOUBLE("Line Playback Volume", 0, CMI8330_LINVOL, CMI8330_LINVOL, 4, 0, 15, 0),
@@ -464,5 +464,5 @@
                                             const struct isapnp_card_id *id)
 {
-	static int dev = 0;
+	static int dev;
 	int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4231_lib.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4231_lib.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4231_lib.c	(revision 112)
@@ -33,4 +33,5 @@
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/ioport.h>
 #include <sound/core.h>
 #include <sound/cs4231.h>
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4236.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4236.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/cs423x/cs4236.c	(revision 112)
@@ -71,4 +71,5 @@
 		"{IBM,IntelliStation M Pro},"
 		"{Intel,Marlin Spike Mobo CS4235},"
+		"{Intel PR440FX Onboard},"
 		"{Guillemot,MaxiSound 16 PnP},"
 		"{NewClear,3D},"
@@ -237,4 +238,6 @@
 	/* some uknown CS4236B */
 	ISAPNP_CS4232('C','S','C',0x0b35,0x0000,0x0010,0x0003),
+	/* Intel PR440FX Onboard sound */
+	ISAPNP_CS4232('C','S','C',0x0b36,0x0000,0x0010,0x0003),
 	/* CS4235 on mainboard without MPU */
 	ISAPNP_CS4232_WOMPU('C','S','C',0x1425,0x0100,0x0110),
@@ -326,5 +329,5 @@
 	if (snd_port[dev] != SNDRV_AUTO_PORT)
 		isapnp_resource_change(&pdev->resource[0], snd_port[dev], 4);
-	if (snd_fm_port[dev] != SNDRV_AUTO_PORT)
+	if (snd_fm_port[dev] != SNDRV_AUTO_PORT && snd_fm_port[dev] >= 0)
 		isapnp_resource_change(&pdev->resource[1], snd_fm_port[dev], 4);
 	if (snd_sb_port[dev] != SNDRV_AUTO_PORT)
@@ -341,5 +344,6 @@
 	}
 	snd_port[dev] = pdev->resource[0].start;
-	snd_fm_port[dev] = pdev->resource[1].start;
+	if (snd_fm_port[dev] >= 0)
+		snd_fm_port[dev] = pdev->resource[1].start;
 	snd_sb_port[dev] = pdev->resource[2].start;
 	snd_irq[dev] = pdev->irq_resource[0].start;
@@ -366,5 +370,5 @@
 	snd_printdd("isapnp CTRL: control port=0x%lx\n", snd_cport[dev]);
 	/* MPU initialization */
-	if (acard->mpu) {
+	if (acard->mpu && snd_mpu_port[dev] >= 0) {
 		pdev = acard->mpu;
 		if (pdev->prepare(pdev) < 0) {
@@ -375,5 +379,5 @@
 		if (snd_mpu_port[dev] != SNDRV_AUTO_PORT)
 			isapnp_resource_change(&pdev->resource[0], snd_mpu_port[dev], 2);
-		if (snd_mpu_irq[dev] != SNDRV_AUTO_IRQ)
+		if (snd_mpu_irq[dev] != SNDRV_AUTO_IRQ && snd_mpu_irq[dev] >= 0)
 			isapnp_resource_change(&pdev->irq_resource[0], snd_mpu_irq[dev], 1);
 		if (pdev->activate(pdev)<0) {
@@ -383,6 +387,7 @@
 		} else {
 			snd_mpu_port[dev] = pdev->resource[0].start;
-			if (pdev->irq_resource[0].flags & IORESOURCE_IRQ) {
-			snd_mpu_irq[dev] = pdev->irq_resource[0].start;
+			if ((pdev->irq_resource[0].flags & IORESOURCE_IRQ) &&
+			    snd_mpu_irq[dev] >= 0) {
+				snd_mpu_irq[dev] = pdev->irq_resource[0].start;
 			} else {
 				snd_mpu_irq[dev] = -1;	/* disable interrupt */
@@ -538,5 +543,5 @@
 	}
 
-	if (snd_mpu_irq[dev] >= 0 && snd_mpu_irq[dev] != SNDRV_AUTO_IRQ) {
+	if (snd_mpu_port[dev] != SNDRV_AUTO_PORT) {
 		if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
 					snd_mpu_port[dev], 0,
@@ -566,5 +571,5 @@
                                            const struct isapnp_card_id *id)
 {
-	static int dev = 0;
+	static int dev;
 	int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/dt0197h.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/dt0197h.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/dt0197h.c	(revision 112)
@@ -321,5 +321,5 @@
 					    const struct isapnp_card_id *id)
 {
-	static int dev = 0;
+	static int dev;
 	int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688.c	(revision 112)
@@ -170,5 +170,5 @@
 static int __init snd_audiodrive_legacy_auto_probe(unsigned long port)
 {
-	static int dev = 0;
+	static int dev;
 	int res;
 	
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688_lib.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688_lib.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/es1688/es1688_lib.c	(revision 112)
@@ -26,4 +26,5 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
+#include <linux/ioport.h>
 #include <sound/core.h>
 #include <sound/es1688.h>
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/es18xx.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/es18xx.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/es18xx.c	(revision 112)
@@ -2381,5 +2381,5 @@
 static int __init snd_audiodrive_probe_legacy_port(unsigned long port)
 {
-	static int dev = 0;
+	static int dev;
 	int res;
 
@@ -2405,5 +2405,5 @@
 					       const struct isapnp_card_id *id)
 {
-	static int dev = 0;
+	static int dev;
 	int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gus_main.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gus_main.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gus_main.c	(revision 112)
@@ -16,16 +16,31 @@
  *   You should have received a copy of the GNU General Public License
  *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
  */
 
-#define SNDRV_MAIN_OBJECT_FILE
 #include <sound/driver.h>
+#include <asm/dma.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include <linux/ioport.h>
+#include <sound/core.h>
 #include <sound/gus.h>
 #include <sound/control.h>
 
+MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
+MODULE_DESCRIPTION("Routines for Gravis UltraSound soundcards");
+MODULE_LICENSE("GPL");
+
 #define chip_t snd_gus_card_t
 
 static int snd_gus_init_dma_irq(snd_gus_card_t * gus, int latches);
+
+static inline void dec_mod_count(struct module *module)
+{
+	if (module)
+		__MOD_DEC_USE_COUNT(module);
+}
 
 int snd_gus_use_inc(snd_gus_card_t * gus)
@@ -110,5 +125,5 @@
 	if (gus->gf1.res_port2 == NULL)
 		goto __hw_end;
-#ifdef CONFIG_SND_SEQUENCER
+#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
 	if (gus->seq_dev) {
 		snd_device_free(gus->card, gus->seq_dev);
@@ -119,8 +134,12 @@
 	snd_gus_init_dma_irq(gus, 0);
       __hw_end:
-	if (gus->gf1.res_port1)
+	if (gus->gf1.res_port1) {
 		release_resource(gus->gf1.res_port1);
-	if (gus->gf1.res_port2)
+		kfree_nocheck(gus->gf1.res_port1);
+	}
+	if (gus->gf1.res_port2) {
 		release_resource(gus->gf1.res_port2);
+		kfree_nocheck(gus->gf1.res_port2);
+	}
 	if (gus->gf1.irq >= 0)
 		free_irq(gus->gf1.irq, (void *) gus);
@@ -440,5 +459,5 @@
 	if ((err = snd_gus_init_dma_irq(gus, 1)) < 0)
 		return err;
-#ifdef CONFIG_SND_SEQUENCER
+#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
 	if (snd_seq_device_new(gus->card, 1, SNDRV_SEQ_DEV_ID_GUS,
 			       sizeof(snd_gus_card_t*), &gus->seq_dev) >= 0) {
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusclassic.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusclassic.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusclassic.c	(revision 112)
@@ -230,5 +230,5 @@
 static int __init snd_gusclassic_legacy_auto_probe(unsigned long port)
 {
-	static int dev = 0;
+	static int dev;
 	int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusextreme.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusextreme.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusextreme.c	(revision 112)
@@ -360,5 +360,5 @@
 static int __init snd_gusextreme_legacy_auto_probe(unsigned long port)
 {
-        static int dev = 0;
+        static int dev;
         int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusmax.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusmax.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/gus/gusmax.c	(revision 112)
@@ -366,5 +366,5 @@
 static int __init snd_gusmax_legacy_auto_probe(unsigned long port)
 {
-	static int dev = 0;
+	static int dev;
 	int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/gus/interwave.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/gus/interwave.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/gus/interwave.c	(revision 112)
@@ -912,5 +912,5 @@
 static int __init snd_interwave_probe_legacy_port(unsigned long port)
 {
-	static int dev = 0;
+	static int dev;
 	int res;
 
@@ -936,5 +936,5 @@
 					      const struct isapnp_card_id *id)
 {
-	static int dev = 0;
+	static int dev;
 	int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/opl3sa2.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/opl3sa2.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/opl3sa2.c	(revision 112)
@@ -194,5 +194,5 @@
 	/* Yamaha OPL3-SA3 (integrated on Intel's Pentium II AL440LX motherboard) */
 	ISAPNP_OPL3SA2('Y','M','H',0x0030,0x0021),
-	/* ??? */
+	/* Yamaha OPL3-SA2 */
 	ISAPNP_OPL3SA2('Y','M','H',0x0800,0x0021),
 	/* NeoMagic MagicWave 3DX */
@@ -881,5 +881,5 @@
 					    const struct isapnp_card_id *id)
 {
-        static int dev = 0;
+        static int dev;
         int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/sb/emu8000.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/sb/emu8000.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/sb/emu8000.c	(revision 112)
@@ -18,15 +18,21 @@
  *   You should have received a copy of the GNU General Public License
  *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#define SNDRV_MAIN_OBJECT_FILE
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+#define __NO_VERSION__
+#include <sound/driver.h>
+#include <linux/wait.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/ioport.h>
+#include <sound/core.h>
 #include <sound/emu8000.h>
 #include <sound/emu8000_reg.h>
+#include <asm/io.h>
+#include <asm/uaccess.h>
+#include <linux/init.h>
 #include <sound/control.h>
 #include <sound/initval.h>
-
-MODULE_CLASSES("{sound}");
-MODULE_AUTHOR("Takashi Iwai, Steve Ratcliffe");
 
 /*
@@ -124,5 +130,5 @@
 /*
  */
-static void /*__init*/
+static void __init
 snd_emu8000_read_wait(emu8000_t *emu)
 {
@@ -137,5 +143,5 @@
 /*
  */
-static void /*__init*/
+static void __init
 snd_emu8000_write_wait(emu8000_t *emu)
 {
@@ -151,5 +157,5 @@
  * detect a card at the given port
  */
-static int /*__init*/
+static int __init
 snd_emu8000_detect(emu8000_t *emu)
 {
@@ -177,5 +183,5 @@
  * intiailize audio channels
  */
-static void /*__init*/
+static void __init
 init_audio(emu8000_t *emu)
 {
@@ -218,5 +224,5 @@
  * initialize DMA address
  */
-static void /*__init*/
+static void __init
 init_dma(emu8000_t *emu)
 {
@@ -322,5 +328,5 @@
  * is meant to work
  */
-static void /*__init*/
+static void __init
 send_array(emu8000_t *emu, unsigned short *data, int size)
 {
@@ -346,5 +352,5 @@
  * initialisation sequence in the adip.
  */
-static void /*__init*/
+static void __init
 init_arrays(emu8000_t *emu)
 {
@@ -373,5 +379,5 @@
  * reallocating between read and write.
  */
-static void /*__init*/
+static void __init
 size_dram(emu8000_t *emu)
 {
@@ -499,5 +505,5 @@
  * The main initialization routine.
  */
-static void /*__init*/
+static void __init
 snd_emu8000_init_hw(emu8000_t *emu)
 {
@@ -653,5 +659,5 @@
 	soundfont_chorus_fx_t rec;
 	if (mode < SNDRV_EMU8000_CHORUS_PREDEFINED || mode >= SNDRV_EMU8000_CHORUS_NUMBERS) {
-		snd_printk("illegal chorus mode %d for uploading\n", mode);
+		snd_printk(KERN_WARNING "illegal chorus mode %d for uploading\n", mode);
 		return -EINVAL;
 	}
@@ -781,5 +787,5 @@
 
 	if (mode < SNDRV_EMU8000_REVERB_PREDEFINED || mode >= SNDRV_EMU8000_REVERB_NUMBERS) {
-		snd_printk("illegal reverb mode %d for uploading\n", mode);
+		snd_printk(KERN_WARNING "illegal reverb mode %d for uploading\n", mode);
 		return -EINVAL;
 	}
@@ -1085,5 +1091,5 @@
  * create and attach mixer elements for WaveTable treble/bass controls
  */
-static int /*__init*/
+static int __init
 snd_emu8000_create_mixer(snd_card_t *card, emu8000_t *emu)
 {
@@ -1115,10 +1121,16 @@
 static int snd_emu8000_free(emu8000_t *hw)
 {
-	if (hw->res_port1)
+	if (hw->res_port1) {
 		release_resource(hw->res_port1);
-	if (hw->res_port2)
+		kfree_nocheck(hw->res_port1);
+	}
+	if (hw->res_port2) {
 		release_resource(hw->res_port2);
-	if (hw->res_port3)
+		kfree_nocheck(hw->res_port2);
+	}
+	if (hw->res_port3) {
 		release_resource(hw->res_port3);
+		kfree_nocheck(hw->res_port3);
+	}
 	snd_magic_kfree(hw);
 	return 0;
@@ -1136,5 +1148,5 @@
  * initialize and register emu8000 synth device.
  */
-/*exported*/ int
+int __init
 snd_emu8000_new(snd_card_t *card, int index, long port, int seq_ports, snd_seq_device_t **awe_ret)
 {
@@ -1213,5 +1225,4 @@
  */
 
-EXPORT_SYMBOL(snd_emu8000_new);
 EXPORT_SYMBOL(snd_emu8000_poke);
 EXPORT_SYMBOL(snd_emu8000_peek);
@@ -1225,18 +1236,2 @@
 EXPORT_SYMBOL(snd_emu8000_update_reverb_mode);
 EXPORT_SYMBOL(snd_emu8000_update_equalizer);
-
-/*
- *  INIT part
- */
-
-static int __init alsa_emu8000_init(void)
-{
-	return 0;
-}
-
-static void __exit alsa_emu8000_exit(void)
-{
-}
-
-module_init(alsa_emu8000_init)
-module_exit(alsa_emu8000_exit)
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/sb/es968.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/sb/es968.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/sb/es968.c	(revision 112)
@@ -237,5 +237,5 @@
                                           const struct isapnp_card_id *id)
 {
-    static int dev = 0;
+	static int dev;
     int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16.c	(revision 112)
@@ -589,5 +589,5 @@
     static int __init snd_sb16_probe_legacy_port(unsigned long port)
     {
-        static int dev = 0;
+	static int dev;
         int res;
 
@@ -613,5 +613,5 @@
                                              const struct isapnp_card_id *id)
     {
-        static int dev = 0;
+	static int dev;
         int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16_main.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16_main.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb16_main.c	(revision 112)
@@ -210,9 +210,9 @@
 #define snd_sb16_csp_playback_prepare(chip, runtime)	/*nop*/
 #define snd_sb16_csp_capture_prepare(chip, runtime)	/*nop*/
-#define snd_sb16_csp_update(chip)		/*nop*/
+#define snd_sb16_csp_update(chip)			/*nop*/
 #define snd_sb16_csp_playback_open(chip, runtime)	/*nop*/
-#define snd_sb16_csp_playback_close(chip)	/*nop*/
+#define snd_sb16_csp_playback_close(chip)		/*nop*/
 #define snd_sb16_csp_capture_open(chip, runtime)	/*nop*/
-#define snd_sb16_csp_capture_close(chip)       	/*nop*/
+#define snd_sb16_csp_capture_close(chip)      	 	/*nop*/
 #endif
 
@@ -825,5 +825,5 @@
         }
     }
-    if (chip->dma16 >= 0) {
+	if (chip->dma16 >= 0 && chip->dma16 != chip->dma8) {
         switch (chip->dma16) {
         case 5:
@@ -940,5 +940,8 @@
     snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb16_capture_ops);
 
+	if (chip->dma16 >= 0 && chip->dma8 != chip->dma16)
     snd_ctl_add(card, snd_ctl_new1(&snd_sb16_dma_control, chip));
+	else
+		pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
 
 	snd_pcm_lib_preallocate_isa_pages_for_all(pcm, 64*1024, 128*1024);
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb8.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb8.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb8.c	(revision 112)
@@ -23,4 +23,5 @@
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/ioport.h>
 #include <sound/core.h>
 #include <sound/sb.h>
@@ -183,5 +184,5 @@
 static int __init snd_card_sb8_legacy_auto_probe(unsigned long port)
 {
-    static int dev = 0;
+        static int dev;
     int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb_common.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb_common.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/sb/sb_common.c	(revision 112)
@@ -27,4 +27,5 @@
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/ioport.h>
 #include <sound/core.h>
 #include <sound/sb.h>
@@ -183,5 +184,5 @@
         free_dma(chip->dma8);
     }
-    if (chip->dma16 >= 0) {
+	if (chip->dma16 >= 0 && chip->dma16 != chip->dma8) {
         disable_dma(chip->dma16);
         free_dma(chip->dma16);
@@ -255,7 +256,12 @@
     }
     chip->dma8 = dma8;
-    if (dma16 >= 0 && request_dma(dma16, "SoundBlaster - 16bit")) {
+	if (dma16 >= 0) {
+		if (hardware != SB_HW_ALS100 && (dma16 < 5 || dma16 > 7)) {
+			/* no duplex */
+			dma16 = -1;
+		} else if (request_dma(dma16, "SoundBlaster - 16bit")) {
         snd_sbdsp_free(chip);
         return -EBUSY;
+		}
     }
     chip->dma16 = dma16;
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/sgalaxy.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/sgalaxy.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/sgalaxy.c	(revision 112)
@@ -120,5 +120,5 @@
 	int tmp, tmp1;
 
-	unsigned int flags;
+	unsigned long flags;
 
 	if ((tmp = inb(port + 3)) == 0xff)
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront.c	(revision 112)
@@ -59,5 +59,6 @@
 
 MODULE_PARM(snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
-MODULE_PARM_SYNTAX(snd_index, "Index value for WaveFront soundcard.");
+MODULE_PARM_DESC(snd_index, "Index value for WaveFront soundcard.");
+MODULE_PARM_SYNTAX(snd_index, SNDRV_INDEX_DESC);
 MODULE_PARM(snd_id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");
 MODULE_PARM_DESC(snd_id, "ID string for WaveFront soundcard.");
@@ -100,5 +101,5 @@
 MODULE_PARM(snd_use_cs4232_midi, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(snd_use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)");
-MODULE_PARM_SYNTAX(snd_use_cs4232_midi, SNDRV_ENABLED ",allows use of CS4323 MPU-401 interface");
+MODULE_PARM_SYNTAX(snd_use_cs4232_midi, SNDRV_ENABLED "," SNDRV_BOOLEAN_FALSE_DESC);
 
 static snd_card_t *snd_wavefront_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
@@ -702,5 +703,5 @@
                                               const struct isapnp_card_id *id)
 {
-        static int dev = 0;
+        static int dev;
         int res;
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront_fx.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront_fx.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront_fx.c	(revision 112)
@@ -1,4 +1,4 @@
 /*
- *  Copyright (c) 1998-1999 by Paul Barton-Davis <pbd@op.net>
+ *  Copyright (c) 1998-2002 by Paul Davis <pbd@op.net>
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -14,17 +14,18 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#define SNDRV_MAIN_OBJECT_FILE
+#define __NO_VERSION__
 #include <sound/driver.h>
+#include <asm/io.h>
+#include <linux/init.h>
+#include <linux/time.h>
+#include <linux/wait.h>
+#include <sound/core.h>
 #include <sound/snd_wavefront.h>
 #include <sound/yss225.h>
 #include <sound/initval.h>
 
-MODULE_AUTHOR("Paul Barton-Davis <pbd@op.net>");
-MODULE_DESCRIPTION("ALSA driver for Turtle Beach Tropez+ YSS225 FX Processor");
-MODULE_CLASSES("{sound}");
-
 /* Control bits for the Load Control Register
  */
@@ -33,4 +34,11 @@
 #define FX_MSB_TRANSFER 0x02    /* transfer after DSP MSB byte written */
 #define FX_AUTO_INCR    0x04    /* auto-increment DSP address after transfer */
+
+static inline void
+dec_mod_count(struct module *module)
+{
+	if (module)
+		__MOD_DEC_USE_COUNT(module);
+}
 
 static int
@@ -242,5 +250,5 @@
 
 
-int
+int __init
 snd_wavefront_fx_start (snd_wavefront_t *dev)
 
@@ -699,5 +707,5 @@
 /* wierd stuff, derived from port I/O tracing with dosemu */
 
-unsigned char page_zero[] = {
+static unsigned char page_zero[] __initdata = {
 0x01, 0x7c, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00,
 0x11, 0x00, 0x20, 0x00, 0x32, 0x00, 0x40, 0x00, 0x13, 0x00, 0x00,
@@ -726,5 +734,5 @@
 };    
 
-unsigned char page_one[] = {
+static unsigned char page_one[] __initdata = {
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x19, 0x00,
 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xd8, 0x00, 0x00,
@@ -753,5 +761,5 @@
 };
 
-unsigned char page_two[] = {
+static unsigned char page_two[] __initdata = {
 0xc4, 0x00, 0x44, 0x07, 0x44, 0x00, 0x40, 0x25, 0x01, 0x06, 0xc4,
 0x07, 0x40, 0x25, 0x01, 0x00, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00,
@@ -768,5 +776,5 @@
 };
 
-unsigned char page_three[] = {
+static unsigned char page_three[] __initdata = {
 0x07, 0x40, 0x00, 0x00, 0x00, 0x47, 0x00, 0x40, 0x00, 0x40, 0x06,
 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -783,5 +791,5 @@
 };
 
-unsigned char page_four[] = {
+static unsigned char page_four[] __initdata = {
 0x63, 0x03, 0x26, 0x02, 0x2c, 0x00, 0x24, 0x00, 0x2e, 0x02, 0x02,
 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -798,5 +806,5 @@
 };
 
-unsigned char page_six[] = {
+static unsigned char page_six[] __initdata = {
 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00,
 0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x0e,
@@ -819,5 +827,5 @@
 };
 
-unsigned char page_seven[] = {
+static unsigned char page_seven[] __initdata = {
 0x0f, 0xff, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
@@ -846,5 +854,5 @@
 };
 
-unsigned char page_zero_v2[] = {
+static unsigned char page_zero_v2[] __initdata = {
 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -858,5 +866,5 @@
 };
 
-unsigned char page_one_v2[] = {
+static unsigned char page_one_v2[] __initdata = {
 0x01, 0xc0, 0x01, 0xfa, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -870,5 +878,5 @@
 };
 
-unsigned char page_two_v2[] = {
+static unsigned char page_two_v2[] __initdata = {
 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -877,5 +885,5 @@
 0x00, 0x00, 0x00, 0x00
 };
-unsigned char page_three_v2[] = {
+static unsigned char page_three_v2[] __initdata = {
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -884,5 +892,5 @@
 0x00, 0x00, 0x00, 0x00
 };
-unsigned char page_four_v2[] = {
+static unsigned char page_four_v2[] __initdata = {
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -892,5 +900,5 @@
 };
 
-unsigned char page_seven_v2[] = {
+static unsigned char page_seven_v2[] __initdata = {
 0x0f, 0xff, 0x0f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -903,5 +911,6 @@
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
-unsigned char mod_v2[] = {
+
+static unsigned char mod_v2[] __initdata = {
 0x01, 0x00, 0x02, 0x00, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x02,
 0x00, 0x01, 0x03, 0x02, 0x00, 0x01, 0x04, 0x02, 0x00, 0x01, 0x05,
@@ -933,5 +942,5 @@
 0x06, 0x02, 0x01, 0x01, 0x07, 0x02, 0x01
 };
-unsigned char coefficients[] = {
+static unsigned char coefficients[] __initdata = {
 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x00, 0x4b, 0x03,
 0x11, 0x00, 0x4d, 0x01, 0x32, 0x07, 0x46, 0x00, 0x00, 0x07, 0x49,
@@ -969,5 +978,5 @@
 0xba
 };
-unsigned char coefficients2[] = {
+static unsigned char coefficients2[] __initdata = {
 0x07, 0x46, 0x00, 0x00, 0x07, 0x49, 0x00, 0x00, 0x07, 0x45, 0x0f,
 0xff, 0x07, 0x48, 0x0f, 0xff, 0x07, 0x7b, 0x04, 0xcc, 0x07, 0x7d,
@@ -976,5 +985,5 @@
 0x07, 0x4a, 0x00, 0x00, 0x07, 0x4c, 0x00, 0x00, 0x07, 0x4e, 0x00, 0x00
 };
-unsigned char coefficients3[] = { 
+static unsigned char coefficients3[] __initdata = { 
 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x28, 0x00, 0x51, 0x00,
 0x51, 0x00, 0x7a, 0x00, 0x7a, 0x00, 0xa3, 0x00, 0xa3, 0x00, 0xcc,
@@ -1016,19 +1025,2 @@
 };
 
-EXPORT_SYMBOL(snd_wavefront_fx_start);
-EXPORT_SYMBOL(snd_wavefront_fx_detect);
-EXPORT_SYMBOL(snd_wavefront_fx_ioctl);
-EXPORT_SYMBOL(snd_wavefront_fx_open);
-EXPORT_SYMBOL(snd_wavefront_fx_release);
-
-static int __init alsa_wavefront_fx_init(void)
-{
-	return 0;
-}
-
-static void __exit alsa_wavefront_fx_exit(void)
-{
-}
-
-module_init(alsa_wavefront_fx_init)
-module_exit(alsa_wavefront_fx_exit)
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront_midi.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront_midi.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront_midi.c	(revision 112)
@@ -473,5 +473,5 @@
 }
 
-int
+int __init
 snd_wavefront_midi_start (snd_wavefront_card_t *card)
 
Index: GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront_synth.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront_synth.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/isa/wavefront/wavefront_synth.c	(revision 112)
@@ -21,6 +21,13 @@
  */
 
-#define SNDRV_MAIN_OBJECT_FILE
+#define __NO_VERSION__
 #include <sound/driver.h>
+#include <asm/io.h>
+#include <linux/interrupt.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/time.h>
+#include <linux/wait.h>
+#include <sound/core.h>
 #include <sound/snd_wavefront.h>
 #include <sound/initval.h>
@@ -78,7 +85,4 @@
 			      start running.
 			   */
-MODULE_AUTHOR("Paul Barton-Davis <pbd@op.net>");
-MODULE_DESCRIPTION("ALSA driver for Turtle Beach WaveFront ICS2215 Synth");
-MODULE_CLASSES("{sound}");
 MODULE_PARM(wf_raw,"i");
 MODULE_PARM_DESC(wf_raw, "if non-zero, assume that we need to boot the OS");
@@ -101,28 +105,4 @@
 MODULE_PARM(osrun_time,"i");
 MODULE_PARM_DESC(osrun_time, "how many seconds to wait for the ICS2115 OS");
-
-/*
- *	This sucks, hopefully it'll get standardised
- */
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,18) && LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-#define loops_per_sec loops_per_jiffy*HZ
-#elif LINUX_VERSION_CODE == KERNEL_VERSION(2,4,0) && defined(I_DIRTY_PAGES) /* linux/fs.h */
-#define loops_per_sec loops_per_jiffy*HZ
-#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
-#define loops_per_sec loops_per_jiffy*HZ
-#endif
- 
-#if defined(__alpha__) || defined(__powerpc__)
-#ifdef __SMP__
-#define LOOPS_PER_SEC	(cpu_data[smp_processor_id()].loops_per_sec)
-#else
-#define LOOPS_PER_SEC	(loops_per_sec)
-#endif
-#endif
-
-#if defined(__i386__)
-#define LOOPS_PER_SEC	(current_cpu_data.loops_per_sec)
-#endif
  
 /* if WF_DEBUG not defined, no run-time debugging messages will
@@ -255,4 +235,11 @@
 };
 
+static inline void
+dec_mod_count(struct module *module)
+{
+	if (module)
+		__MOD_DEC_USE_COUNT(module);
+}
+
 static const char *
 wavefront_errorstr (int errnum)
@@ -307,15 +294,4 @@
 {
 	int             i;
-	static int      short_loop_cnt = 0;
-
-	/* Compute the loop count that lets us sleep for about the
-	   right amount of time, cache issues, bus speeds and all
-	   other issues being unequal but largely irrelevant.
-	*/
-
-	if (short_loop_cnt == 0) {
-		short_loop_cnt = wait_usecs *
-			(LOOPS_PER_SEC / 1000000);
-	}
 
 	/* Spin for a short period of time, because >99% of all
@@ -323,8 +299,9 @@
 	*/
 
-	for (i = 0; i < short_loop_cnt; i++) {
+	for (i = 0; i < wait_usecs; i += 5) {
 		if (wavefront_status (dev) & mask) {
 			return 1;
 		}
+		udelay(5);
 	}
 
@@ -894,5 +871,5 @@
 wavefront_send_sample (snd_wavefront_t *dev, 
 		       wavefront_patch_info *header,
-		       UINT16 *dataptr,
+		       u16 *dataptr,
 		       int data_is_unsigned)
 
@@ -907,7 +884,7 @@
         */
 
-	UINT16 sample_short;
-	UINT32 length;
-	UINT16 *data_end = 0;
+	u16 sample_short;
+	u32 length;
+	u16 *data_end = 0;
 	unsigned int i;
 	const int max_blksize = 4096/2;
@@ -1059,11 +1036,11 @@
 	*/
 
-	shptr = munge_int32 (*((UINT32 *) &header->hdr.s.sampleStartOffset),
+	shptr = munge_int32 (*((u32 *) &header->hdr.s.sampleStartOffset),
 			     shptr, 4);
-	shptr = munge_int32 (*((UINT32 *) &header->hdr.s.loopStartOffset),
+	shptr = munge_int32 (*((u32 *) &header->hdr.s.loopStartOffset),
 			     shptr, 4);
-	shptr = munge_int32 (*((UINT32 *) &header->hdr.s.loopEndOffset),
+	shptr = munge_int32 (*((u32 *) &header->hdr.s.loopEndOffset),
 			     shptr, 4);
-	shptr = munge_int32 (*((UINT32 *) &header->hdr.s.sampleEndOffset),
+	shptr = munge_int32 (*((u32 *) &header->hdr.s.sampleEndOffset),
 			     shptr, 4);
 	
@@ -1302,16 +1279,19 @@
 	for (i = 0; i < num_samples; i++) {
 		char d[2];
-	
-		if ((d[0] = wavefront_read (dev)) == -1) {
+		int val;
+	
+		if ((val = wavefront_read (dev)) == -1) {
 			snd_printk ("upload multisample failed "
 				    "during sample loop.\n");
 			return -(EIO);
 		}
-
-		if ((d[1] = wavefront_read (dev)) == -1) {
+		d[0] = val;
+
+		if ((val = wavefront_read (dev)) == -1) {
 			snd_printk ("upload multisample failed "
 				    "during sample loop.\n");
 			return -(EIO);
 		}
+		d[1] = val;
 	
 		header->hdr.ms.SampleNumber[i] =
@@ -1472,9 +1452,9 @@
 
 static void
-process_sample_hdr (UCHAR8 *buf)
+process_sample_hdr (u8 *buf)
 
 {
 	wavefront_sample s;
-	UCHAR8 *ptr;
+	u8 *ptr;
 
 	ptr = buf;
@@ -1487,9 +1467,9 @@
 	*/
 
-	*((UINT32 *) &s.sampleStartOffset) = demunge_int32 (ptr, 4); ptr += 4;
-	*((UINT32 *) &s.loopStartOffset) = demunge_int32 (ptr, 4); ptr += 4;
-	*((UINT32 *) &s.loopEndOffset) = demunge_int32 (ptr, 4); ptr += 4;
-	*((UINT32 *) &s.sampleEndOffset) = demunge_int32 (ptr, 4); ptr += 4;
-	*((UINT32 *) &s.FrequencyBias) = demunge_int32 (ptr, 3); ptr += 3;
+	*((u32 *) &s.sampleStartOffset) = demunge_int32 (ptr, 4); ptr += 4;
+	*((u32 *) &s.loopStartOffset) = demunge_int32 (ptr, 4); ptr += 4;
+	*((u32 *) &s.loopEndOffset) = demunge_int32 (ptr, 4); ptr += 4;
+	*((u32 *) &s.sampleEndOffset) = demunge_int32 (ptr, 4); ptr += 4;
+	*((u32 *) &s.FrequencyBias) = demunge_int32 (ptr, 3); ptr += 3;
 
 	s.SampleResolution = *ptr & 0x3;
@@ -1558,5 +1538,5 @@
 
 	case WFC_UPLOAD_PATCH:
-		munge_int32 (*((UINT32 *) wc->wbuf), patchnumbuf, 2);
+		munge_int32 (*((u32 *) wc->wbuf), patchnumbuf, 2);
 		memcpy (wc->wbuf, patchnumbuf, 2);
 		break;
@@ -1748,5 +1728,5 @@
 */
 
-int
+int __init
 snd_wavefront_interrupt_bits (int irq)
 
@@ -1776,5 +1756,5 @@
 }
 
-static void
+static void __init
 wavefront_should_cause_interrupt (snd_wavefront_t *dev, 
 				  int val, int port, int timeout)
@@ -1791,64 +1771,5 @@
 }
 
-int
-snd_wavefront_detect_irq (snd_wavefront_t *dev) 
-
-{
-	int i;
-	int possible_irqs[] = { 5, 9, 12, 15, -1 };
-
-	/* Note: according to the PnP dump, 7 and 11 are possible too, but the
-	   WaveFront SDK doesn't tell us how to set the card to use them.  
-	*/
-
-	snd_printk ("autodetecting WaveFront IRQ\n");
-
-	for (i = 0; possible_irqs[i] > 0; i++) {
-		if (snd_wavefront_check_irq (dev, possible_irqs[i]) == 0) {
-			snd_printk ("autodetected IRQ %d\n", 
-				    possible_irqs[i]);
-			return possible_irqs[i];
-		}
-	}
-
-	return -1;
-}
-
-int
-snd_wavefront_check_irq (snd_wavefront_t *dev, int irq)
-
-{
-	int bits;
-	unsigned long irq_mask;
-	short reported_irq;
-
-	bits = snd_wavefront_interrupt_bits (irq);
-
-	irq_mask = probe_irq_on ();
-
-	outb (0x0, dev->control_port); 
-	outb (0x80 | 0x40 | bits, dev->data_port);	
-	wavefront_should_cause_interrupt(dev, 0x80|0x40|0x10|0x1,
-					 dev->control_port,
-					 (reset_time*HZ)/100);
-
-	reported_irq = probe_irq_off (irq_mask);
-
-	if (reported_irq == 0) {
-		snd_printk ("No unassigned interrupts detected "
-			    "after h/w reset\n");
-		return -1;
-	} else if (reported_irq < 0) {
-		snd_printk ("Multiple unassigned interrupts detected "
-			    "after h/w reset\n");
-		return -1;
-	} else if (reported_irq != irq) {
-		return -1;
-	}
-
-	return 0; /* OK */
-}
-
-static int
+static int __init
 wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
 
@@ -2004,5 +1925,5 @@
 #include <linux/fs.h>
 #include <linux/mm.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 #include <linux/unistd.h>
 #include <asm/uaccess.h>
@@ -2010,5 +1931,5 @@
 static int errno;
 
-static int
+static int __init
 wavefront_download_firmware (snd_wavefront_t *dev, char *path)
 
@@ -2105,5 +2026,5 @@
 
 
-static int
+static int __init
 wavefront_do_reset (snd_wavefront_t *dev)
 
@@ -2194,5 +2115,5 @@
 }
 
-int 
+int __init
 snd_wavefront_start (snd_wavefront_t *dev)
 
@@ -2236,5 +2157,5 @@
 }
 
-int
+int __init
 snd_wavefront_detect (snd_wavefront_card_t *card)
 
@@ -2290,32 +2211,2 @@
 	return 0;
 }
-
-EXPORT_SYMBOL(snd_wavefront_synth_ioctl);
-EXPORT_SYMBOL(snd_wavefront_synth_open);
-EXPORT_SYMBOL(snd_wavefront_synth_release);
-EXPORT_SYMBOL(snd_wavefront_internal_interrupt);
-EXPORT_SYMBOL(snd_wavefront_interrupt_bits);
-EXPORT_SYMBOL(snd_wavefront_detect_irq);
-EXPORT_SYMBOL(snd_wavefront_check_irq);
-EXPORT_SYMBOL(snd_wavefront_start);
-EXPORT_SYMBOL(snd_wavefront_detect);
-EXPORT_SYMBOL(snd_wavefront_cmd);
-  /* wavefront_midi.c */
-EXPORT_SYMBOL(snd_wavefront_midi_interrupt);
-EXPORT_SYMBOL(snd_wavefront_midi_enable_virtual);
-EXPORT_SYMBOL(snd_wavefront_midi_disable_virtual);
-EXPORT_SYMBOL(snd_wavefront_midi_start);
-EXPORT_SYMBOL(snd_wavefront_midi_input);
-EXPORT_SYMBOL(snd_wavefront_midi_output);
-
-static int __init alsa_wavefront_init(void)
-{
-	return 0;
-}
-
-static void __exit alsa_wavefront_exit(void)
-{
-}
-
-module_init(alsa_wavefront_init)
-module_exit(alsa_wavefront_exit)
Index: GPL/branches/alsa-resync1/alsa-kernel/pci/es1968.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/pci/es1968.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/pci/es1968.c	(revision 112)
@@ -1917,5 +1917,5 @@
     es->count += diff;
 
-	while (es->count > es->frag_size) {
+	if (es->count > es->frag_size) {
         spin_unlock(&chip->substream_lock);
         snd_pcm_period_elapsed(subs);
Index: GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/pci/ice1712.c	(revision 112)
@@ -99,4 +99,5 @@
 #define ICE1712_SUBDEVICE_DELTA44	0x121433d6
 #define ICE1712_SUBDEVICE_AUDIOPHILE	0x121434d6
+#define ICE1712_SUBDEVICE_DELTA1010LT	0x12143bd6
 #define ICE1712_SUBDEVICE_EWX2496	0x3b153011
 #define ICE1712_SUBDEVICE_EWS88MT	0x3b151511
@@ -1185,4 +1186,5 @@
 		nval |= 0x04;
 	if (val != nval) {
+		reg[1] = nval;
 		if (snd_i2c_sendbytes(ice->cs8427, reg, 2) != 2) {
 			snd_i2c_unlock(ice->i2c);
@@ -4540,5 +4542,5 @@
 				    const struct pci_device_id *id)
 {
-	static int dev = 0;
+	static int dev;
 	snd_card_t *card;
 	ice1712_t *ice;
@@ -4609,4 +4611,7 @@
 	case ICE1712_SUBDEVICE_AUDIOPHILE:
 		strcpy(card->shortname, "M Audio Audiophile 24/96");
+		break;
+	case ICE1712_SUBDEVICE_DELTA1010LT:
+		strcpy(card->shortname, "M Audio Delta 1010LT");
 		break;
 	case ICE1712_SUBDEVICE_EWX2496:
Index: GPL/branches/alsa-resync1/alsa-kernel/pci/korg1212/korg1212.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/pci/korg1212/korg1212.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/pci/korg1212/korg1212.c	(revision 112)
@@ -2250,5 +2250,5 @@
 		const struct pci_device_id *id)
 {
-	static int dev = 0;
+	static int dev;
 	korg1212_t *korg1212;
 	snd_card_t *card;
Index: GPL/branches/alsa-resync1/alsa-kernel/pci/rme96.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/pci/rme96.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/pci/rme96.c	(revision 112)
@@ -2666,5 +2666,5 @@
 		const struct pci_device_id *id)
 {
-	static int dev = 0;
+	static int dev;
 	rme96_t *rme96;
 	snd_card_t *card;
Index: GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/rme9652.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/rme9652.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/pci/rme9652/rme9652.c	(revision 112)
@@ -2890,5 +2890,5 @@
 			     const struct pci_device_id *id)
 {
-	static int dev = 0;
+	static int dev;
 	rme9652_t *rme9652;
 	snd_card_t *card;
Index: GPL/branches/alsa-resync1/alsa-kernel/pci/sonicvibes.c
===================================================================
--- GPL/branches/alsa-resync1/alsa-kernel/pci/sonicvibes.c	(revision 111)
+++ GPL/branches/alsa-resync1/alsa-kernel/pci/sonicvibes.c	(revision 112)
@@ -19,10 +19,14 @@
  *   You should have received a copy of the GNU General Public License
  *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
  */
 
-#define SNDRV_MAIN_OBJECT_FILE
 #include <sound/driver.h>
+#include <asm/io.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
@@ -32,7 +36,13 @@
 #define SNDRV_GET_ID
 #include <sound/initval.h>
+#ifndef LINUX_2_2
+#include <linux/gameport.h>
+#endif
 
 EXPORT_NO_SYMBOLS;
+
+MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
 MODULE_DESCRIPTION("S3 SonicVibes PCI");
+MODULE_LICENSE("GPL");
 MODULE_CLASSES("{sound}");
 MODULE_DEVICES("{{S3,SonicVibes PCI}}");
@@ -47,5 +57,5 @@
 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
 static char *snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
-static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;	/* Enable this card */
+static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;	/* Enable this card */
 #ifdef TARGET_OS2
 static int snd_reverb[SNDRV_CARDS] = {0,0,0,0,0,0,0,0};
@@ -250,4 +260,8 @@
 	snd_kcontrol_t *master_mute;
 	snd_kcontrol_t *master_volume;
+
+#ifndef LINUX_2_2
+	struct gameport gameport;
+#endif
 };
 
@@ -940,5 +954,5 @@
 }
 
-static int __init snd_sonicvibes_pcm(sonicvibes_t * sonic, int device, snd_pcm_t ** rpcm)
+static int __devinit snd_sonicvibes_pcm(sonicvibes_t * sonic, int device, snd_pcm_t ** rpcm)
 {
 	snd_pcm_t *pcm;
@@ -1179,5 +1193,5 @@
 #define SONICVIBES_CONTROLS (sizeof(snd_sonicvibes_controls)/sizeof(snd_kcontrol_new_t))
 
-static snd_kcontrol_new_t snd_sonicvibes_controls[] = {
+static snd_kcontrol_new_t snd_sonicvibes_controls[] __devinitdata = {
 SONICVIBES_DOUBLE("Capture Volume", 0, SV_IREG_LEFT_ADC, SV_IREG_RIGHT_ADC, 0, 0, 15, 0),
 SONICVIBES_DOUBLE("Aux Playback Switch", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 7, 7, 1, 1),
@@ -1210,5 +1224,5 @@
 }
 
-static int __init snd_sonicvibes_mixer(sonicvibes_t * sonic)
+static int __devinit snd_sonicvibes_mixer(sonicvibes_t * sonic)
 {
 	snd_card_t *card;
@@ -1265,5 +1279,5 @@
 }
 
-static void __init snd_sonicvibes_proc_init(sonicvibes_t * sonic)
+static void __devinit snd_sonicvibes_proc_init(sonicvibes_t * sonic)
 {
 	snd_info_entry_t *entry;
@@ -1295,24 +1309,40 @@
  */
 
-static snd_kcontrol_new_t snd_sonicvibes_game_control =
+static snd_kcontrol_new_t snd_sonicvibes_game_control __devinitdata =
 SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0);
 
 static int snd_sonicvibes_free(sonicvibes_t *sonic)
 {
+#ifndef LINUX_2_2
+	if (sonic->gameport.io)
+		gameport_unregister_port(&sonic->gameport);
+#endif
 	snd_sonicvibes_proc_done(sonic);
 	pci_write_config_dword(sonic->pci, 0x40, sonic->dmaa_port);
 	pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port);
-	if (sonic->res_sb_port)
+	if (sonic->res_sb_port) {
 		release_resource(sonic->res_sb_port);
-	if (sonic->res_enh_port)
+		kfree_nocheck(sonic->res_sb_port);
+	}
+	if (sonic->res_enh_port) {
 		release_resource(sonic->res_enh_port);
-	if (sonic->res_synth_port)
+		kfree_nocheck(sonic->res_enh_port);
+	}
+	if (sonic->res_synth_port) {
 		release_resource(sonic->res_synth_port);
-	if (sonic->res_midi_port)
+		kfree_nocheck(sonic->res_synth_port);
+	}
+	if (sonic->res_midi_port) {
 		release_resource(sonic->res_midi_port);
-	if (sonic->res_dmaa)
+		kfree_nocheck(sonic->res_midi_port);
+	}
+	if (sonic->res_dmaa) {
 		release_resource(sonic->res_dmaa);
-	if (sonic->res_dmac)
+		kfree_nocheck(sonic->res_dmaa);
+	}
+	if (sonic->res_dmac) {
 		release_resource(sonic->res_dmac);
+		kfree_nocheck(sonic->res_dmac);
+	}
 	if (sonic->irq >= 0)
 		free_irq(sonic->irq, (void *)sonic);
@@ -1327,5 +1357,5 @@
 }
 
-static int __init snd_sonicvibes_create(snd_card_t * card,
+static int __devinit snd_sonicvibes_create(snd_card_t * card,
 					struct pci_dev *pci,
 					int reverb,
@@ -1496,5 +1526,5 @@
 #define SONICVIBES_MIDI_CONTROLS (sizeof(snd_sonicvibes_midi_controls)/sizeof(snd_kcontrol_new_t))
 
-static snd_kcontrol_new_t snd_sonicvibes_midi_controls[] = {
+static snd_kcontrol_new_t snd_sonicvibes_midi_controls[] __devinitdata = {
 SONICVIBES_SINGLE("SonicVibes Wave Source RAM", 0, SV_IREG_WAVE_SOURCE, 0, 1, 0),
 SONICVIBES_SINGLE("SonicVibes Wave Source RAM+ROM", 0, SV_IREG_WAVE_SOURCE, 1, 1, 0),
@@ -1504,8 +1534,9 @@
 };
 
-static void snd_sonicvibes_midi_input_open(mpu401_t * mpu)
-{
-	sonicvibes_t *sonic = snd_magic_cast(sonicvibes_t, mpu->private_data, return);
+static int snd_sonicvibes_midi_input_open(mpu401_t * mpu)
+{
+	sonicvibes_t *sonic = snd_magic_cast(sonicvibes_t, mpu->private_data, return -EIO);
 	outb(sonic->irqmask &= ~SV_MIDI_MASK, SV_REG(sonic, IRQMASK));
+	return 0;
 }
 
@@ -1516,5 +1547,5 @@
 }
 
-static int snd_sonicvibes_midi(sonicvibes_t * sonic, snd_rawmidi_t * rmidi)
+static int __devinit snd_sonicvibes_midi(sonicvibes_t * sonic, snd_rawmidi_t * rmidi)
 {
 	mpu401_t * mpu = snd_magic_cast(mpu401_t, rmidi->private_data, return -ENXIO);
@@ -1533,8 +1564,8 @@
 }
 
-static int __init snd_sonic_probe(struct pci_dev *pci,
+static int __devinit snd_sonic_probe(struct pci_dev *pci,
 				  const struct pci_device_id *id)
 {
-	static int dev = 0;
+	static int dev;
 	snd_card_t *card;
 	sonicvibes_t *sonic;
@@ -1543,13 +1574,10 @@
 	int idx, err;
 
-	for ( ; dev < SNDRV_CARDS; dev++) {
+	if (dev >= SNDRV_CARDS)
+		return -ENODEV;
 		if (!snd_enable[dev]) {
 			dev++;
 			return -ENOENT;
 		}
-		break;
-	}
-	if (dev >= SNDRV_CARDS)
-		return -ENODEV;
  
 	card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, 0);
@@ -1596,4 +1624,8 @@
 		return err;
 	}
+#ifndef LINUX_2_2
+	sonic->gameport.io = sonic->game_port;
+	gameport_register_port(&sonic->gameport);
+#endif
 	strcpy(card->driver, "SonicVibes");
 	strcpy(card->shortname, "S3 SonicVibes");
@@ -1609,13 +1641,13 @@
 	}
 	
-	PCI_SET_DRIVER_DATA(pci, card);
+	pci_set_drvdata(pci, card);
 	dev++;
 	return 0;
 }
 
-static void __exit snd_sonic_remove(struct pci_dev *pci)
-{
-	snd_card_free(PCI_GET_DRIVER_DATA(pci));
-	PCI_SET_DRIVER_DATA(pci, NULL);
+static void __devexit snd_sonic_remove(struct pci_dev *pci)
+{
+	snd_card_free(pci_get_drvdata(pci));
+	pci_set_drvdata(pci, NULL);
 }
 
@@ -1632,5 +1664,5 @@
 	id_table: snd_sonic_ids,
 	probe: snd_sonic_probe,
-	remove: snd_sonic_remove,
+	remove: __devexit_p(snd_sonic_remove),
 #endif
 };
@@ -1642,5 +1674,5 @@
 	if ((err = pci_module_init(&driver)) < 0) {
 #ifdef MODULE
-//		snd_printk("S3 SonicVibes soundcard not found or device busy\n");
+//		printk(KERN_ERR "S3 SonicVibes soundcard not found or device busy\n");
 #endif
 		return err;
@@ -1659,5 +1691,5 @@
 #ifndef MODULE
 
-/* format is: snd-card-sonicvibes=snd_enable,snd_index,snd_id,
+/* format is: snd-sonicvibes=snd_enable,snd_index,snd_id,
 				  snd_reverb,snd_mge,snd_dmaio */
 
@@ -1678,5 +1710,5 @@
 }
 
-__setup("snd-card-sonicvibes=", alsa_card_sonicvibes_setup);
+__setup("snd-sonicvibes=", alsa_card_sonicvibes_setup);
 
 #endif /* ifndef MODULE */
