diff -u ./audio.c ../emu10k1-mainline-kernel/audio.c
--- ./audio.c	Sun Oct 20 15:15:30 2002
+++ ../emu10k1-mainline-kernel/audio.c	Sun Oct 20 15:16:10 2002
@@ -62,8 +62,6 @@
 	ssize_t ret = 0;
 	unsigned long flags;
 
-	GET_INODE_STRUCT();
-
 	DPD(3, "emu10k1_audio_read(), buffer=%p, count=%d\n", buffer, (u32) count);
 
 	if (ppos != &file->f_pos)
@@ -88,9 +86,7 @@
 			if (file->f_flags & O_NONBLOCK)
 				return -EAGAIN;
 
-			UP_INODE_SEM(&inode->i_sem);
 			interruptible_sleep_on(&wave_dev->card->open_wait);
-			DOWN_INODE_SEM(&inode->i_sem);
 
 			if (signal_pending(current))
 				return -ERESTARTSYS;
@@ -133,9 +129,7 @@
 			    || (!(wave_dev->enablebits & PCM_ENABLE_INPUT)))
 				return (ret ? ret : -EAGAIN);
 
-			UP_INODE_SEM(&inode->i_sem);
 			interruptible_sleep_on(&wiinst->wait_queue);
-			DOWN_INODE_SEM(&inode->i_sem);
 
 			if (signal_pending(current))
 				return (ret ? ret : -ERESTARTSYS);
@@ -155,8 +149,6 @@
 	ssize_t ret;
 	unsigned long flags;
 
-	GET_INODE_STRUCT();
-
 	DPD(3, "emu10k1_audio_write(), buffer=%p, count=%d\n", buffer, (u32) count);
 
 	if (ppos != &file->f_pos)
@@ -193,9 +185,7 @@
 			if (file->f_flags & O_NONBLOCK)
 				return -EAGAIN;
 
-			UP_INODE_SEM(&inode->i_sem);
 			interruptible_sleep_on(&wave_dev->card->open_wait);
-			DOWN_INODE_SEM(&inode->i_sem);
 
 			if (signal_pending(current))
 				return -ERESTARTSYS;
@@ -249,9 +239,7 @@
 			    || (!(wave_dev->enablebits & PCM_ENABLE_OUTPUT)))
 				return (ret ? ret : -EAGAIN);
 
-			UP_INODE_SEM(&inode->i_sem);
 			interruptible_sleep_on(&woinst->wait_queue);
-			DOWN_INODE_SEM(&inode->i_sem);
 
 			if (signal_pending(current))
 				return (ret ? ret : -ERESTARTSYS);
@@ -293,16 +281,6 @@
 			spin_lock_irqsave(&woinst->lock, flags);
 
 			if (woinst->state & WAVE_STATE_OPEN) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-				if (woinst->mmapped) {
-					int i;
-
-					/* Undo marking the pages as reserved */
-					for (i = 0; i < woinst->buffer.pages; i++)
-						mem_map_unreserve(MAP_NR(woinst->voice[0].mem.addr[i]));
-
-				}
-#endif
 				emu10k1_waveout_close(wave_dev);
 			}
 
@@ -318,16 +296,6 @@
 			spin_lock_irqsave(&wiinst->lock, flags);
 
 			if (wiinst->state & WAVE_STATE_OPEN) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-				if (wiinst->mmapped) {
-					int i;
-
-					/* Undo marking the pages as reserved */
-					for (i = 0; i < wiinst->buffer.pages; i++)
-						mem_map_unreserve(MAP_NR((u8 *) wiinst->buffer.addr + i * PAGE_SIZE));
-
-				}
-#endif
 				emu10k1_wavein_close(wave_dev);
 			}
 
@@ -355,16 +323,6 @@
 						interruptible_sleep_on(&woinst->wait_queue);
 						spin_lock_irqsave(&woinst->lock, flags);
 					}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-				if (woinst->mmapped) {
-					int i;
-
-					/* Undo marking the pages as reserved */
-					for (i = 0; i < woinst->buffer.pages; i++)
-						mem_map_unreserve(MAP_NR(woinst->voice[0].mem.addr[i]));
-
-				}
-#endif
 				emu10k1_waveout_close(wave_dev);
 			}
 
