diff -ruN src.orig/linux/kernel/Makefile src/linux/kernel/Makefile
--- src.orig/linux/kernel/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ src/linux/kernel/Makefile	2004-07-25 12:01:03.000000000 +0200
@@ -0,0 +1,37 @@
+
+KERNEL_DIR := /lib/modules/$(shell uname -r)/build
+
+EXTRA_CFLAGS += -I$(obj)/../../common/Headers -D_LOOSE_KERNEL_NAMES -DMODVERSIONS -D__Pentium__ -DCONFIG_KERNELD -DMODULE -D__KERNEL__ -DLINUX
+
+obj-m := midishare.o
+midishare-objs := msLoader.o MidiShareLinux.o MidiShare.o msConf.o \
+      msAlarms.o msAppls.o msConnx.o \
+      msFilter.o msMail.o msTasks.o msXmtRcv.o \
+      msHandler.o msInit.o msSmpte.o msTime.o \
+      msEvents.o msFields.o msMemory.o msSeq.o \
+      msSorter.o msDriver.o
+
+ifndef KERNELRELEASE
+
+C = Clients
+K = Kernel
+M = Memory
+S = Sorter
+D = Drivers
+
+COMMON := $(C)/msAlarms.c $(C)/msAppls.c $(C)/msConnx.c $(C)/msFilter.c \
+$(C)/msMail.c $(C)/msTasks.c $(C)/msXmtRcv.c \
+$(K)/msHandler.c $(K)/msInit.c $(K)/msSmpte.c $(K)/msTime.c \
+$(M)/msEvents.c $(M)/msFields.c $(M)/msMemory.c $(M)/msSeq.c \
+$(S)/msSorter.c $(D)/msDriver.c
+
+all:
+	for x in $(COMMON); do ln -sf ../../common/$$x `basename $$x`; done
+	$(MAKE) modules -C $(KERNEL_DIR) SUBDIRS=$(shell pwd)
+
+clean:
+	-rm -f *.ko *.o
+	-rm -f *.mod.* .*.cmd
+	-for x in $(COMMON); do rm -f `basename $$x`; done
+
+endif
diff -ruN src.orig/linux/kernel/MidiShare.c src/linux/kernel/MidiShare.c
--- src.orig/linux/kernel/MidiShare.c	2002-06-11 10:00:28.000000000 +0200
+++ src/linux/kernel/MidiShare.c	2004-07-25 12:08:01.373225440 +0200
@@ -27,7 +27,7 @@
 */
 
 #ifdef MODVERSIONS
-#include <linux/modversions.h>
+#include <config/modversions.h>
 #endif
 
 #include <linux/kernel.h>
diff -ruN src.orig/linux/kernel/MidiShareLinux.c src/linux/kernel/MidiShareLinux.c
--- src.orig/linux/kernel/MidiShareLinux.c	2004-07-22 23:36:29.000000000 +0200
+++ src/linux/kernel/MidiShareLinux.c	2004-07-25 12:08:01.374225288 +0200
@@ -28,7 +28,7 @@
 */
   
 #ifdef MODVERSIONS
-#include <linux/modversions.h>
+#include <config/modversions.h>
 #endif
 
 /* centralizing compatibility issues between 2.0, 2.2, 2.4 */
@@ -64,6 +64,8 @@
 
 #include <linux/slab.h>
 #include <linux/poll.h>
+#include <asm/param.h>
+#include <linux/timer.h>
 
 #include "msLoader.h" 
 #include "msExtern.h"
@@ -76,7 +78,7 @@
 /*_______________________________________________________________________*/
 
 typedef struct TMachine {
-	struct tq_struct 	timerTask;  /* timer task 						*/
+	struct timer_list 	timerTask;  /* timer task 						*/
 	NEW_WAIT_QUEUE		stopQueue;	/* stop queue (for cleanup_module ) */
 	struct timeval		time;		/* for timer management 			*/
 	long				phase;	/* used to count ClockHandler calls	*/
@@ -92,7 +94,7 @@
 	
 } LinuxContext, * LinuxContextPtr;
 
-static void TimerTask(void * arg);
+static void TimerTask(unsigned long arg);
 
 /* 
   	The machine structure (TLinux structure) is globally allocated so that the TimerTask 
@@ -316,12 +318,10 @@
 
 static void InitMachine (TLinuxPtr machine)
 {
-	#ifndef LINUX_24
-	machine->timerTask.next = NULL;			/* Next item in list - queue_task will do this for us */
-	#endif
-	machine->timerTask.sync = 0;    		/* A flag meaning we haven't been inserted into a task queue yet */
-	machine->timerTask.routine = TimerTask;   	/* The function to run */
-	machine->timerTask.data = gMem;        		/* the arg parameter to the interrupt routine : the MidiShare global data */
+	//printk("midishare: initializing\n");
+	init_timer(&machine->timerTask);
+	machine->timerTask.data = (unsigned long)gMem;
+	machine->timerTask.function = TimerTask;
 	INIT_WAIT_QUEUE(machine->stopQueue);
 	machine->phase = 0;
 	machine->status = true;