@@ -380,16 +338,6 @@
 			spin_lock_irqsave(&wiinst->lock, flags);
 
 			if (wiinst->state & WAVE_STATE_OPEN) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-				if (wiinst->mmapped) {
-					int i;
-
-					/* Undo marking the pages as reserved */
-					for (i = 0; i < wiinst->buffer.pages; i++)
-						mem_map_unreserve(MAP_NR((u8 *) wiinst->buffer.addr + i * PAGE_SIZE));
-
-				}
-#endif
 				emu10k1_wavein_close(wave_dev);
 			}
 
@@ -1052,7 +1000,6 @@
 	return 0;
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 static struct page *emu10k1_mm_nopage (struct vm_area_struct * vma, unsigned long address, int write_access)
 {
 	struct emu10k1_wavedevice *wave_dev = vma->vm_private_data;
@@ -1103,15 +1050,10 @@
 	nopage:         emu10k1_mm_nopage,
 };
 
-#endif
-
 static int emu10k1_audio_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) file->private_data;
 	unsigned long max_pages, n_pages, pgoffset;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-	unsigned long offset;
-#endif
 	struct woinst *woinst = NULL;
 	struct wiinst *wiinst = NULL;
 	unsigned long flags;
@@ -1165,7 +1107,7 @@
 	}
 
 	n_pages = ((vma->vm_end - vma->vm_start) + PAGE_SIZE - 1) >> PAGE_SHIFT;
-	pgoffset = vma_get_pgoff(vma);
+	pgoffset = vma->vm_pgoff;
 
 	DPD(2, "vma_start: %#lx, vma_end: %#lx, vma_offset: %ld\n", vma->vm_start, vma->vm_end, pgoffset);
 	DPD(2, "n_pages: %ld, max_pages: %ld\n", n_pages, max_pages);
@@ -1173,29 +1115,9 @@
 	if (pgoffset + n_pages > max_pages)
 		return -EINVAL;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	vma->vm_flags |= VM_RESERVED;
 	vma->vm_ops = &emu10k1_mm_ops;
 	vma->vm_private_data = wave_dev;
-#else
-	for (offset = pgoffset; offset < pgoffset + n_pages; offset++)
-	{
-		void *pgaddr;
-
-	        if (woinst != NULL) {
-			if (offset >= woinst->buffer.pages) {
-				pgaddr = (u8 *)wiinst->buffer.addr + (offset - woinst->buffer.pages) * PAGE_SIZE;
-			} else {
-				pgaddr = woinst->voice[0].mem.addr[offset];
-			}
-		} else {
-			pgaddr = (u8 *)wiinst->buffer.addr + offset * PAGE_SIZE;
-		}
-
-		mem_map_reserve(MAP_NR(pgaddr));
-		remap_page_range(vma->vm_start + (offset - pgoffset) * PAGE_SIZE, virt_to_phys(pgaddr), PAGE_SIZE, vma->vm_page_prot);
-        }
-#endif
 	return 0;
 }
 
@@ -1220,13 +1142,11 @@
 	return -ENODEV;
 
 match:
-	MOD_INC_USE_COUNT;
 
 	wave_dev = (struct emu10k1_wavedevice *) kmalloc(sizeof(struct emu10k1_wavedevice), GFP_KERNEL);
 
 	if (wave_dev == NULL) { 
 		ERROR();
-		MOD_DEC_USE_COUNT;
 		return -ENOMEM;
 	}
 
@@ -1241,7 +1161,6 @@
 
 		if ((wiinst = (struct wiinst *) kmalloc(sizeof(struct wiinst), GFP_KERNEL)) == NULL) {
 			ERROR();
-			MOD_DEC_USE_COUNT;
 			return -ENODEV;
 		}
 
@@ -1295,7 +1214,6 @@
 
 		if ((woinst = (struct woinst *) kmalloc(sizeof(struct woinst), GFP_KERNEL)) == NULL) {
 			ERROR();
-			MOD_DEC_USE_COUNT;
 			return -ENODEV;
 		}
 
@@ -1372,15 +1290,6 @@
 					}
 				}
 			}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-			if (woinst->mmapped) {
-				int i;
-
-				/* Undo marking the pages as reserved */
-				for (i = 0; i < woinst->buffer.pages; i++)
-					mem_map_unreserve(MAP_NR(woinst->voice[0].mem.addr[i]));
-			}
-#endif
 			emu10k1_waveout_close(wave_dev);
 		}
 
@@ -1396,15 +1305,6 @@
 		spin_lock_irqsave(&wiinst->lock, flags);
 
 		if (wiinst->state & WAVE_STATE_OPEN) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-			if (wiinst->mmapped) {
-				int i;
-
-				/* Undo marking the pages as reserved */
-				for (i = 0; i < wiinst->buffer.pages; i++)
-					mem_map_unreserve(MAP_NR((u8 *) wiinst->buffer.addr + i * PAGE_SIZE));
-			}
-#endif
 			emu10k1_wavein_close(wave_dev);
 		}
 
@@ -1418,8 +1318,6 @@
 	if (waitqueue_active(&card->open_wait))
 		wake_up_interruptible(&card->open_wait);
 
-	MOD_DEC_USE_COUNT;
-
 	return 0;
 }
 