@@ -336,7 +336,7 @@
 	to take into account that HZ may not be a divider of 1000 or
 	can even be greater than 1000 hz.	
 */	
-static void TimerTask(void * arg)
+static void TimerTask(unsigned long arg)
 {
 	TMSGlobalPtr g  = (TMSGlobalPtr) arg;
 	TLinuxPtr machine = (TLinuxPtr) g->local;
@@ -347,7 +347,8 @@
 		long i = machine->phase;
 		while (i<1000) { ClockHandler(g); i+=HZ; }
 		machine->phase = i-1000;
-		queue_task(&machine->timerTask, &tq_timer);  
+		machine->timerTask.expires = 1;
+		add_timer(&machine->timerTask); 
   	}
 }
 
@@ -369,8 +370,10 @@
 void OpenTimeInterrupts (TMSGlobalPtr g)
 {
 	TLinuxPtr machine = (TLinuxPtr) g->local;
+	//printk("midishare: waking up\n");
 	do_gettimeofday(&machine->time);
-	queue_task(&machine->timerTask, &tq_timer); 
+	machine->timerTask.expires = 1;
+	add_timer(&machine->timerTask); 
 }
 
 /*__________________________________________________________________________*/
@@ -378,6 +381,7 @@
 void CloseTimeInterrupts(TMSGlobalPtr g)
 {
 	TLinuxPtr machine = (TLinuxPtr) g->local;
+	//printk("midishare: sleeping\n");
 	machine->status = false;
 	interruptible_sleep_on(&machine->stopQueue);
 }
diff -ruN src.orig/linux/kernel/msConf.c src/linux/kernel/msConf.c
--- src.orig/linux/kernel/msConf.c	2002-07-22 13:07:31.000000000 +0200
+++ src/linux/kernel/msConf.c	2004-07-25 12:08:01.374225288 +0200
@@ -22,7 +22,7 @@
 
 #ifdef MODULE
 #ifdef MODVERSIONS
-# include <linux/modversions.h>
+# include <config/modversions.h>
 #endif
 #define malloc(size)	kmalloc(size, GFP_KERNEL)
 #define free			kfree
@@ -32,6 +32,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <asm/current.h>
+#include <linux/sched.h>
 #include <asm/string.h>
 
 #include "msConf.h"
@@ -193,17 +194,17 @@
 static char read_char (fileptr fd)
 {
 	long l; ssize_t n; char *c = (char *)&l;
-	long savedLimit = get_current()->addr_limit.seg;
-	get_current()->addr_limit.seg = 0xffffffff;
+	long savedLimit = current_thread_info()->addr_limit.seg;
+	current_thread_info()->addr_limit.seg = 0xffffffff;
 
 	do {
 		n = generic_file_read (fd, c, 1, &(fd->f_pos));
 		if (n <= 0) {
-			get_current()->addr_limit.seg = savedLimit;
+			current_thread_info()->addr_limit.seg = savedLimit;
 			return EOF;
 		}
 	} while ((*c == ' ') || (*c == '\t'));
-	get_current()->addr_limit.seg = savedLimit;
+	current_thread_info()->addr_limit.seg = savedLimit;
 	return *c;
 }
 
diff -ruN src.orig/linux/kernel/msLoader.c src/linux/kernel/msLoader.c
--- src.orig/linux/kernel/msLoader.c	2003-02-04 17:16:22.000000000 +0100
+++ src/linux/kernel/msLoader.c	2004-07-25 12:08:01.375225136 +0200
@@ -35,7 +35,7 @@
 
 #ifdef MODULE
 # ifdef MODVERSIONS
-# include <linux/modversions.h>
+# include <config/modversions.h>
 # endif
 #define EXPORT_SYMTAB
 #include <linux/module.h>
@@ -81,8 +81,8 @@
 
 	while (s[n]) n++;	/* longueur de s */
 	if (dst != NULL) {
-		(* dst->driver.write)(dst, 0, s, n);
-		(* dst->driver.write)(dst, 0, "\015\012", 2);
+		(* dst->driver->write)(dst, 0, s, n);
+		(* dst->driver->write)(dst, 0, "\015\012", 2);
 	}
 }
 