@@ -1685,9 +1583,7 @@
 }
 
 struct file_operations emu10k1_audio_fops = {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	owner:		THIS_MODULE,
-#endif
 	llseek:		no_llseek,
 	read:		emu10k1_audio_read,
 	write:		emu10k1_audio_write,
diff -u ./hwaccess.h ../emu10k1-mainline-kernel/hwaccess.h
--- ./hwaccess.h	Sun Sep 22 15:45:12 2002
+++ ../emu10k1-mainline-kernel/hwaccess.h	Sun Oct 20 15:16:10 2002
@@ -35,12 +35,11 @@
 #include <linux/fs.h>
 #include <linux/sound.h>
 #include <linux/soundcard.h>
-#include "ac97_codec.h"
+#include <linux/ac97_codec.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
 #include <asm/io.h>
-#include <emu_wrapper.h>
 
 #include "efxmgr.h"
 #include "passthrough.h"
diff -u ./main.c ../emu10k1-mainline-kernel/main.c
--- ./main.c	Sun Sep 22 15:55:18 2002
+++ ../emu10k1-mainline-kernel/main.c	Sun Oct 20 15:16:10 2002
@@ -109,8 +109,8 @@
 #define MIDI_SYNTH_NAME "EMU10K1 MIDI"
 #define MIDI_SYNTH_CAPS SYNTH_CAP_INPUT
  
-#include "sound_config.h"
-#include "midi_synth.h"
+#include "../sound_config.h"
+#include "../midi_synth.h"
 
 /* this should be in dev_table.h */
 #define SNDCARD_EMU10K1 46
@@ -248,7 +248,6 @@
 	unregister_sound_dsp(card->audio_dev);
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 int emu10k1_info_proc (char *page, char **start, off_t off,
 		    int count, int *eof, void *data)
 {
@@ -325,13 +324,10 @@
 	remove_proc_entry("driver/emu10k1", NULL);
 }
 
-#endif
-
 static int __devinit emu10k1_mixer_init(struct emu10k1_card *card)
 {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	char s[32];
-#endif
+
 	struct ac97_codec *codec = &card->ac97;
 	card->ac97.dev_mixer = register_sound_mixer(&emu10k1_mixer_fops, -1);
 	if (card->ac97.dev_mixer < 0) {
@@ -360,13 +356,11 @@
 		// Force 5bit:		    
 		//card->ac97.bit_resolution=5;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)	
 		sprintf(s, "driver/emu10k1/%s/ac97", card->pci_dev->slot_name);
 		if (!create_proc_read_entry (s, 0, 0, ac97_read_proc, &card->ac97)) {
 			printk(KERN_ERR "emu10k1: unable to create proc entry %s\n", s);
 			goto err_out;
 		}
-#endif
 
 		/* these will store the original values and never be modified */
 		card->ac97_supported_mixers = card->ac97.supported_mixers;
@@ -382,14 +376,12 @@
 
 static void __devinit emu10k1_mixer_cleanup(struct emu10k1_card *card)
 {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	char s[32];
 
 	if (!card->is_aps) {
 		sprintf(s, "driver/emu10k1/%s/ac97", card->pci_dev->slot_name);
 		remove_proc_entry(s, NULL);
 	}
-#endif
 
 	unregister_sound_mixer (card->ac97.dev_mixer);
 }
@@ -1246,7 +1238,7 @@
 	card->iobase = pci_resource_start(pci_dev, 0);
 	card->length = pci_resource_len(pci_dev, 0); 
 
-	if (compat_request_region(card->iobase, card->length, card_names[pci_id->driver_data]) == NULL) {
+	if (request_region(card->iobase, card->length, card_names[pci_id->driver_data]) == NULL) {
 		printk(KERN_ERR "emu10k1: IO space in use\n");
 		ret = -EBUSY;
 		goto err_region;
@@ -1288,13 +1280,11 @@
                 goto err_audio;
         }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	ret = emu10k1_proc_init(card);
 	if(ret < 0) {
 		printk(KERN_ERR "emu10k1: cannot initialize proc directory\n");
                 goto err_proc;
 	}
-#endif
 
 	ret = emu10k1_mixer_init(card);
 	if(ret < 0) {
@@ -1328,12 +1318,9 @@
 	emu10k1_mixer_cleanup(card);
 
 err_mixer:
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-
 	emu10k1_proc_cleanup(card);
 
 err_proc:
-#endif
 	emu10k1_audio_cleanup(card);
 
 err_audio:
@@ -1359,9 +1346,7 @@
 	emu10k1_cleanup(card);
 	emu10k1_midi_cleanup(card);
 	emu10k1_mixer_cleanup(card);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	emu10k1_proc_cleanup(card);
-#endif
 	emu10k1_audio_cleanup(card);	
 	free_irq(card->irq, card);
 	release_region(card->iobase, card->length);
@@ -1397,15 +1382,6 @@
 module_init(emu10k1_init_module);
 module_exit(emu10k1_cleanup_module);
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-#ifndef MODULE
-int __init init_emu10k1(void)
-{
-	return emu10k1_init_module();
-}
-#endif
-#endif
-
 #ifdef EMU10K1_SEQUENCER
 
 /* in midi.c */
@@ -1421,9 +1397,7 @@
 
 static struct midi_operations emu10k1_midi_operations =
 {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	THIS_MODULE,
-#endif
 	{"EMU10K1 MIDI", 0, 0, SNDCARD_EMU10K1},
 	&std_midi_synth,
 	{0},
diff -u ./midi.c ../emu10k1-mainline-kernel/midi.c
--- ./midi.c	Sun May 26 16:42:57 2002
+++ ../emu10k1-mainline-kernel/midi.c	Sun Oct 20 15:16:10 2002
@@ -44,7 +44,7 @@
 #include "midi.h"
 
 #ifdef EMU10K1_SEQUENCER
-#include "sound_config.h"
+#include "../sound_config.h"
 #endif
 
 static spinlock_t midi_spinlock __attribute((unused)) = SPIN_LOCK_UNLOCKED;
@@ -110,15 +110,12 @@
 	if (card->seq_mididev)	/* card is opened by sequencer */
 		return -EBUSY;
 #endif
-	
-	MOD_INC_USE_COUNT;
 
 	/* Wait for device to become free */
 	down(&card->open_sem);
 	while (card->open_mode & (file->f_mode << FMODE_MIDI_SHIFT)) {
 		if (file->f_flags & O_NONBLOCK) {
 			up(&card->open_sem);
-			MOD_DEC_USE_COUNT;
 			return -EBUSY;
 		}
 
@@ -126,17 +123,14 @@
 		interruptible_sleep_on(&card->open_wait);
 
 		if (signal_pending(current)) {
-			MOD_DEC_USE_COUNT;
 			return -ERESTARTSYS;
 		}
 
 		down(&card->open_sem);
 	}
 
-	if ((midi_dev = (struct emu10k1_mididevice *) kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) {
-		MOD_DEC_USE_COUNT;
+	if ((midi_dev = (struct emu10k1_mididevice *) kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL)
 		return -EINVAL;
-	}
 
 	midi_dev->card = card;
 	midi_dev->mistate = MIDIIN_STATE_STOPPED;
@@ -157,14 +151,12 @@
 		if (emu10k1_mpuin_open(card, &dsCardMidiOpenInfo) < 0) {
 			ERROR();
 			kfree(midi_dev);
-			MOD_DEC_USE_COUNT;
 			return -ENODEV;
 		}
 
 		/* Add two buffers to receive sysex buffer */
 		if (midiin_add_buffer(midi_dev, &midihdr1) < 0) {
 			kfree(midi_dev);
-			MOD_DEC_USE_COUNT;
 			return -ENODEV;
 		}
 
@@ -173,7 +165,6 @@
 			kfree(midihdr1->data);
 			kfree(midihdr1);
 			kfree(midi_dev);
-			MOD_DEC_USE_COUNT;
 			return -ENODEV;
 		}
 	}
@@ -186,7 +177,6 @@
 		if (emu10k1_mpuout_open(card, &dsCardMidiOpenInfo) < 0) {
 			ERROR();
 			kfree(midi_dev);
-			MOD_DEC_USE_COUNT;
 			return -ENODEV;
 		}
 	}
@@ -205,9 +195,8 @@
 	struct emu10k1_mididevice *midi_dev = (struct emu10k1_mididevice *) file->private_data;
 	struct emu10k1_card *card;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	lock_kernel();
-#endif
+
 	card = midi_dev->card;
 	DPF(2, "emu10k1_midi_release()\n");
 
@@ -252,10 +241,7 @@
 	up(&card->open_sem);
 	wake_up_interruptible(&card->open_wait);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	unlock_kernel();
-#endif
-	MOD_DEC_USE_COUNT;
 
 	return 0;
 }
@@ -480,9 +466,7 @@
 
 /* MIDI file operations */
 struct file_operations emu10k1_midi_fops = {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	owner:		THIS_MODULE,
-#endif
 	read:		emu10k1_midi_read,
 	write:		emu10k1_midi_write,
 	poll:		emu10k1_midi_poll,
@@ -513,10 +497,8 @@
 			
 	DPF(2, "emu10k1_seq_midi_open()\n");
 	
-	if ((midi_dev = (struct emu10k1_mididevice *) kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) {
-		MOD_DEC_USE_COUNT;
+	if ((midi_dev = (struct emu10k1_mididevice *) kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL)
 		return -EINVAL;
-	}
 
 	midi_dev->card = card;
 	midi_dev->mistate = MIDIIN_STATE_STOPPED;
diff -u ./mixer.c ../emu10k1-mainline-kernel/mixer.c
--- ./mixer.c	Sun May 26 16:42:57 2002
+++ ../emu10k1-mainline-kernel/mixer.c	Sun Oct 20 15:16:10 2002
@@ -680,8 +680,6 @@
 	return -ENODEV;
 
       match:
-	MOD_INC_USE_COUNT;
-
 	file->private_data = card;
 	return 0;
 }
@@ -689,14 +687,11 @@
 static int emu10k1_mixer_release(struct inode *inode, struct file *file)
 {
 	DPF(4, "emu10k1_mixer_release()\n");
-	MOD_DEC_USE_COUNT;
 	return 0;
 }
 
 struct file_operations emu10k1_mixer_fops = {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	owner:		THIS_MODULE,
-#endif
 	llseek:		no_llseek,
 	ioctl:		emu10k1_mixer_ioctl,
 	open:		emu10k1_mixer_open,