@@ -127,7 +127,7 @@
 	int n = MSCountAppls(Clients(gMem));
 	
 	while (n){
-	 	MOD_DEC_USE_COUNT;
+	 	//MOD_DEC_USE_COUNT;
 	 	MSClose( MSGetIndAppl(n--,Clients(gMem)),gMem);
 	}
 	
@@ -138,7 +138,7 @@
 
 static int myopen(struct inode *inode, struct file * f)
 {
-	MOD_INC_USE_COUNT;
+	//MOD_INC_USE_COUNT;
 	return 0; 		/* 0 = OK, tout va bien */
 }
 
@@ -147,7 +147,7 @@
 static int myclose(struct inode *inode, struct file * f)
 {
 	mskCloseAll(f);
-	MOD_DEC_USE_COUNT;
+	//MOD_DEC_USE_COUNT;
 	return 0;
 }
 
diff -ruN src.orig/linux/kernel/msLoader.h src/linux/kernel/msLoader.h
--- src.orig/linux/kernel/msLoader.h	2001-06-22 18:48:42.000000000 +0200
+++ src/linux/kernel/msLoader.h	2004-07-25 12:08:01.375225136 +0200
@@ -31,6 +31,8 @@
 
 /* functions prototypes */
 
+struct file;
+
 int mskGetVersion(unsigned long userptr,struct file *);
 int mskCountAppls(unsigned long userptr,struct file *);
 int mskGetIndAppl(unsigned long userptr,struct file *);
diff -ruN src.orig/linux/makefile src/linux/makefile
--- src.orig/linux/makefile	2003-02-04 16:54:19.000000000 +0100
+++ src/linux/makefile	2004-07-25 11:46:42.000000000 +0200
@@ -11,7 +11,7 @@
 	make -f appls
 
 kernel: common
-	make -C kernel
+	make -C kernel -f Makefile
 
 common:
 	make -C ../common
@@ -20,32 +20,32 @@
 
 install: libinstall clientsinstall
 	[ -d $(MODF) ] || mkdir $(MODF)
-	install MidiShare.o $(MODF)
+	install -m 644 kernel/midishare.ko $(MODF)
 	/sbin/depmod -a
 	install MidiShare $(RC)/init.d
 	ln -s $(INIT)/MidiShare $(RC)/rc5.d/S90MidiShare
 	ln -s $(INIT)/MidiShare $(RC)/rc3.d/S90MidiShare
-	/sbin/modprobe MidiShare 
+	/sbin/modprobe midishare
 
 uninstall: libuninstall clientsuninstall
 	rm -f /etc/$(CONF)
-	rm -f $(MODF)/MidiShare.o
+	rm -f $(MODF)/midishare.ko
 	rm -f $(INIT)/MidiShare $(RC)/rc[35].d/*MidiShare
-	/sbin/rmmod MidiShare
-	
+	/sbin/rmmod midishare
+
 clean:
 	make -i -C ../common/Memory clean 
 	make -i -C ../common clean 
-	make -i -C kernel clean 
+	make -i -C kernel clean -f Makefile 
 	make -i -C library clean 
 	make -f appls clean
 
 
 #Compile applications, tools and drivers
-	
+
 clients:
 	make -f appls
-	
+
 #Install applications, tools and drivers
 
 clientsinstall:
@@ -68,14 +68,14 @@
 	cp $(CONF) /etc/$(CONF)
 	[ -d $(INCF) ] || mkdir $(INCF)
 	install  Include/MidiShare.h $(INCF)
-	
+
 test:
 	make -C tests all
-	
+
 driver:
 	make -C drivers all
 
-	
+
 dep:
 	make -i -C ../common/Memory dep 
 	make -i -C ../common dep 
diff -ruN src.orig/linux/MidiShare src/linux/MidiShare
--- src.orig/linux/MidiShare	2000-07-19 18:08:05.000000000 +0200
+++ src/linux/MidiShare	2004-07-25 12:08:01.376224984 +0200
@@ -24,23 +24,23 @@
 case "$1" in
   start)
 	# Check if MidiShare is already installed
-	lsmod | grep MidiShare >/dev/null
+	lsmod | grep midishare >/dev/null
 	if [ ! $? ]; then 
 		echo MidiShare module is still installed
 	else
 		echo -n Loading MidiShare module
-		modprobe MidiShare 2>/dev/null
+		modprobe midishare 2>/dev/null
 		result
 	fi
 	;;
   stop)
 	# Check if MidiShare is already installed
-	lsmod | grep MidiShare >/dev/null
+	lsmod | grep midishare >/dev/null
 	if [ $? ]; then 
 		echo MidiShare module is not installed
 	else
 		echo -n Removing MidiShare module
-		rmmod MidiShare 2>/dev/null
+		rmmod midishare 2>/dev/null
 		result
 	fi
 	;;
